@fileverse-dev/dsheet 3.0.3 → 4.0.1-ref
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/editor/components/sidebar/use-right-panels.d.ts +1 -1
- package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
- package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
- package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
- package/dist/{executeStringFunction-DVN2p-9G.js → executeStringFunction-CCpEDh3D.js} +6994 -6469
- package/dist/formula.js +1 -1
- package/dist/{index-T7U1EYEU.js → index-Sxwr9Syr.js} +14777 -14037
- package/dist/index.es.js +20 -20
- package/dist/jszip.min-DHgf03FP.js +2319 -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/image-clipboard.d.ts +8 -0
- package/dist/sheet-engine/core/modules/image.d.ts +12 -1
- package/dist/sheet-engine/core/modules/index.d.ts +4 -3
- package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
- package/dist/sheet-engine/core/settings.d.ts +2 -0
- package/dist/sheet-engine/core/types.d.ts +19 -0
- package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/use-xlsx-import-impl-DV7gsVeb.js +1613 -0
- package/dist/xlsx-defined-names-_KUWFAe9.js +117 -0
- package/dist/xlsx-export-impl-BCGdJj_E.js +830 -0
- package/package.json +5 -2
- package/dist/use-xlsx-import-impl-B9Uq_cFK.js +0 -1572
- package/dist/xlsx-export-impl-0bnKq9JC.js +0 -3138
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { i as w } from "./executeStringFunction-CCpEDh3D.js";
|
|
2
|
+
import { J as x } from "./jszip.min-DHgf03FP.js";
|
|
3
|
+
function g(o) {
|
|
4
|
+
return o.startsWith("_xlnm.");
|
|
5
|
+
}
|
|
6
|
+
function S(o) {
|
|
7
|
+
return /[^A-Za-z0-9_]/.test(o) ? `'${o.replace(/'/g, "''")}'` : o;
|
|
8
|
+
}
|
|
9
|
+
function p(o, e) {
|
|
10
|
+
return `$${w(e)}$${o + 1}`;
|
|
11
|
+
}
|
|
12
|
+
function I(o, e) {
|
|
13
|
+
const l = S(o), a = p(e.row[0], e.column[0]), n = p(e.row[1], e.column[1]), r = a === n ? a : `${a}:${n}`;
|
|
14
|
+
return `${l}!${r}`;
|
|
15
|
+
}
|
|
16
|
+
function $(o) {
|
|
17
|
+
const e = String(o || "").trim();
|
|
18
|
+
if (!e) return null;
|
|
19
|
+
let l = "", a = e;
|
|
20
|
+
const n = e.lastIndexOf("!");
|
|
21
|
+
if (n >= 0) {
|
|
22
|
+
let i = e.slice(0, n);
|
|
23
|
+
a = e.slice(n + 1), i.startsWith("'") && i.endsWith("'") && (i = i.slice(1, -1).replace(/''/g, "'")), l = i;
|
|
24
|
+
}
|
|
25
|
+
const r = a.split(":"), d = (i) => {
|
|
26
|
+
const t = i.trim().replace(/\$/g, "").match(/^([A-Za-z]+)(\d+)$/);
|
|
27
|
+
if (!t) return null;
|
|
28
|
+
const u = t[1].toUpperCase();
|
|
29
|
+
let m = 0;
|
|
30
|
+
for (let f = 0; f < u.length; f += 1)
|
|
31
|
+
m = m * 26 + (u.charCodeAt(f) - 64);
|
|
32
|
+
return { row: parseInt(t[2], 10) - 1, col: m - 1 };
|
|
33
|
+
}, c = d(r[0]);
|
|
34
|
+
if (!c) return null;
|
|
35
|
+
const s = r.length > 1 ? d(r[1]) : c;
|
|
36
|
+
return s ? {
|
|
37
|
+
sheetName: l,
|
|
38
|
+
range: {
|
|
39
|
+
row: [Math.min(c.row, s.row), Math.max(c.row, s.row)],
|
|
40
|
+
column: [Math.min(c.col, s.col), Math.max(c.col, s.col)]
|
|
41
|
+
}
|
|
42
|
+
} : null;
|
|
43
|
+
}
|
|
44
|
+
function b() {
|
|
45
|
+
return `dn_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
46
|
+
}
|
|
47
|
+
function k(o, e) {
|
|
48
|
+
var r, d, c, s, i;
|
|
49
|
+
const l = new Map(
|
|
50
|
+
e.filter((t) => t.id && t.name).map((t) => [String(t.name), t.id])
|
|
51
|
+
), a = [], n = /* @__PURE__ */ new Set();
|
|
52
|
+
for (const t of o) {
|
|
53
|
+
if (!(t != null && t.name) || g(t.name) || n.has(t.name.toLowerCase())) continue;
|
|
54
|
+
const u = (r = t.ranges) == null ? void 0 : r[0];
|
|
55
|
+
if (!u) continue;
|
|
56
|
+
const m = $(u);
|
|
57
|
+
if (!m) continue;
|
|
58
|
+
let f = m.sheetName && l.get(m.sheetName) || void 0;
|
|
59
|
+
if (!f && t.localSheetId != null && ((d = e[t.localSheetId]) != null && d.id) && (f = e[t.localSheetId].id), !f && ((c = e[0]) != null && c.id) && (f = e[0].id), !f) continue;
|
|
60
|
+
const h = t.localSheetId != null && ((s = e[t.localSheetId]) != null && s.id) ? "sheet" : "workbook";
|
|
61
|
+
a.push({
|
|
62
|
+
id: b(),
|
|
63
|
+
name: t.name,
|
|
64
|
+
sheetId: f,
|
|
65
|
+
range: m.range,
|
|
66
|
+
scope: h,
|
|
67
|
+
localSheetId: h === "sheet" ? (i = e[t.localSheetId]) == null ? void 0 : i.id : void 0
|
|
68
|
+
}), n.add(t.name.toLowerCase());
|
|
69
|
+
}
|
|
70
|
+
return a;
|
|
71
|
+
}
|
|
72
|
+
function D(o, e, l) {
|
|
73
|
+
if (!(e != null && e.length)) return;
|
|
74
|
+
const a = new Map(
|
|
75
|
+
l.filter((n) => n.id && n.name).map((n) => [n.id, n.name])
|
|
76
|
+
);
|
|
77
|
+
for (const n of e) {
|
|
78
|
+
if (!(n != null && n.name) || g(n.name)) continue;
|
|
79
|
+
const r = a.get(n.sheetId);
|
|
80
|
+
if (r)
|
|
81
|
+
try {
|
|
82
|
+
o.definedNames.add(
|
|
83
|
+
I(r, n.range),
|
|
84
|
+
n.name
|
|
85
|
+
);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function A(o) {
|
|
91
|
+
var e;
|
|
92
|
+
try {
|
|
93
|
+
const l = await x.loadAsync(o), a = l.file("xl/workbook.xml") || ((e = l.file(/xl\/workbook\.xml$/i)) == null ? void 0 : e[0]) || null;
|
|
94
|
+
if (!a) return [];
|
|
95
|
+
const n = await a.async("text"), r = [], d = /<definedName\b([^>]*)>([\s\S]*?)<\/definedName>/gi;
|
|
96
|
+
let c = d.exec(n);
|
|
97
|
+
for (; c; ) {
|
|
98
|
+
const s = c[1] || "", i = (c[2] || "").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').trim(), t = s.match(/\bname="([^"]+)"/i), u = s.match(/\blocalSheetId="(\d+)"/i), m = t == null ? void 0 : t[1];
|
|
99
|
+
m && i && r.push({
|
|
100
|
+
name: m,
|
|
101
|
+
ranges: [i],
|
|
102
|
+
localSheetId: u ? parseInt(u[1], 10) : void 0
|
|
103
|
+
}), c = d.exec(n);
|
|
104
|
+
}
|
|
105
|
+
return r;
|
|
106
|
+
} catch {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
D as applyDefinedNamesToExcelWorkbook,
|
|
112
|
+
I as encodeDefinedNameExcelRef,
|
|
113
|
+
k as excelEntriesToDefinedNames,
|
|
114
|
+
g as isExcelSystemDefinedName,
|
|
115
|
+
A as parseDefinedNamesFromXlsxBuffer,
|
|
116
|
+
$ as parseExcelDefinedNameRef
|
|
117
|
+
};
|