@nivaro/react 0.3.122 → 0.3.124

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.
@@ -0,0 +1,125 @@
1
+ const y = {
2
+ plain: 0,
3
+ header: 1,
4
+ changed: 2,
5
+ recalculated: 3,
6
+ muted: 4
7
+ }, g = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "");
8
+ function x(e) {
9
+ let t = e + 1, n = "";
10
+ for (; t > 0; ) {
11
+ const o = (t - 1) % 26;
12
+ n = String.fromCharCode(65 + o) + n, t = Math.floor((t - 1) / 26);
13
+ }
14
+ return n;
15
+ }
16
+ function w(e) {
17
+ var p;
18
+ const t = e.freezeColumns ?? 0, n = `<pane ${t ? `xSplit="${t}" ` : ""}ySplit="1" topLeftCell="${x(t)}2" activePane="bottomRight" state="frozen"/>`, o = (p = e.widths) != null && p.length ? `<cols>${e.widths.map(
19
+ (a, i) => `<col min="${i + 1}" max="${i + 1}" width="${Math.max(6, Math.min(80, a))}" customWidth="1"/>`
20
+ ).join("")}</cols>` : "", r = e.rows.map((a, i) => {
21
+ const h = a.map((m, l) => {
22
+ const s = `${x(l)}${i + 1}`, d = y[m.style ?? "plain"];
23
+ return m.v === null || m.v === void 0 || m.v === "" ? d ? `<c r="${s}" s="${d}"/>` : "" : typeof m.v == "number" && Number.isFinite(m.v) ? `<c r="${s}" s="${d}"><v>${m.v}</v></c>` : `<c r="${s}" s="${d}" t="inlineStr"><is><t xml:space="preserve">${g(String(m.v))}</t></is></c>`;
24
+ }).join("");
25
+ return `<row r="${i + 1}">${h}</row>`;
26
+ }).join("");
27
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
28
+ <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetViews><sheetView workbookViewId="0">${n}</sheetView></sheetViews>${o}<sheetData>${r}</sheetData></worksheet>`;
29
+ }
30
+ const F = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
31
+ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
32
+ <fonts count="3"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font><font><sz val="11"/><color rgb="FF64748B"/><name val="Calibri"/></font></fonts>
33
+ <fills count="5"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill><fill><patternFill patternType="solid"><fgColor rgb="FFF1F5F9"/><bgColor indexed="64"/></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFFEF3C7"/><bgColor indexed="64"/></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFFDE68A"/><bgColor indexed="64"/></patternFill></fill></fills>
34
+ <borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
35
+ <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
36
+ <cellXfs count="5"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment vertical="top" wrapText="1"/></xf><xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment vertical="top" wrapText="1"/></xf><xf numFmtId="0" fontId="1" fillId="3" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment vertical="top" wrapText="1"/></xf><xf numFmtId="0" fontId="1" fillId="4" borderId="0" xfId="0" applyFont="1" applyFill="1" applyAlignment="1"><alignment vertical="top" wrapText="1"/></xf><xf numFmtId="0" fontId="2" fillId="0" borderId="0" xfId="0" applyFont="1" applyAlignment="1"><alignment vertical="top" wrapText="1"/></xf></cellXfs>
37
+ </styleSheet>`;
38
+ function b(e) {
39
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
40
+ <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((t, n) => `<sheet name="${g(t)}" sheetId="${n + 1}" r:id="rId${n + 1}"/>`).join("")}</sheets></workbook>`;
41
+ }
42
+ function I(e) {
43
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
44
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${Array.from(
45
+ { length: e },
46
+ (n, o) => `<Relationship Id="rId${o + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${o + 1}.xml"/>`
47
+ ).join("")}<Relationship Id="rId${e + 1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`;
48
+ }
49
+ function v(e) {
50
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
51
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><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"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>${Array.from(
52
+ { length: e },
53
+ (n, o) => `<Override PartName="/xl/worksheets/sheet${o + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`
54
+ ).join("")}</Types>`;
55
+ }
56
+ const T = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
57
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
58
+ let u = null;
59
+ function $(e) {
60
+ if (!u) {
61
+ u = new Uint32Array(256);
62
+ for (let n = 0; n < 256; n++) {
63
+ let o = n;
64
+ for (let r = 0; r < 8; r++) o = o & 1 ? 3988292384 ^ o >>> 1 : o >>> 1;
65
+ u[n] = o >>> 0;
66
+ }
67
+ }
68
+ let t = 4294967295;
69
+ for (const n of e) t = (u[(t ^ n) & 255] ^ t >>> 8) >>> 0;
70
+ return (t ^ 4294967295) >>> 0;
71
+ }
72
+ function k(e) {
73
+ const t = new TextEncoder(), n = [], o = [];
74
+ let r = 0;
75
+ for (const l of e) {
76
+ const s = t.encode(l.name), d = $(l.data), f = new DataView(new ArrayBuffer(30));
77
+ f.setUint32(0, 67324752, !0), f.setUint16(4, 20, !0), f.setUint16(8, 0, !0), f.setUint32(14, d, !0), f.setUint32(18, l.data.length, !0), f.setUint32(22, l.data.length, !0), f.setUint16(26, s.length, !0), n.push(new Uint8Array(f.buffer), s, l.data);
78
+ const c = new DataView(new ArrayBuffer(46));
79
+ c.setUint32(0, 33639248, !0), c.setUint16(4, 20, !0), c.setUint16(6, 20, !0), c.setUint32(16, d, !0), c.setUint32(20, l.data.length, !0), c.setUint32(24, l.data.length, !0), c.setUint16(28, s.length, !0), c.setUint32(42, r, !0), o.push(new Uint8Array(c.buffer), s), r += 30 + s.length + l.data.length;
80
+ }
81
+ const p = o.reduce((l, s) => l + s.length, 0), a = new DataView(new ArrayBuffer(22));
82
+ a.setUint32(0, 101010256, !0), a.setUint16(8, e.length, !0), a.setUint16(10, e.length, !0), a.setUint32(12, p, !0), a.setUint32(16, r, !0);
83
+ const i = [...n, ...o, new Uint8Array(a.buffer)], h = new Uint8Array(i.reduce((l, s) => l + s.length, 0));
84
+ let m = 0;
85
+ for (const l of i)
86
+ h.set(l, m), m += l.length;
87
+ return h;
88
+ }
89
+ function U(e) {
90
+ const t = /* @__PURE__ */ new Set();
91
+ return e.map((n, o) => {
92
+ let r = n.replace(/[:\\/?*[\]]/g, " ").trim().slice(0, 31) || `Sheet${o + 1}`, p = r, a = 2;
93
+ for (; t.has(p.toLowerCase()); ) {
94
+ const i = ` (${a++})`;
95
+ r = r.slice(0, 31 - i.length), p = `${r}${i}`;
96
+ }
97
+ return t.add(p.toLowerCase()), p;
98
+ });
99
+ }
100
+ function C(e) {
101
+ const t = new TextEncoder(), n = U(e.map((o) => o.name));
102
+ return k([
103
+ { name: "[Content_Types].xml", data: t.encode(v(e.length)) },
104
+ { name: "_rels/.rels", data: t.encode(T) },
105
+ { name: "xl/workbook.xml", data: t.encode(b(n)) },
106
+ { name: "xl/_rels/workbook.xml.rels", data: t.encode(I(e.length)) },
107
+ { name: "xl/styles.xml", data: t.encode(F) },
108
+ ...e.map((o, r) => ({
109
+ name: `xl/worksheets/sheet${r + 1}.xml`,
110
+ data: t.encode(w(o))
111
+ }))
112
+ ]);
113
+ }
114
+ function S(e) {
115
+ return new Blob([C(e)], {
116
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
117
+ });
118
+ }
119
+ export {
120
+ x as columnName,
121
+ $ as crc32,
122
+ S as xlsxBlob,
123
+ C as xlsxBytes,
124
+ k as zipStored
125
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.122",
3
+ "version": "0.3.124",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",