@fileverse-dev/dsheet 4.0.3 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{constants-Cdz6oSCq.js → constants-CRFfbkoQ.js} +1 -1
- package/dist/constants.js +1 -1
- package/dist/{crypto-constants-CqpCRs86.js → crypto-constants-ZTlAYRUf.js} +33 -22
- package/dist/editor/components/sidebar/use-right-panels.d.ts +1 -1
- package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
- package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -3
- package/dist/editor/utils/compact-committed-celldata.d.ts +11 -10
- package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
- package/dist/editor/utils/import-compaction.d.ts +25 -0
- package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
- package/dist/editor/utils/xlsx-import-pipeline.d.ts +28 -0
- package/dist/{executeStringFunction-BQvE7aeV.js → executeStringFunction-B6fhDKyN.js} +7014 -6490
- package/dist/formula.js +1 -1
- package/dist/{index-CeTa91qc.js → index-BqGOKo9u.js} +15445 -14688
- package/dist/index.es.js +22 -22
- package/dist/sheet-engine/core/api/common.d.ts +1 -0
- package/dist/sheet-engine/core/context.d.ts +3 -1
- package/dist/sheet-engine/core/index.d.ts +2 -2
- package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +11 -0
- package/dist/sheet-engine/core/modules/formula.d.ts +27 -0
- package/dist/sheet-engine/core/modules/index.d.ts +3 -2
- package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
- package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +2 -0
- package/dist/sheet-engine/core/settings.d.ts +2 -0
- package/dist/sheet-engine/core/types.d.ts +21 -0
- package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
- package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -0
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/{template-data-list-oP1s0Uxn.js → template-data-list-RKnVLsuf.js} +51 -50
- package/dist/use-xlsx-import-impl-Bddlxx23.js +1898 -0
- package/dist/worker/dsheet-worker-client.d.ts +14 -0
- package/dist/worker/dsheet-worker.d.ts +14 -0
- package/dist/xlsx-defined-names-DsWdNZw-.js +117 -0
- package/dist/xlsx-export-impl-DJiXCevi.js +831 -0
- package/dist/xlsx-hyperlink-inline-CTg4_gg1.js +2512 -0
- package/package.json +5 -4
- package/dist/use-xlsx-import-impl-BVsfV8ZV.js +0 -1572
- package/dist/xlsx-export-impl-Ber9FhFY.js +0 -3138
- package/dist/xlsx-hyperlink-inline-DzewAypN.js +0 -71
- package/dist/xlsx-image-utils-Cvg0qxRA.js +0 -126
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
import { utils as F, write as it } from "xlsx-js-style";
|
|
2
|
+
import { Workbook as ct } from "exceljs";
|
|
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-CTg4_gg1.js";
|
|
5
|
+
import { b as dt } from "./executeStringFunction-B6fhDKyN.js";
|
|
6
|
+
import { e as ht } from "./index-BqGOKo9u.js";
|
|
7
|
+
const mt = {
|
|
8
|
+
1: "thin",
|
|
9
|
+
2: "hair",
|
|
10
|
+
3: "dotted",
|
|
11
|
+
4: "dashed",
|
|
12
|
+
5: "dashDot",
|
|
13
|
+
6: "dashDotDot",
|
|
14
|
+
7: "double",
|
|
15
|
+
8: "medium",
|
|
16
|
+
9: "mediumDashed",
|
|
17
|
+
10: "mediumDashDot",
|
|
18
|
+
11: "mediumDashDotDot",
|
|
19
|
+
12: "slantDashDot",
|
|
20
|
+
13: "thick"
|
|
21
|
+
}, gt = (e) => {
|
|
22
|
+
if (typeof e != "string") return "000000";
|
|
23
|
+
const o = e.replace("#", "").toUpperCase();
|
|
24
|
+
return o.length === 3 ? o.replace(/(.)/g, "$1$1") : o.length === 6 ? o : "000000";
|
|
25
|
+
}, q = (e, o) => {
|
|
26
|
+
const t = Number(e);
|
|
27
|
+
if (t)
|
|
28
|
+
return {
|
|
29
|
+
style: mt[t] ?? "thin",
|
|
30
|
+
color: { rgb: gt(o) }
|
|
31
|
+
};
|
|
32
|
+
}, I = (e, o, t, r, n) => {
|
|
33
|
+
if (!n || !r.l && !r.r && !r.t && !r.b) return;
|
|
34
|
+
const l = F.encode_cell({ r: o, c: t }), i = {
|
|
35
|
+
...e[l] || { t: "z" }
|
|
36
|
+
}, f = { ...i.s || {} }, d = { ...f.border || {} };
|
|
37
|
+
r.l && (d.left = n), r.r && (d.right = n), r.t && (d.top = n), r.b && (d.bottom = n), f.border = d, i.s = f, e[l] = i;
|
|
38
|
+
}, xt = (e, o) => {
|
|
39
|
+
o.forEach((t) => {
|
|
40
|
+
if (t.rangeType === "cell") {
|
|
41
|
+
if (!t.value) return;
|
|
42
|
+
const { row_index: r, col_index: n } = t.value;
|
|
43
|
+
if (r == null || n == null) return;
|
|
44
|
+
const l = t.value, i = F.encode_cell({ r, c: n }), f = {
|
|
45
|
+
...e[i] || { t: "z" }
|
|
46
|
+
}, d = { ...f.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, f.s = d, e[i] = f;
|
|
48
|
+
} else if (t.rangeType === "range") {
|
|
49
|
+
const { borderType: r, style: n, color: l, range: i } = t;
|
|
50
|
+
if (r === "border-none" || !Array.isArray(i) || !n)
|
|
51
|
+
return;
|
|
52
|
+
const f = q(n, l);
|
|
53
|
+
if (!f) return;
|
|
54
|
+
i.forEach((d) => {
|
|
55
|
+
const [a, T] = d.row, [w, k] = d.column;
|
|
56
|
+
for (let C = a; C <= T; C++)
|
|
57
|
+
for (let m = w; m <= k; m++)
|
|
58
|
+
switch (r) {
|
|
59
|
+
case "border-all":
|
|
60
|
+
I(
|
|
61
|
+
e,
|
|
62
|
+
C,
|
|
63
|
+
m,
|
|
64
|
+
{ l: !0, r: !0, t: !0, b: !0 },
|
|
65
|
+
f
|
|
66
|
+
);
|
|
67
|
+
break;
|
|
68
|
+
case "border-outside":
|
|
69
|
+
I(
|
|
70
|
+
e,
|
|
71
|
+
C,
|
|
72
|
+
m,
|
|
73
|
+
{ l: m === w, r: m === k, t: C === a, b: C === T },
|
|
74
|
+
f
|
|
75
|
+
);
|
|
76
|
+
break;
|
|
77
|
+
case "border-inside":
|
|
78
|
+
I(
|
|
79
|
+
e,
|
|
80
|
+
C,
|
|
81
|
+
m,
|
|
82
|
+
{ r: m < k, b: C < T },
|
|
83
|
+
f
|
|
84
|
+
);
|
|
85
|
+
break;
|
|
86
|
+
case "border-horizontal":
|
|
87
|
+
I(e, C, m, { b: C < T }, f);
|
|
88
|
+
break;
|
|
89
|
+
case "border-vertical":
|
|
90
|
+
I(e, C, m, { r: m < k }, f);
|
|
91
|
+
break;
|
|
92
|
+
case "border-left":
|
|
93
|
+
m === w && I(e, C, m, { l: !0 }, f);
|
|
94
|
+
break;
|
|
95
|
+
case "border-right":
|
|
96
|
+
m === k && I(e, C, m, { r: !0 }, f);
|
|
97
|
+
break;
|
|
98
|
+
case "border-top":
|
|
99
|
+
C === a && I(e, C, m, { t: !0 }, f);
|
|
100
|
+
break;
|
|
101
|
+
case "border-bottom":
|
|
102
|
+
C === T && I(e, C, m, { b: !0 }, f);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
function G(e) {
|
|
110
|
+
if (!e || typeof e != "string") return null;
|
|
111
|
+
const o = e.trim();
|
|
112
|
+
if (o.startsWith("#")) {
|
|
113
|
+
const r = o.replace("#", "").toUpperCase();
|
|
114
|
+
return r.length === 3 ? "FF" + r.split("").map((n) => n + n).join("") : r.length === 6 ? "FF" + r : null;
|
|
115
|
+
}
|
|
116
|
+
const t = o.match(/rgba?\s*\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);
|
|
117
|
+
if (t) {
|
|
118
|
+
const r = (n) => Math.min(255, Math.max(0, Math.round(n))).toString(16).padStart(2, "0").toUpperCase();
|
|
119
|
+
return "FF" + r(parseFloat(t[1])) + r(parseFloat(t[2])) + r(parseFloat(t[3]));
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
function bt(e) {
|
|
124
|
+
const o = {}, t = {};
|
|
125
|
+
if (e.textColor && e.textColor.toLowerCase() !== "#000000") {
|
|
126
|
+
const n = G(e.textColor);
|
|
127
|
+
n && (t.color = { argb: n });
|
|
128
|
+
}
|
|
129
|
+
e.bold && (t.bold = !0), e.italic && (t.italic = !0), e.underline && (t.underline = !0), e.strikethrough && (t.strike = !0), Object.keys(t).length > 0 && (o.font = t);
|
|
130
|
+
const r = e.cellColor;
|
|
131
|
+
if (r && r.toLowerCase() !== "#ffffff") {
|
|
132
|
+
const n = G(r);
|
|
133
|
+
n && (o.fill = { type: "pattern", pattern: "solid", fgColor: { argb: n } });
|
|
134
|
+
}
|
|
135
|
+
return o;
|
|
136
|
+
}
|
|
137
|
+
function yt(e) {
|
|
138
|
+
return !Array.isArray(e) || e.length === 0 ? "" : e.map((t) => {
|
|
139
|
+
const [r, n] = t.row, [l, i] = t.column, f = F.encode_cell({ r, c: l }), d = F.encode_cell({ r: n, c: i });
|
|
140
|
+
return f === d ? f : `${f}:${d}`;
|
|
141
|
+
}).filter(Boolean).join(" ");
|
|
142
|
+
}
|
|
143
|
+
function Ct(e, o, t) {
|
|
144
|
+
const { conditionName: r, conditionValue: n = [], format: l = {} } = e, i = bt(l), f = (a) => a.replace(/"/g, '""'), d = o.split(/[\s:]/)[0];
|
|
145
|
+
switch (r) {
|
|
146
|
+
case "greaterThan":
|
|
147
|
+
case "greaterThanOrEqual":
|
|
148
|
+
case "lessThan":
|
|
149
|
+
case "lessThanOrEqual":
|
|
150
|
+
case "equal":
|
|
151
|
+
return n[0] ? {
|
|
152
|
+
type: "cellIs",
|
|
153
|
+
operator: r,
|
|
154
|
+
formulae: [n[0]],
|
|
155
|
+
priority: t,
|
|
156
|
+
style: i
|
|
157
|
+
} : null;
|
|
158
|
+
case "notEqual":
|
|
159
|
+
return n[0] ? {
|
|
160
|
+
type: "cellIs",
|
|
161
|
+
operator: "notEqual",
|
|
162
|
+
formulae: [n[0]],
|
|
163
|
+
priority: t,
|
|
164
|
+
style: i
|
|
165
|
+
} : null;
|
|
166
|
+
case "between":
|
|
167
|
+
return n.length < 2 ? null : {
|
|
168
|
+
type: "cellIs",
|
|
169
|
+
operator: "between",
|
|
170
|
+
formulae: [n[0], n[1]],
|
|
171
|
+
priority: t,
|
|
172
|
+
style: i
|
|
173
|
+
};
|
|
174
|
+
case "notBetween":
|
|
175
|
+
return n.length < 2 ? null : {
|
|
176
|
+
type: "cellIs",
|
|
177
|
+
operator: "notBetween",
|
|
178
|
+
formulae: [n[0], n[1]],
|
|
179
|
+
priority: t,
|
|
180
|
+
style: i
|
|
181
|
+
};
|
|
182
|
+
case "textContains": {
|
|
183
|
+
if (!n[0]) return null;
|
|
184
|
+
const a = n[0];
|
|
185
|
+
return {
|
|
186
|
+
type: "containsText",
|
|
187
|
+
operator: "containsText",
|
|
188
|
+
text: a,
|
|
189
|
+
formulae: [
|
|
190
|
+
`NOT(ISERROR(SEARCH("${f(a)}",${d})))`
|
|
191
|
+
],
|
|
192
|
+
priority: t,
|
|
193
|
+
style: i
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
case "containsText": {
|
|
197
|
+
if (!n[0]) return null;
|
|
198
|
+
const a = n[0];
|
|
199
|
+
return {
|
|
200
|
+
type: "containsText",
|
|
201
|
+
operator: "containsText",
|
|
202
|
+
text: a,
|
|
203
|
+
formulae: [
|
|
204
|
+
`NOT(ISERROR(SEARCH("${f(a)}",${d})))`
|
|
205
|
+
],
|
|
206
|
+
priority: t,
|
|
207
|
+
style: i
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
case "textDoesNotContain": {
|
|
211
|
+
if (!n[0]) return null;
|
|
212
|
+
const a = n[0];
|
|
213
|
+
return {
|
|
214
|
+
type: "notContainsText",
|
|
215
|
+
operator: "notContainsText",
|
|
216
|
+
text: a,
|
|
217
|
+
formulae: [`ISERROR(SEARCH("${f(a)}",${d}))`],
|
|
218
|
+
priority: t,
|
|
219
|
+
style: i
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
case "notContainsText":
|
|
223
|
+
case "notContains": {
|
|
224
|
+
if (!n[0]) return null;
|
|
225
|
+
const a = n[0];
|
|
226
|
+
return {
|
|
227
|
+
type: "notContainsText",
|
|
228
|
+
operator: "notContainsText",
|
|
229
|
+
text: a,
|
|
230
|
+
formulae: [`ISERROR(SEARCH("${f(a)}",${d}))`],
|
|
231
|
+
priority: t,
|
|
232
|
+
style: i
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
case "textStartsWith": {
|
|
236
|
+
if (!n[0]) return null;
|
|
237
|
+
const a = n[0];
|
|
238
|
+
return {
|
|
239
|
+
type: "beginsWith",
|
|
240
|
+
operator: "beginsWith",
|
|
241
|
+
text: a,
|
|
242
|
+
formulae: [
|
|
243
|
+
`LEFT(${d},${a.length})="${f(a)}"`
|
|
244
|
+
],
|
|
245
|
+
priority: t,
|
|
246
|
+
style: i
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
case "beginsWith": {
|
|
250
|
+
if (!n[0]) return null;
|
|
251
|
+
const a = n[0];
|
|
252
|
+
return {
|
|
253
|
+
type: "beginsWith",
|
|
254
|
+
operator: "beginsWith",
|
|
255
|
+
text: a,
|
|
256
|
+
formulae: [
|
|
257
|
+
`LEFT(${d},${a.length})="${f(a)}"`
|
|
258
|
+
],
|
|
259
|
+
priority: t,
|
|
260
|
+
style: i
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
case "textEndsWith": {
|
|
264
|
+
if (!n[0]) return null;
|
|
265
|
+
const a = n[0];
|
|
266
|
+
return {
|
|
267
|
+
type: "endsWith",
|
|
268
|
+
operator: "endsWith",
|
|
269
|
+
text: a,
|
|
270
|
+
formulae: [
|
|
271
|
+
`RIGHT(${d},${a.length})="${f(a)}"`
|
|
272
|
+
],
|
|
273
|
+
priority: t,
|
|
274
|
+
style: i
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
case "endsWith": {
|
|
278
|
+
if (!n[0]) return null;
|
|
279
|
+
const a = n[0];
|
|
280
|
+
return {
|
|
281
|
+
type: "endsWith",
|
|
282
|
+
operator: "endsWith",
|
|
283
|
+
text: a,
|
|
284
|
+
formulae: [
|
|
285
|
+
`RIGHT(${d},${a.length})="${f(a)}"`
|
|
286
|
+
],
|
|
287
|
+
priority: t,
|
|
288
|
+
style: i
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
case "textExactly": {
|
|
292
|
+
if (!n[0]) return null;
|
|
293
|
+
const a = n[0];
|
|
294
|
+
return {
|
|
295
|
+
// Keep this in the text-rule family so Google/OOXML readers preserve it
|
|
296
|
+
// similarly to other text CF rules.
|
|
297
|
+
type: "containsText",
|
|
298
|
+
operator: "equal",
|
|
299
|
+
text: a,
|
|
300
|
+
formulae: [`EXACT(${d},"${f(a)}")`],
|
|
301
|
+
priority: t,
|
|
302
|
+
style: i
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
case "empty":
|
|
306
|
+
return {
|
|
307
|
+
type: "containsText",
|
|
308
|
+
operator: "containsBlanks",
|
|
309
|
+
formulae: [`LEN(TRIM(${d}))=0`],
|
|
310
|
+
priority: t,
|
|
311
|
+
style: i
|
|
312
|
+
};
|
|
313
|
+
case "containsBlanks":
|
|
314
|
+
return {
|
|
315
|
+
type: "containsText",
|
|
316
|
+
operator: "containsBlanks",
|
|
317
|
+
formulae: [`LEN(TRIM(${d}))=0`],
|
|
318
|
+
priority: t,
|
|
319
|
+
style: i
|
|
320
|
+
};
|
|
321
|
+
case "notEmpty":
|
|
322
|
+
return {
|
|
323
|
+
type: "containsText",
|
|
324
|
+
operator: "notContainsBlanks",
|
|
325
|
+
formulae: [`LEN(TRIM(${d}))>0`],
|
|
326
|
+
priority: t,
|
|
327
|
+
style: i
|
|
328
|
+
};
|
|
329
|
+
case "notContainsBlanks":
|
|
330
|
+
return {
|
|
331
|
+
type: "containsText",
|
|
332
|
+
operator: "notContainsBlanks",
|
|
333
|
+
formulae: [`LEN(TRIM(${d}))>0`],
|
|
334
|
+
priority: t,
|
|
335
|
+
style: i
|
|
336
|
+
};
|
|
337
|
+
case "top10":
|
|
338
|
+
return {
|
|
339
|
+
type: "top10",
|
|
340
|
+
rank: parseInt(n[0] || "10", 10) || 10,
|
|
341
|
+
percent: !1,
|
|
342
|
+
bottom: !1,
|
|
343
|
+
priority: t,
|
|
344
|
+
style: i
|
|
345
|
+
};
|
|
346
|
+
case "top10Percent":
|
|
347
|
+
case "top10_percent":
|
|
348
|
+
return {
|
|
349
|
+
type: "top10",
|
|
350
|
+
rank: parseInt(n[0] || "10", 10) || 10,
|
|
351
|
+
percent: !0,
|
|
352
|
+
bottom: !1,
|
|
353
|
+
priority: t,
|
|
354
|
+
style: i
|
|
355
|
+
};
|
|
356
|
+
case "last10":
|
|
357
|
+
return {
|
|
358
|
+
type: "top10",
|
|
359
|
+
rank: parseInt(n[0] || "10", 10) || 10,
|
|
360
|
+
percent: !1,
|
|
361
|
+
bottom: !0,
|
|
362
|
+
priority: t,
|
|
363
|
+
style: i
|
|
364
|
+
};
|
|
365
|
+
case "last10Percent":
|
|
366
|
+
case "last10_percent":
|
|
367
|
+
return {
|
|
368
|
+
type: "top10",
|
|
369
|
+
rank: parseInt(n[0] || "10", 10) || 10,
|
|
370
|
+
percent: !0,
|
|
371
|
+
bottom: !0,
|
|
372
|
+
priority: t,
|
|
373
|
+
style: i
|
|
374
|
+
};
|
|
375
|
+
case "aboveAverage":
|
|
376
|
+
return { type: "aboveAverage", aboveAverage: !0, priority: t, style: i };
|
|
377
|
+
case "belowAverage":
|
|
378
|
+
return { type: "aboveAverage", aboveAverage: !1, priority: t, style: i };
|
|
379
|
+
case "date":
|
|
380
|
+
case "dateIs":
|
|
381
|
+
case "dateBefore":
|
|
382
|
+
case "dateAfter": {
|
|
383
|
+
const a = String(n[0] ?? ""), T = a.startsWith("preset:") ? a.slice(7) : a.toLowerCase();
|
|
384
|
+
return T === "today" || T === "tomorrow" || T === "yesterday" ? { type: "timePeriod", timePeriod: T, priority: t, style: i } : T === "pastWeek" ? { type: "timePeriod", timePeriod: "last7Days", priority: t, style: i } : T === "pastMonth" ? { type: "timePeriod", timePeriod: "lastMonth", priority: t, style: i } : T === "pastYear" ? { type: "timePeriod", timePeriod: "lastYear", priority: t, style: i } : null;
|
|
385
|
+
}
|
|
386
|
+
default:
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function Tt(e, o, t) {
|
|
391
|
+
var i;
|
|
392
|
+
const r = o.luckysheet_conditionformat_save, n = [];
|
|
393
|
+
if (!Array.isArray(r) || r.length === 0)
|
|
394
|
+
return { nextPriority: t, pendingDuplicateValues: n };
|
|
395
|
+
let l = t;
|
|
396
|
+
for (const f of r) {
|
|
397
|
+
if (f.type !== "default") continue;
|
|
398
|
+
const d = yt(f.cellrange);
|
|
399
|
+
if (!d) continue;
|
|
400
|
+
if (f.conditionName === "duplicateValue") {
|
|
401
|
+
const T = String(((i = f.conditionValue) == null ? void 0 : i[0]) ?? "0") === "1" ? "uniqueValues" : "duplicateValues";
|
|
402
|
+
n.push({
|
|
403
|
+
ref: d,
|
|
404
|
+
format: f.format || {},
|
|
405
|
+
priority: l,
|
|
406
|
+
type: T
|
|
407
|
+
}), l++;
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
const a = Ct(f, d, l);
|
|
411
|
+
a && (e.addConditionalFormatting({ ref: d, rules: [a] }), l++);
|
|
412
|
+
}
|
|
413
|
+
return { nextPriority: l, pendingDuplicateValues: n };
|
|
414
|
+
}
|
|
415
|
+
function wt(e) {
|
|
416
|
+
let o = "";
|
|
417
|
+
const t = [];
|
|
418
|
+
if (e.bold && t.push("<b/>"), e.italic && t.push("<i/>"), e.underline && t.push("<u/>"), e.strikethrough && t.push("<strike/>"), e.textColor && e.textColor.toLowerCase() !== "#000000") {
|
|
419
|
+
const n = G(e.textColor);
|
|
420
|
+
n && t.push(`<color rgb="${n}"/>`);
|
|
421
|
+
}
|
|
422
|
+
t.length > 0 && (o += `<font>${t.join("")}</font>`);
|
|
423
|
+
const r = e.cellColor;
|
|
424
|
+
if (r && r.toLowerCase() !== "#ffffff") {
|
|
425
|
+
const n = G(r);
|
|
426
|
+
n && (o += `<fill><patternFill patternType="solid"><fgColor rgb="${n}"/></patternFill></fill>`);
|
|
427
|
+
}
|
|
428
|
+
return `<dxf>${o}</dxf>`;
|
|
429
|
+
}
|
|
430
|
+
function Et(e, o) {
|
|
431
|
+
const t = e.match(/<dxfs count="(\d+)"/);
|
|
432
|
+
if (t) {
|
|
433
|
+
const r = parseInt(t[1], 10);
|
|
434
|
+
return {
|
|
435
|
+
xml: e.replace(/<dxfs count="\d+"/, `<dxfs count="${r + 1}"`).replace("</dxfs>", o + "</dxfs>"),
|
|
436
|
+
dxfId: r
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return e.includes("<dxfs/>") ? {
|
|
440
|
+
xml: e.replace("<dxfs/>", `<dxfs count="1">${o}</dxfs>`),
|
|
441
|
+
dxfId: 0
|
|
442
|
+
} : {
|
|
443
|
+
xml: e.replace(
|
|
444
|
+
"</styleSheet>",
|
|
445
|
+
`<dxfs count="1">${o}</dxfs></styleSheet>`
|
|
446
|
+
),
|
|
447
|
+
dxfId: 0
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
function $t(e) {
|
|
451
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
452
|
+
}
|
|
453
|
+
function At(e, o, t) {
|
|
454
|
+
const r = new RegExp(
|
|
455
|
+
`(<conditionalFormatting[^>]*\\bsqref="${$t(o)}"[^>]*>)`
|
|
456
|
+
);
|
|
457
|
+
if (r.test(e))
|
|
458
|
+
return e.replace(r, `$1${t}`);
|
|
459
|
+
const n = `<conditionalFormatting sqref="${o}">${t}</conditionalFormatting>`;
|
|
460
|
+
for (const l of [
|
|
461
|
+
"<pageMargins",
|
|
462
|
+
"<pageSetup",
|
|
463
|
+
"<headerFooter",
|
|
464
|
+
"<drawing",
|
|
465
|
+
"</worksheet>"
|
|
466
|
+
])
|
|
467
|
+
if (e.includes(l))
|
|
468
|
+
return e.replace(l, n + l);
|
|
469
|
+
return e + n;
|
|
470
|
+
}
|
|
471
|
+
function kt(e) {
|
|
472
|
+
return e.replace(
|
|
473
|
+
/<cfRule([^>]*)type="containsText"([^>]*?)>([\s\S]*?)<\/cfRule>/g,
|
|
474
|
+
(o, t, r, n) => {
|
|
475
|
+
if (/\btext=/.test(t) || /\btext=/.test(r)) return o;
|
|
476
|
+
const l = n.match(/<formula[^>]*>([\s\S]*?)<\/formula>/);
|
|
477
|
+
if (!l) return o;
|
|
478
|
+
const f = l[1].replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").match(/SEARCH\s*\(\s*"([^"]*)"/i);
|
|
479
|
+
if (!f) return o;
|
|
480
|
+
const d = f[1].replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
481
|
+
return `<cfRule${t}type="containsText"${r} text="${d}">${n}</cfRule>`;
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
async function Rt(e, o) {
|
|
486
|
+
var i;
|
|
487
|
+
const t = await ft.loadAsync(e), r = t.file("xl/styles.xml");
|
|
488
|
+
let n = r ? await r.async("text") : "", l = !1;
|
|
489
|
+
for (const [f, d] of Object.entries(t.files)) {
|
|
490
|
+
if (d.dir) continue;
|
|
491
|
+
const a = f.match(/^xl\/worksheets\/sheet(\d+)\.xml$/);
|
|
492
|
+
if (!a) continue;
|
|
493
|
+
const T = parseInt(a[1], 10) - 1;
|
|
494
|
+
let w = await d.async("text"), k = !1;
|
|
495
|
+
const C = kt(w);
|
|
496
|
+
C !== w && (w = C, k = !0);
|
|
497
|
+
const m = ((i = o[T]) == null ? void 0 : i.duplicateValues) ?? [];
|
|
498
|
+
for (const B of m) {
|
|
499
|
+
const O = wt(B.format), { xml: z, dxfId: Z } = Et(n, O);
|
|
500
|
+
n = z, l = !0;
|
|
501
|
+
const K = `<cfRule type="${B.type}" dxfId="${Z}" priority="${B.priority}"/>`;
|
|
502
|
+
w = At(w, B.ref, K), k = !0;
|
|
503
|
+
}
|
|
504
|
+
k && t.file(f, w);
|
|
505
|
+
}
|
|
506
|
+
return l && r && t.file("xl/styles.xml", n), t.generateAsync({ type: "arraybuffer", compression: "DEFLATE" });
|
|
507
|
+
}
|
|
508
|
+
const Ft = (e) => {
|
|
509
|
+
if (!e || typeof e != "string") return null;
|
|
510
|
+
const o = e.trim().toLowerCase();
|
|
511
|
+
if (o.startsWith("#")) {
|
|
512
|
+
const n = o.replace("#", "").toUpperCase();
|
|
513
|
+
return n.length === 3 ? n.split("").map((l) => l + l).join("").toUpperCase() : n.length === 6 ? n : null;
|
|
514
|
+
}
|
|
515
|
+
const t = /rgba?\s*\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+[\d.]+)?\s*\)/i, r = o.match(t);
|
|
516
|
+
if (r) {
|
|
517
|
+
const n = Math.min(255, Math.max(0, parseFloat(r[1]))), l = Math.min(255, Math.max(0, parseFloat(r[2]))), i = Math.min(255, Math.max(0, parseFloat(r[3])));
|
|
518
|
+
return ((1 << 24) + (n << 16) + (l << 8) + i).toString(16).slice(1).toUpperCase();
|
|
519
|
+
}
|
|
520
|
+
return null;
|
|
521
|
+
};
|
|
522
|
+
function St(e) {
|
|
523
|
+
const o = {};
|
|
524
|
+
if (e.bl === 1 && (o.bold = !0), e.it === 1 && (o.italic = !0), e.un === 1 && (o.underline = !0), e.cl === 1 && (o.strike = !0), e.fs && (o.size = Number(e.fs)), typeof e.ff == "string" && e.ff && (o.name = e.ff), e.fc) {
|
|
525
|
+
const t = Ft(e.fc);
|
|
526
|
+
t && (o.color = { argb: `FF${t}` });
|
|
527
|
+
}
|
|
528
|
+
return Object.keys(o).length > 0 ? o : void 0;
|
|
529
|
+
}
|
|
530
|
+
function rt(e) {
|
|
531
|
+
if (!Array.isArray(e) || e.length === 0) return null;
|
|
532
|
+
const o = [];
|
|
533
|
+
for (const t of e) {
|
|
534
|
+
const r = String(t.v ?? "");
|
|
535
|
+
if (r === "" && !t.bl && !t.it && !t.un && !t.cl) continue;
|
|
536
|
+
const n = St(t), l = { text: r };
|
|
537
|
+
n && (l.font = n), o.push(l);
|
|
538
|
+
}
|
|
539
|
+
return o.length === 0 || !o.some((t) => t.text !== "") ? null : { richText: o };
|
|
540
|
+
}
|
|
541
|
+
function vt(e, o) {
|
|
542
|
+
o.forEach((t, r) => {
|
|
543
|
+
const n = e.getCell(r);
|
|
544
|
+
n.value = t;
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
function Mt(e) {
|
|
548
|
+
const o = e == null ? void 0 : e.filter, t = e == null ? void 0 : e.filter_select, r = !!(o && Object.keys(o).length > 0), n = !!t && (Array.isArray(t.row) || Array.isArray(t.column));
|
|
549
|
+
return r || n;
|
|
550
|
+
}
|
|
551
|
+
const Y = (e) => {
|
|
552
|
+
if (!e || typeof e != "string") return null;
|
|
553
|
+
const o = e.trim().toLowerCase();
|
|
554
|
+
if (o.startsWith("#")) {
|
|
555
|
+
const n = o.replace("#", "").toUpperCase();
|
|
556
|
+
return n.length === 3 ? n.split("").map((l) => l + l).join("").toUpperCase() : n.length === 6 ? n : null;
|
|
557
|
+
}
|
|
558
|
+
const t = /rgba?\s*\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+[\d.]+)?\s*\)/i, r = o.match(t);
|
|
559
|
+
if (r) {
|
|
560
|
+
const n = Math.min(255, Math.max(0, parseFloat(r[1]))), l = Math.min(255, Math.max(0, parseFloat(r[2]))), i = Math.min(255, Math.max(0, parseFloat(r[3])));
|
|
561
|
+
return ((1 << 24) + (n << 16) + (l << 8) + i).toString(16).slice(1).toUpperCase();
|
|
562
|
+
}
|
|
563
|
+
return null;
|
|
564
|
+
}, jt = async (e, o, t, r) => {
|
|
565
|
+
var n, l, i, f, d, a, T;
|
|
566
|
+
if (!(!e.current || !o.current))
|
|
567
|
+
try {
|
|
568
|
+
const w = (l = (n = e.current).getWorkbookContext) == null ? void 0 : l.call(n), k = w == null ? void 0 : w.luckysheetfile;
|
|
569
|
+
Array.isArray(k) && k.some(Mt) && nt({
|
|
570
|
+
title: "Filters are not supported in Export",
|
|
571
|
+
variant: "warning",
|
|
572
|
+
showCloseButton: !0,
|
|
573
|
+
duration: 30 * 1e3
|
|
574
|
+
}), o.current.getArray(t);
|
|
575
|
+
const m = e.current.getAllSheets();
|
|
576
|
+
m.forEach((h) => ht(h));
|
|
577
|
+
const B = F.book_new(), O = m.map(() => /* @__PURE__ */ new Map()), z = /* @__PURE__ */ new Set();
|
|
578
|
+
m.forEach((h, W) => {
|
|
579
|
+
var J, N, U, L, V;
|
|
580
|
+
const R = dt(h), x = F.aoa_to_sheet(R);
|
|
581
|
+
Object.keys(x).forEach((p) => {
|
|
582
|
+
if (p.startsWith("!")) return;
|
|
583
|
+
const b = x[p];
|
|
584
|
+
b && (b.t === "s" || b.t === void 0) && b.v !== "" && !isNaN(Number(b.v)) && (x[p] = { ...b, v: Number(b.v), t: "n" });
|
|
585
|
+
}), x["!merges"] = [], (J = h.config) != null && J.merge && Object.values(h.config.merge).forEach((p) => {
|
|
586
|
+
x["!merges"].push({
|
|
587
|
+
s: { r: p.r, c: p.c },
|
|
588
|
+
e: { r: p.r + p.rs - 1, c: p.c + p.cs - 1 }
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
{
|
|
592
|
+
const b = Math.round(3437.714285714286) / 256, c = h.column || 36;
|
|
593
|
+
x["!cols"] = [];
|
|
594
|
+
for (let s = 0; s < c; s++) {
|
|
595
|
+
const g = (U = (N = h.config) == null ? void 0 : N.columnlen) == null ? void 0 : U[s];
|
|
596
|
+
if (g !== void 0) {
|
|
597
|
+
const u = Math.max(
|
|
598
|
+
0,
|
|
599
|
+
Math.round((Number(g) - 5) / 7 * 256) / 256
|
|
600
|
+
);
|
|
601
|
+
x["!cols"][s] = { wch: u };
|
|
602
|
+
} else
|
|
603
|
+
x["!cols"][s] = { wch: b };
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
{
|
|
607
|
+
const p = Math.round(60.48) / 4;
|
|
608
|
+
x.sheetFormat = {
|
|
609
|
+
...x.sheetFormat || {},
|
|
610
|
+
defaultRowHeight: String(p)
|
|
611
|
+
}, (L = h.config) != null && L.rowlen && (x["!rows"] = [], Object.entries(h.config.rowlen).forEach(([b, c]) => {
|
|
612
|
+
const s = Math.round(Number(c) * 0.72 * 4) / 4;
|
|
613
|
+
x["!rows"][Number(b)] = { hpt: s };
|
|
614
|
+
}));
|
|
615
|
+
}
|
|
616
|
+
const D = /* @__PURE__ */ new Set();
|
|
617
|
+
(h.celldata ?? []).forEach((p) => {
|
|
618
|
+
var A, S, $, _, j;
|
|
619
|
+
const b = p.r, c = p.c, s = p.v || {}, g = F.encode_cell({ r: b, c });
|
|
620
|
+
let u = x[g] || {};
|
|
621
|
+
if (u = { ...u }, s.f && (u.f = s.f.replace(/^=/, "")), !s.f && ((A = s.ct) == null ? void 0 : A.t) === "inlineStr" && Array.isArray(s.ct.s) ? (u.v = X(s.ct.s), u.t = "s") : u.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 && (u.w = s.m), !s.f && ((j = s.ct) == null ? void 0 : j.t) === "inlineStr" && Array.isArray(s.ct.s)) {
|
|
622
|
+
const M = rt(s.ct.s);
|
|
623
|
+
M && O[W].set(g, M);
|
|
624
|
+
}
|
|
625
|
+
if (s.ct && (s.ct.fa && (u.z = s.ct.fa), s.ct.t && s.ct.t !== "inlineStr" && (u.t = s.ct.t === "d" ? "n" : s.ct.t)), typeof u.v == "number" && !u.t && (u.t = "n"), u.s = u.s || {}, s.bg) {
|
|
626
|
+
const M = Y(s.bg);
|
|
627
|
+
M && (u.s.fill = {
|
|
628
|
+
patternType: "solid",
|
|
629
|
+
fgColor: { rgb: M }
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
u.s.font = {
|
|
633
|
+
...u.s.font || {},
|
|
634
|
+
bold: s.bl === 1 || void 0,
|
|
635
|
+
italic: s.it === 1 || void 0,
|
|
636
|
+
strike: s.cl === 1 || void 0,
|
|
637
|
+
underline: s.un === 1 || void 0,
|
|
638
|
+
sz: s.fs ?? 10,
|
|
639
|
+
name: s.ff ?? void 0,
|
|
640
|
+
color: (() => {
|
|
641
|
+
const M = Y(s.fc);
|
|
642
|
+
return M ? { rgb: M } : void 0;
|
|
643
|
+
})()
|
|
644
|
+
};
|
|
645
|
+
const E = { 0: "center", 1: "left", 2: "right" }, y = { 0: "center", 1: "top", 2: "bottom" };
|
|
646
|
+
u.s.alignment = {
|
|
647
|
+
...u.s.alignment || {},
|
|
648
|
+
wrapText: s.tb === "1" || s.tb === "2" ? !0 : void 0,
|
|
649
|
+
textRotation: s.tr !== void 0 ? s.tr : void 0
|
|
650
|
+
}, u.s.alignment.horizontal = E[s.ht] || void 0, u.s.alignment.vertical = y[s.vt] || void 0, s.tb !== void 0 && (u.s.alignment = u.s.alignment || {}, s.tb === "1" ? u.s.alignment.wrapText = !0 : s.tb === "2" && (u.s.alignment.shrinkToFit = !0)), D.add(g), x[g] = u;
|
|
651
|
+
}), R.forEach((p, b) => {
|
|
652
|
+
Array.isArray(p) && p.forEach((c, s) => {
|
|
653
|
+
if (!c || typeof c != "object") return;
|
|
654
|
+
const g = F.encode_cell({ r: b, c: s });
|
|
655
|
+
if (D.has(g)) return;
|
|
656
|
+
const u = !!c.f, E = c.bg || c.bl || c.it || c.cl || c.un || c.fs || c.ff || c.fc || c.ht !== void 0 || c.vt !== void 0 || c.tb !== void 0 || c.tr !== void 0;
|
|
657
|
+
if (!u && !E) return;
|
|
658
|
+
const y = { ...x[g] || {} };
|
|
659
|
+
if (y.s = y.s || {}, u && (y.f = c.f.replace(/^=/, "")), c.bg) {
|
|
660
|
+
const $ = Y(c.bg);
|
|
661
|
+
$ && (y.s.fill = { patternType: "solid", fgColor: { rgb: $ } });
|
|
662
|
+
}
|
|
663
|
+
y.s.font = {
|
|
664
|
+
...y.s.font || {},
|
|
665
|
+
bold: c.bl === 1 || void 0,
|
|
666
|
+
italic: c.it === 1 || void 0,
|
|
667
|
+
strike: c.cl === 1 || void 0,
|
|
668
|
+
underline: c.un === 1 || void 0,
|
|
669
|
+
sz: c.fs ?? 10,
|
|
670
|
+
name: c.ff ?? void 0,
|
|
671
|
+
color: (() => {
|
|
672
|
+
const $ = Y(c.fc);
|
|
673
|
+
return $ ? { rgb: $ } : void 0;
|
|
674
|
+
})()
|
|
675
|
+
};
|
|
676
|
+
const A = { 0: "center", 1: "left", 2: "right" }, S = { 0: "center", 1: "top", 2: "bottom" };
|
|
677
|
+
y.s.alignment = {
|
|
678
|
+
...y.s.alignment || {},
|
|
679
|
+
horizontal: A[c.ht] || void 0,
|
|
680
|
+
vertical: S[c.vt] || void 0,
|
|
681
|
+
textRotation: c.tr !== void 0 ? c.tr : void 0
|
|
682
|
+
}, c.tb === "1" ? y.s.alignment.wrapText = !0 : c.tb === "2" && (y.s.alignment.shrinkToFit = !0), x[g] = y;
|
|
683
|
+
});
|
|
684
|
+
}), R.forEach((p, b) => {
|
|
685
|
+
Array.isArray(p) && p.forEach((c, s) => {
|
|
686
|
+
var y;
|
|
687
|
+
if (!c || ((y = c.ct) == null ? void 0 : y.t) !== "inlineStr" || !Array.isArray(c.ct.s)) return;
|
|
688
|
+
const g = F.encode_cell({ r: b, c: s }), u = X(c.ct.s);
|
|
689
|
+
x[g] = {
|
|
690
|
+
...x[g] || {},
|
|
691
|
+
v: u,
|
|
692
|
+
t: "s"
|
|
693
|
+
};
|
|
694
|
+
const E = rt(c.ct.s);
|
|
695
|
+
E && O[W].set(g, E);
|
|
696
|
+
});
|
|
697
|
+
}), (V = h.config) != null && V.borderInfo && xt(x, h.config.borderInfo);
|
|
698
|
+
const v = h.name.length > 30 ? h.name.slice(0, 30) : h.name;
|
|
699
|
+
if (z.has(v)) {
|
|
700
|
+
const p = v !== h.name ? `"${h.name}" is too long and collides with another sheet after being shortened to "${v}"` : `Two sheets share the name "${h.name}"`;
|
|
701
|
+
throw new Error(
|
|
702
|
+
`${p}. Sheet names must be unique. Rename one and try again.`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
z.add(v), F.book_append_sheet(B, x, v);
|
|
706
|
+
});
|
|
707
|
+
const Z = await (r == null ? void 0 : r(t)) || "Untitled", K = it(B, {
|
|
708
|
+
bookType: "xlsx",
|
|
709
|
+
type: "array",
|
|
710
|
+
compression: !0
|
|
711
|
+
}), P = new ct();
|
|
712
|
+
await P.xlsx.load(K);
|
|
713
|
+
const H = P.model;
|
|
714
|
+
(f = (i = H == null ? void 0 : H.styles) == null ? void 0 : i.fonts) != null && f[0] && (H.styles.fonts[0] = { ...H.styles.fonts[0], size: 10 });
|
|
715
|
+
const tt = m.map(() => ({
|
|
716
|
+
duplicateValues: []
|
|
717
|
+
}));
|
|
718
|
+
m.forEach((h, W) => {
|
|
719
|
+
const R = P.worksheets[W];
|
|
720
|
+
if (!R) return;
|
|
721
|
+
vt(R, O[W]);
|
|
722
|
+
const x = h.data;
|
|
723
|
+
Object.entries(h.hyperlink || {}).forEach(([L, V]) => {
|
|
724
|
+
var A, S, $, _;
|
|
725
|
+
const p = ut(V);
|
|
726
|
+
if (!(p != null && p.linkAddress)) return;
|
|
727
|
+
const [b, c] = L.split("_").map(Number);
|
|
728
|
+
if (Number.isNaN(b) || Number.isNaN(c)) return;
|
|
729
|
+
const s = F.encode_cell({ r: b, c }), g = R.getCell(s), u = (A = x == null ? void 0 : x[b]) == null ? void 0 : A[c];
|
|
730
|
+
let E = "";
|
|
731
|
+
u && typeof u == "object" && ((S = u.ct) == null ? void 0 : S.t) === "inlineStr" && Array.isArray(u.ct.s) && (E = X(u.ct.s));
|
|
732
|
+
const y = E || (typeof g.text == "string" && g.text.length > 0 ? g.text : (($ = g.value) == null ? void 0 : $.text) || (Array.isArray((_ = g.value) == null ? void 0 : _.richText) ? g.value.richText.map((j) => j.text || "").join("") : "") || "");
|
|
733
|
+
g.value = {
|
|
734
|
+
text: y || p.linkAddress,
|
|
735
|
+
hyperlink: p.linkAddress
|
|
736
|
+
};
|
|
737
|
+
});
|
|
738
|
+
const { nextPriority: D, pendingDuplicateValues: v } = Tt(R, h, 1);
|
|
739
|
+
tt[W] = { duplicateValues: v };
|
|
740
|
+
let J = D;
|
|
741
|
+
if (!h.dataVerification) return;
|
|
742
|
+
const N = R;
|
|
743
|
+
N.dataValidations || (N.dataValidations = { model: {} }), N.dataValidations.model || (N.dataValidations.model = {});
|
|
744
|
+
const U = N.dataValidations.model;
|
|
745
|
+
Object.entries(h.dataVerification).forEach(([L, V]) => {
|
|
746
|
+
const p = V;
|
|
747
|
+
if (p.type !== "dropdown" && p.type !== "checkbox") return;
|
|
748
|
+
const [b, c] = L.split("_").map(Number), s = F.encode_cell({ r: b, c });
|
|
749
|
+
if (p.type === "checkbox") {
|
|
750
|
+
const u = (p.value1 || "TRUE").trim(), E = (p.value2 || "FALSE").trim(), y = [u, E].filter(Boolean);
|
|
751
|
+
U[s] = {
|
|
752
|
+
type: "list",
|
|
753
|
+
allowBlank: !0,
|
|
754
|
+
formulae: [`"${y.join(",")}"`],
|
|
755
|
+
showInputMessage: !!p.hintShow,
|
|
756
|
+
prompt: p.hintValue || "",
|
|
757
|
+
showErrorMessage: !!p.prohibitInput
|
|
758
|
+
};
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
const g = (p.value1 || "").split(",").map((u) => u.trim()).filter(Boolean);
|
|
762
|
+
if (g.length !== 0 && (U[s] = {
|
|
763
|
+
type: "list",
|
|
764
|
+
allowBlank: !0,
|
|
765
|
+
formulae: [`"${g.join(",")}"`],
|
|
766
|
+
showInputMessage: !!p.hintShow,
|
|
767
|
+
prompt: p.hintValue || "",
|
|
768
|
+
showErrorMessage: !!p.prohibitInput
|
|
769
|
+
}, p.color)) {
|
|
770
|
+
const u = p.color.split(",").map((A) => parseInt(A.trim(), 10)), E = (A) => Math.max(0, Math.min(255, A)).toString(16).padStart(2, "0").toUpperCase(), y = g.map((A, S) => {
|
|
771
|
+
const $ = u[S * 3], _ = u[S * 3 + 1], j = u[S * 3 + 2];
|
|
772
|
+
if (isNaN($) || isNaN(_) || isNaN(j)) return null;
|
|
773
|
+
const M = `FF${E($)}${E(_)}${E(j)}`;
|
|
774
|
+
return {
|
|
775
|
+
type: "cellIs",
|
|
776
|
+
operator: "equal",
|
|
777
|
+
formulae: [`"${A}"`],
|
|
778
|
+
priority: J++,
|
|
779
|
+
style: {
|
|
780
|
+
fill: {
|
|
781
|
+
type: "pattern",
|
|
782
|
+
pattern: "solid",
|
|
783
|
+
fgColor: { argb: M }
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
}).filter(Boolean);
|
|
788
|
+
y.length > 0 && N.addConditionalFormatting({
|
|
789
|
+
ref: s,
|
|
790
|
+
rules: y
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
}), m.forEach((h, W) => {
|
|
795
|
+
var v;
|
|
796
|
+
if (!((v = h.images) != null && v.length)) return;
|
|
797
|
+
const R = P.worksheets[W];
|
|
798
|
+
if (!R) return;
|
|
799
|
+
const x = Number(h.defaultColWidth) || 99, D = Number(h.defaultRowHeight) || 21;
|
|
800
|
+
pt(
|
|
801
|
+
R,
|
|
802
|
+
P,
|
|
803
|
+
h.images,
|
|
804
|
+
h,
|
|
805
|
+
x,
|
|
806
|
+
D
|
|
807
|
+
);
|
|
808
|
+
});
|
|
809
|
+
const { applyDefinedNamesToExcelWorkbook: ot } = await import("./xlsx-defined-names-DsWdNZw-.js");
|
|
810
|
+
ot(
|
|
811
|
+
P,
|
|
812
|
+
(T = (a = (d = e.current).getWorkbookContext) == null ? void 0 : a.call(d)) == null ? void 0 : T.definedNames,
|
|
813
|
+
m
|
|
814
|
+
);
|
|
815
|
+
const at = await P.xlsx.writeBuffer(), st = await Rt(at, tt), lt = new Blob([st], {
|
|
816
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
817
|
+
}), et = URL.createObjectURL(lt), Q = document.createElement("a");
|
|
818
|
+
Q.href = et, Q.download = `${Z}.xlsx`, Q.click(), URL.revokeObjectURL(et);
|
|
819
|
+
} catch (w) {
|
|
820
|
+
console.error("Export failed:", w), nt({
|
|
821
|
+
title: "Export failed",
|
|
822
|
+
description: w instanceof Error && w.message ? w.message : "Something went wrong while exporting to .xlsx. Please try again.",
|
|
823
|
+
variant: "error",
|
|
824
|
+
showCloseButton: !0,
|
|
825
|
+
duration: 10 * 1e3
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
export {
|
|
830
|
+
jt as handleExportToXLSX
|
|
831
|
+
};
|