@fileverse-dev/dsheet 4.0.4 → 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.
Files changed (37) hide show
  1. package/dist/editor/components/sidebar/use-right-panels.d.ts +1 -1
  2. package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
  3. package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -3
  4. package/dist/editor/utils/compact-committed-celldata.d.ts +11 -10
  5. package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
  6. package/dist/editor/utils/import-compaction.d.ts +25 -0
  7. package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
  8. package/dist/editor/utils/xlsx-import-pipeline.d.ts +28 -0
  9. package/dist/{executeStringFunction-CsLQk-dm.js → executeStringFunction-B6fhDKyN.js} +6985 -6477
  10. package/dist/formula.js +1 -1
  11. package/dist/{index-DvwJ-8x8.js → index-BqGOKo9u.js} +14197 -13462
  12. package/dist/index.es.js +21 -21
  13. package/dist/sheet-engine/core/api/common.d.ts +1 -0
  14. package/dist/sheet-engine/core/context.d.ts +3 -1
  15. package/dist/sheet-engine/core/index.d.ts +2 -2
  16. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +11 -0
  17. package/dist/sheet-engine/core/modules/formula.d.ts +27 -0
  18. package/dist/sheet-engine/core/modules/index.d.ts +3 -2
  19. package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
  20. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +2 -0
  21. package/dist/sheet-engine/core/settings.d.ts +2 -0
  22. package/dist/sheet-engine/core/types.d.ts +21 -0
  23. package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
  24. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -0
  25. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  26. package/dist/style.css +1 -1
  27. package/dist/use-xlsx-import-impl-Bddlxx23.js +1898 -0
  28. package/dist/worker/dsheet-worker-client.d.ts +14 -0
  29. package/dist/worker/dsheet-worker.d.ts +14 -0
  30. package/dist/xlsx-defined-names-DsWdNZw-.js +117 -0
  31. package/dist/xlsx-export-impl-DJiXCevi.js +831 -0
  32. package/dist/xlsx-hyperlink-inline-CTg4_gg1.js +2512 -0
  33. package/package.json +2 -1
  34. package/dist/use-xlsx-import-impl-I69dMglI.js +0 -1549
  35. package/dist/xlsx-export-impl-Bg7Suzh-.js +0 -3138
  36. package/dist/xlsx-hyperlink-inline-DzewAypN.js +0 -71
  37. package/dist/xlsx-image-utils-Cvg0qxRA.js +0 -126
@@ -1,71 +0,0 @@
1
- function k(t) {
2
- if (Array.isArray(t)) {
3
- const i = t[0];
4
- return i && typeof i == "object" && typeof i.linkType == "string" && typeof i.linkAddress == "string" ? i : void 0;
5
- }
6
- if (t && typeof t == "object" && typeof t.linkType == "string" && typeof t.linkAddress == "string")
7
- return t;
8
- }
9
- function A(t) {
10
- var f, r;
11
- if (!Array.isArray(t) || t.length === 0) return "";
12
- if (t.length === 1) return String(((f = t[0]) == null ? void 0 : f.v) ?? "");
13
- let i = "";
14
- for (let n = 0; n < t.length; n += 1)
15
- i += String(((r = t[n]) == null ? void 0 : r.v) ?? "");
16
- return i;
17
- }
18
- function d(t) {
19
- if (!t || typeof t != "object" || Array.isArray(t)) return {};
20
- const i = t, f = {};
21
- for (const r in i)
22
- Object.prototype.hasOwnProperty.call(i, r) && (r === "fc" || r === "un" || r === "s" || r === "t" || (f[r] = i[r]));
23
- return f;
24
- }
25
- function u(t, i) {
26
- const f = String(t.m ?? t.v ?? "").replace(
27
- /\r\n/g,
28
- `
29
- `
30
- );
31
- let r = "", n = null;
32
- const o = t.ct;
33
- if ((o == null ? void 0 : o.t) === "inlineStr" && Array.isArray(o.s) && o.s.length > 0) {
34
- const s = o.s;
35
- if (s.length === 1) {
36
- const e = s[0];
37
- r = String((e == null ? void 0 : e.v) ?? ""), r.length > 0 && (n = e);
38
- } else
39
- for (let e = 0; e < s.length; e += 1) {
40
- const c = s[e], y = String((c == null ? void 0 : c.v) ?? "");
41
- y.length > 0 && n == null && (n = c), r += y;
42
- }
43
- }
44
- r.length === 0 && (r = f);
45
- const g = {
46
- v: r,
47
- fs: (n == null ? void 0 : n.fs) ?? t.fs ?? 10,
48
- ff: (n == null ? void 0 : n.ff) ?? t.ff ?? 0,
49
- bl: (n == null ? void 0 : n.bl) ?? t.bl ?? 0,
50
- it: (n == null ? void 0 : n.it) ?? t.it ?? 0,
51
- cl: (n == null ? void 0 : n.cl) ?? t.cl ?? 0,
52
- fc: (n == null ? void 0 : n.fc) != null && String(n.fc).length > 0 ? n.fc : "rgb(0, 0, 255)",
53
- un: (n == null ? void 0 : n.un) != null && n.un !== 0 ? n.un : 1,
54
- link: {
55
- linkType: i.linkType,
56
- linkAddress: i.linkAddress
57
- }
58
- }, p = d(t.ct);
59
- t.ct = {
60
- ...p,
61
- t: "inlineStr",
62
- s: [g]
63
- }, t.m = r, t.v = r, delete t.fc, delete t.un;
64
- const l = t.ct;
65
- l && typeof l == "object" && !Array.isArray(l) && (delete l.fc, delete l.un);
66
- }
67
- export {
68
- A as c,
69
- k as g,
70
- u as n
71
- };
@@ -1,126 +0,0 @@
1
- function O(l, s) {
2
- const g = l.getImages();
3
- if (!g.length) return [];
4
- const f = [];
5
- for (const o of g)
6
- try {
7
- const i = s.getImage(Number(o.imageId));
8
- if (!i) continue;
9
- let t;
10
- if (i.buffer) {
11
- const m = new Uint8Array(i.buffer);
12
- let u = "";
13
- for (let v = 0; v < m.length; v += 8192)
14
- u += String.fromCharCode(...m.subarray(v, v + 8192));
15
- t = btoa(u);
16
- } else if (i.base64)
17
- t = i.base64;
18
- else
19
- continue;
20
- const n = i.extension ?? "png", c = `data:${n === "jpeg" ? "image/jpeg" : `image/${n}`};base64,${t}`, { tl: a, br: e } = o.range, h = o.range.ext;
21
- f.push({
22
- src: c,
23
- nativeCol: a.nativeCol,
24
- nativeColOff: a.nativeColOff,
25
- nativeRow: a.nativeRow,
26
- nativeRowOff: a.nativeRowOff,
27
- width: h ? Math.max(Math.round(h.width), 20) : 0,
28
- height: h ? Math.max(Math.round(h.height), 20) : 0,
29
- brNativeCol: e == null ? void 0 : e.nativeCol,
30
- brNativeColOff: e == null ? void 0 : e.nativeColOff,
31
- brNativeRow: e == null ? void 0 : e.nativeRow,
32
- brNativeRowOff: e == null ? void 0 : e.nativeRowOff
33
- });
34
- } catch {
35
- }
36
- return f;
37
- }
38
- const d = 9525, w = 1, C = 2;
39
- function R(l, s, g) {
40
- var i, t;
41
- let f = 0, o = 0;
42
- for (; o < 1e4; ) {
43
- const n = (((t = (i = s.config) == null ? void 0 : i.columnlen) == null ? void 0 : t[o]) ?? g) + w;
44
- if (f + n > l)
45
- return {
46
- nativeCol: o,
47
- nativeColOff: Math.round((l - f) * d)
48
- };
49
- f += n, o++;
50
- }
51
- return { nativeCol: o, nativeColOff: 0 };
52
- }
53
- function x(l, s, g) {
54
- var i, t;
55
- let f = 0, o = 0;
56
- for (; o < 1e5; ) {
57
- const n = (((t = (i = s.config) == null ? void 0 : i.rowlen) == null ? void 0 : t[o]) ?? g) + C;
58
- if (f + n > l)
59
- return {
60
- nativeRow: o,
61
- nativeRowOff: Math.round((l - f) * d)
62
- };
63
- f += n, o++;
64
- }
65
- return { nativeRow: o, nativeRowOff: 0 };
66
- }
67
- function b(l, s, g, f, o, i) {
68
- for (const t of g)
69
- try {
70
- const n = t.src.match(/^data:image\/([a-zA-Z]+);base64,(.+)$/);
71
- if (!n) continue;
72
- const r = n[1].toLowerCase(), c = r === "jpeg" || r === "jpg" ? "jpeg" : r === "gif" ? "gif" : "png", a = n[2], e = s.addImage({ base64: a, extension: c }), { nativeCol: h, nativeColOff: m } = R(
73
- t.left,
74
- f,
75
- o
76
- ), { nativeRow: u, nativeRowOff: v } = x(
77
- t.top,
78
- f,
79
- i
80
- );
81
- l.addImage(e, {
82
- tl: { nativeCol: h, nativeColOff: m, nativeRow: u, nativeRowOff: v },
83
- ext: { width: t.width, height: t.height },
84
- editAs: "oneCell"
85
- });
86
- } catch {
87
- }
88
- }
89
- function p(l, s, g, f) {
90
- const o = (t, n) => {
91
- var c, a;
92
- let r = 0;
93
- for (let e = 0; e < t; e++)
94
- r += (((a = (c = s.config) == null ? void 0 : c.columnlen) == null ? void 0 : a[e]) ?? g) + w;
95
- return Math.round(r + n / d);
96
- }, i = (t, n) => {
97
- var c, a;
98
- let r = 0;
99
- for (let e = 0; e < t; e++)
100
- r += (((a = (c = s.config) == null ? void 0 : c.rowlen) == null ? void 0 : a[e]) ?? f) + C;
101
- return Math.round(r + n / d);
102
- };
103
- return l.map((t) => {
104
- const n = o(t.nativeCol, t.nativeColOff), r = i(t.nativeRow, t.nativeRowOff);
105
- let { width: c, height: a } = t;
106
- return !c && t.brNativeCol != null && (c = Math.max(
107
- o(t.brNativeCol, t.brNativeColOff ?? 0) - n,
108
- 20
109
- )), !a && t.brNativeRow != null && (a = Math.max(
110
- i(t.brNativeRow, t.brNativeRowOff ?? 0) - r,
111
- 20
112
- )), {
113
- id: `img_imported_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
114
- src: t.src,
115
- left: n,
116
- top: r,
117
- width: Math.max(c, 20),
118
- height: Math.max(a, 20)
119
- };
120
- });
121
- }
122
- export {
123
- b as addFortuneImagesToWorksheet,
124
- p as convertRawImagesToFortuneSheet,
125
- O as extractImagesFromWorksheet
126
- };