@coreui/data-grid 0.1.0-rc.0 → 0.2.0-rc.0
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 +5 -4
- package/dist/css/data-grid.css +149 -31
- package/dist/css/data-grid.css.map +1 -1
- package/dist/css/data-grid.min.css +2 -2
- package/dist/css/data-grid.min.css.map +1 -1
- package/dist/js/clipboard.cjs +56 -0
- package/dist/js/clipboard.cjs.map +1 -0
- package/dist/js/clipboard.mjs +54 -0
- package/dist/js/clipboard.mjs.map +1 -0
- package/dist/js/csv.cjs +36 -59
- package/dist/js/csv.cjs.map +1 -1
- package/dist/js/csv.mjs +35 -55
- package/dist/js/csv.mjs.map +1 -1
- package/dist/js/data-grid.esm.js +14078 -9332
- package/dist/js/data-grid.esm.js.map +1 -1
- package/dist/js/data-grid.esm.min.js +6 -6
- package/dist/js/data-grid.esm.min.js.map +1 -1
- package/dist/js/data-grid.js +14377 -9634
- package/dist/js/data-grid.js.map +1 -1
- package/dist/js/data-grid.lite.esm.js +10476 -0
- package/dist/js/data-grid.lite.esm.js.map +1 -0
- package/dist/js/data-grid.lite.esm.min.js +8 -0
- package/dist/js/data-grid.lite.esm.min.js.map +1 -0
- package/dist/js/data-grid.lite.js +10489 -0
- package/dist/js/data-grid.lite.js.map +1 -0
- package/dist/js/data-grid.lite.min.js +8 -0
- package/dist/js/data-grid.lite.min.js.map +1 -0
- package/dist/js/data-grid.lite.mjs +10476 -0
- package/dist/js/data-grid.lite.mjs.map +1 -0
- package/dist/js/data-grid.min.js +6 -6
- package/dist/js/data-grid.min.js.map +1 -1
- package/dist/js/data-grid.mjs +14078 -9332
- package/dist/js/data-grid.mjs.map +1 -1
- package/dist/js/drag.cjs +459 -0
- package/dist/js/drag.cjs.map +1 -0
- package/dist/js/drag.mjs +456 -0
- package/dist/js/drag.mjs.map +1 -0
- package/dist/js/export-table-CNAKStzj.mjs +26 -0
- package/dist/js/export-table-CNAKStzj.mjs.map +1 -0
- package/dist/js/export-table-doIwvE5U.cjs +55 -0
- package/dist/js/export-table-doIwvE5U.cjs.map +1 -0
- package/dist/js/filters.cjs +89 -132
- package/dist/js/filters.cjs.map +1 -1
- package/dist/js/filters.mjs +88 -128
- package/dist/js/filters.mjs.map +1 -1
- package/dist/js/labels.cjs +65 -70
- package/dist/js/labels.cjs.map +1 -1
- package/dist/js/labels.mjs +64 -66
- package/dist/js/labels.mjs.map +1 -1
- package/dist/js/print.cjs +66 -0
- package/dist/js/print.cjs.map +1 -0
- package/dist/js/print.mjs +64 -0
- package/dist/js/print.mjs.map +1 -0
- package/dist/js/validate.cjs +43 -0
- package/dist/js/validate.cjs.map +1 -0
- package/dist/js/validate.mjs +42 -0
- package/dist/js/validate.mjs.map +1 -0
- package/dist/js/xlsx.cjs +240 -0
- package/dist/js/xlsx.cjs.map +1 -0
- package/dist/js/xlsx.mjs +238 -0
- package/dist/js/xlsx.mjs.map +1 -0
- package/dist/types/base-component.d.ts +28 -18
- package/dist/types/data-grid.d.ts +26 -13
- package/dist/types/dom/data.d.ts +15 -0
- package/dist/types/dom/event-handler.d.ts +21 -10
- package/dist/types/dom/manipulator.d.ts +15 -8
- package/dist/types/engine/data-source.d.ts +1 -1
- package/dist/types/engine/features-lite.d.ts +25 -0
- package/dist/types/engine/features.d.ts +35 -0
- package/dist/types/engine/table.d.ts +3 -3
- package/dist/types/engine/validate.d.mts +1 -0
- package/dist/types/engine/validate.d.ts +20 -0
- package/dist/types/engine/virtualizer.d.ts +2 -0
- package/dist/types/icons.d.ts +6 -4
- package/dist/types/index-lite.d.mts +1 -0
- package/dist/types/index-lite.d.ts +19 -0
- package/dist/types/index.d.ts +11 -2
- package/dist/types/types.d.ts +53 -31
- package/dist/types/ui/body.d.ts +6 -3
- package/dist/types/ui/header.d.ts +3 -2
- package/dist/types/ui/loading.d.ts +1 -1
- package/dist/types/ui/pinning.d.ts +1 -1
- package/dist/types/ui/toolbar.d.ts +10 -2
- package/dist/types/util/clipboard.d.mts +1 -0
- package/dist/types/util/clipboard.d.ts +29 -0
- package/dist/types/util/config.d.ts +27 -10
- package/dist/types/util/csv.d.ts +5 -5
- package/dist/types/util/drag.d.mts +1 -0
- package/dist/types/util/drag.d.ts +48 -0
- package/dist/types/util/export-table.d.ts +47 -0
- package/dist/types/util/index.d.ts +66 -10
- package/dist/types/util/print.d.mts +1 -0
- package/dist/types/util/print.d.ts +32 -0
- package/dist/types/util/sanitizer.d.ts +15 -11
- package/dist/types/util/xlsx.d.mts +1 -0
- package/dist/types/util/xlsx.d.ts +17 -0
- package/dist/types/util/zip.d.ts +11 -0
- package/package.json +88 -10
- package/scss/data-grid.scss +204 -16
- package/src/{base-component.js → base-component.ts} +21 -17
- package/src/data-grid.ts +507 -200
- package/src/dom/{data.js → data.ts} +13 -10
- package/src/dom/event-handler.ts +380 -0
- package/src/dom/{manipulator.js → manipulator.ts} +11 -11
- package/src/engine/data-source.ts +7 -3
- package/src/engine/features-lite.ts +47 -0
- package/src/engine/features.ts +68 -0
- package/src/engine/table.ts +80 -47
- package/src/engine/validate.ts +64 -0
- package/src/engine/virtualizer.ts +17 -1
- package/src/icons.ts +11 -5
- package/src/index-lite.ts +85 -0
- package/src/index.ts +30 -2
- package/src/labels.ts +6 -4
- package/src/types.ts +87 -32
- package/src/ui/body.ts +73 -17
- package/src/ui/header.ts +51 -26
- package/src/ui/loading.ts +2 -2
- package/src/ui/pinning.ts +16 -16
- package/src/ui/toolbar.ts +27 -3
- package/src/util/clipboard.ts +112 -0
- package/src/util/{config.js → config.ts} +25 -11
- package/src/util/csv.ts +11 -30
- package/src/util/drag.ts +798 -0
- package/src/util/export-table.ts +86 -0
- package/src/util/{index.js → index.ts} +55 -35
- package/src/util/print.ts +125 -0
- package/src/util/{sanitizer.js → sanitizer.ts} +17 -13
- package/src/util/xlsx.ts +183 -0
- package/src/util/zip.ts +170 -0
- package/src/base-component.d.ts +0 -19
- package/src/dom/event-handler.d.ts +0 -11
- package/src/dom/event-handler.js +0 -331
- package/src/dom/manipulator.d.ts +0 -9
- package/src/util/config.d.ts +0 -11
- package/src/util/index.d.ts +0 -10
- package/src/util/sanitizer.d.ts +0 -11
package/dist/js/xlsx.cjs
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* CoreUI PRO data-grid v0.2.0-rc.0 (https://coreui.io)
|
|
3
|
+
* Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
const require_export_table = require("./export-table-doIwvE5U.cjs");
|
|
8
|
+
//#region src/util/zip.ts
|
|
9
|
+
/**
|
|
10
|
+
* --------------------------------------------------------------------------
|
|
11
|
+
* CoreUI PRO data-grid util/zip.ts
|
|
12
|
+
* License (https://coreui.io/pro/license/)
|
|
13
|
+
* --------------------------------------------------------------------------
|
|
14
|
+
*/
|
|
15
|
+
const DOS_EPOCH_TIME = 0;
|
|
16
|
+
const DOS_EPOCH_DATE = 33;
|
|
17
|
+
const FLAG_UTF8 = 2048;
|
|
18
|
+
let crcTable = null;
|
|
19
|
+
const getCrcTable = () => {
|
|
20
|
+
if (crcTable) return crcTable;
|
|
21
|
+
const table = /* @__PURE__ */ new Uint32Array(256);
|
|
22
|
+
for (let index = 0; index < 256; index++) {
|
|
23
|
+
let value = index;
|
|
24
|
+
for (let bit = 0; bit < 8; bit++) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
25
|
+
table[index] = value >>> 0;
|
|
26
|
+
}
|
|
27
|
+
crcTable = table;
|
|
28
|
+
return table;
|
|
29
|
+
};
|
|
30
|
+
const crc32 = (bytes) => {
|
|
31
|
+
const table = getCrcTable();
|
|
32
|
+
let crc = 4294967295;
|
|
33
|
+
for (const byte of bytes) crc = table[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
34
|
+
return (crc ^ 4294967295) >>> 0;
|
|
35
|
+
};
|
|
36
|
+
const LOCAL_HEADER_SIZE = 30;
|
|
37
|
+
const CENTRAL_HEADER_SIZE = 46;
|
|
38
|
+
const END_RECORD_SIZE = 22;
|
|
39
|
+
var ByteWriter = class {
|
|
40
|
+
constructor(size) {
|
|
41
|
+
this.cursor = 0;
|
|
42
|
+
this.bytes = new Uint8Array(size);
|
|
43
|
+
this.view = new DataView(this.bytes.buffer);
|
|
44
|
+
}
|
|
45
|
+
u16(value) {
|
|
46
|
+
this.view.setUint16(this.cursor, value, true);
|
|
47
|
+
this.cursor += 2;
|
|
48
|
+
}
|
|
49
|
+
u32(value) {
|
|
50
|
+
this.view.setUint32(this.cursor, value, true);
|
|
51
|
+
this.cursor += 4;
|
|
52
|
+
}
|
|
53
|
+
raw(value) {
|
|
54
|
+
this.bytes.set(value, this.cursor);
|
|
55
|
+
this.cursor += value.length;
|
|
56
|
+
}
|
|
57
|
+
result() {
|
|
58
|
+
return this.bytes;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const zip = (entries) => {
|
|
62
|
+
const encoder = new TextEncoder();
|
|
63
|
+
const staged = [];
|
|
64
|
+
let offset = 0;
|
|
65
|
+
for (const entry of entries) {
|
|
66
|
+
const nameBytes = encoder.encode(entry.name);
|
|
67
|
+
staged.push({
|
|
68
|
+
...entry,
|
|
69
|
+
crc: crc32(entry.data),
|
|
70
|
+
nameBytes,
|
|
71
|
+
offset
|
|
72
|
+
});
|
|
73
|
+
offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length;
|
|
74
|
+
}
|
|
75
|
+
const centralDirectoryOffset = offset;
|
|
76
|
+
const centralDirectorySize = staged.reduce((total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length, 0);
|
|
77
|
+
const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE);
|
|
78
|
+
for (const entry of staged) {
|
|
79
|
+
writer.u32(67324752);
|
|
80
|
+
writer.u16(20);
|
|
81
|
+
writer.u16(FLAG_UTF8);
|
|
82
|
+
writer.u16(0);
|
|
83
|
+
writer.u16(DOS_EPOCH_TIME);
|
|
84
|
+
writer.u16(DOS_EPOCH_DATE);
|
|
85
|
+
writer.u32(entry.crc);
|
|
86
|
+
writer.u32(entry.data.length);
|
|
87
|
+
writer.u32(entry.data.length);
|
|
88
|
+
writer.u16(entry.nameBytes.length);
|
|
89
|
+
writer.u16(0);
|
|
90
|
+
writer.raw(entry.nameBytes);
|
|
91
|
+
writer.raw(entry.data);
|
|
92
|
+
}
|
|
93
|
+
for (const entry of staged) {
|
|
94
|
+
writer.u32(33639248);
|
|
95
|
+
writer.u16(20);
|
|
96
|
+
writer.u16(20);
|
|
97
|
+
writer.u16(FLAG_UTF8);
|
|
98
|
+
writer.u16(0);
|
|
99
|
+
writer.u16(DOS_EPOCH_TIME);
|
|
100
|
+
writer.u16(DOS_EPOCH_DATE);
|
|
101
|
+
writer.u32(entry.crc);
|
|
102
|
+
writer.u32(entry.data.length);
|
|
103
|
+
writer.u32(entry.data.length);
|
|
104
|
+
writer.u16(entry.nameBytes.length);
|
|
105
|
+
writer.u16(0);
|
|
106
|
+
writer.u16(0);
|
|
107
|
+
writer.u16(0);
|
|
108
|
+
writer.u16(0);
|
|
109
|
+
writer.u32(0);
|
|
110
|
+
writer.u32(entry.offset);
|
|
111
|
+
writer.raw(entry.nameBytes);
|
|
112
|
+
}
|
|
113
|
+
writer.u32(101010256);
|
|
114
|
+
writer.u16(0);
|
|
115
|
+
writer.u16(0);
|
|
116
|
+
writer.u16(staged.length);
|
|
117
|
+
writer.u16(staged.length);
|
|
118
|
+
writer.u32(centralDirectorySize);
|
|
119
|
+
writer.u32(centralDirectoryOffset);
|
|
120
|
+
writer.u16(0);
|
|
121
|
+
return writer.result();
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/util/xlsx.ts
|
|
125
|
+
/**
|
|
126
|
+
* --------------------------------------------------------------------------
|
|
127
|
+
* CoreUI PRO data-grid util/xlsx.ts
|
|
128
|
+
* License (https://coreui.io/pro/license/)
|
|
129
|
+
* --------------------------------------------------------------------------
|
|
130
|
+
*/
|
|
131
|
+
const MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
132
|
+
const DEFAULT_SHEET_NAME = "Sheet1";
|
|
133
|
+
const PX_PER_CHARACTER = 7;
|
|
134
|
+
const CELL_PADDING_PX = 5;
|
|
135
|
+
const MIN_COLUMN_WIDTH = 4;
|
|
136
|
+
const MAX_COLUMN_WIDTH = 120;
|
|
137
|
+
const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
|
|
138
|
+
const escapeXml = (value) => value.replace(CONTROL_CHARACTERS, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
139
|
+
const cellReference = (columnIndex, rowNumber) => {
|
|
140
|
+
let reference = "";
|
|
141
|
+
let index = columnIndex;
|
|
142
|
+
while (index >= 0) {
|
|
143
|
+
reference = String.fromCodePoint(65 + index % 26) + reference;
|
|
144
|
+
index = Math.floor(index / 26) - 1;
|
|
145
|
+
}
|
|
146
|
+
return `${reference}${rowNumber}`;
|
|
147
|
+
};
|
|
148
|
+
const sheetNameFor = (name) => {
|
|
149
|
+
const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\/?*[\]]/g, " ").trim().slice(0, 31);
|
|
150
|
+
return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME;
|
|
151
|
+
};
|
|
152
|
+
const sheetWidthFor = (column) => {
|
|
153
|
+
const size = require_export_table.widthFor(column);
|
|
154
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) return null;
|
|
155
|
+
const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER;
|
|
156
|
+
return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100));
|
|
157
|
+
};
|
|
158
|
+
const cellXml = (reference, value, styleIndex) => {
|
|
159
|
+
const style = styleIndex > 0 ? ` s="${styleIndex}"` : "";
|
|
160
|
+
if (typeof value === "number" && Number.isFinite(value)) return `<c r="${reference}"${style}><v>${value}</v></c>`;
|
|
161
|
+
if (typeof value === "boolean") return `<c r="${reference}"${style} t="b"><v>${value ? 1 : 0}</v></c>`;
|
|
162
|
+
const text = String(value ?? "");
|
|
163
|
+
if (text === "") return `<c r="${reference}"${style}/>`;
|
|
164
|
+
return `<c r="${reference}"${style} t="inlineStr"><is><t xml:space="preserve">${escapeXml(text)}</t></is></c>`;
|
|
165
|
+
};
|
|
166
|
+
const CONTENT_TYPES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
167
|
+
<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/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`;
|
|
168
|
+
const ROOT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
169
|
+
<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>`;
|
|
170
|
+
const WORKBOOK_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
171
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`;
|
|
172
|
+
const STYLES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
173
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
|
|
174
|
+
const workbookXml = (sheetName) => `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
175
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${escapeXml(sheetName)}" sheetId="1" r:id="rId1"/></sheets></workbook>`;
|
|
176
|
+
const worksheetXml = (table, options) => {
|
|
177
|
+
const columns = require_export_table.columnsFor(table);
|
|
178
|
+
const rows = require_export_table.rowsFor(table, options.scope);
|
|
179
|
+
const widths = columns.map((column, index) => {
|
|
180
|
+
const width = sheetWidthFor(column);
|
|
181
|
+
return width === null ? null : `<col min="${index + 1}" max="${index + 1}" width="${width}" customWidth="1"/>`;
|
|
182
|
+
}).filter((entry) => entry !== null);
|
|
183
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
184
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">${widths.length > 0 ? `<cols>${widths.join("")}</cols>` : ""}<sheetData><row r="1">${columns.map((column, index) => cellXml(cellReference(index, 1), require_export_table.headerFor(column), 1)).join("")}</row>${rows.map((row, rowIndex) => {
|
|
185
|
+
const rowNumber = rowIndex + 2;
|
|
186
|
+
return `<row r="${rowNumber}">${columns.map((column, columnIndex) => {
|
|
187
|
+
const value = row.getValue(column.id);
|
|
188
|
+
const formatter = require_export_table.formatterFor(column);
|
|
189
|
+
return cellXml(cellReference(columnIndex, rowNumber), formatter ? formatter(value, row.original) ?? "" : value, 0);
|
|
190
|
+
}).join("")}</row>`;
|
|
191
|
+
}).join("")}</sheetData></worksheet>`;
|
|
192
|
+
};
|
|
193
|
+
const exportXlsx = (table, options = {}) => {
|
|
194
|
+
const encoder = new TextEncoder();
|
|
195
|
+
const sheetName = sheetNameFor(options.sheetName);
|
|
196
|
+
const entries = [
|
|
197
|
+
{
|
|
198
|
+
name: "[Content_Types].xml",
|
|
199
|
+
data: encoder.encode(CONTENT_TYPES)
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "_rels/.rels",
|
|
203
|
+
data: encoder.encode(ROOT_RELS)
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "xl/workbook.xml",
|
|
207
|
+
data: encoder.encode(workbookXml(sheetName))
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "xl/_rels/workbook.xml.rels",
|
|
211
|
+
data: encoder.encode(WORKBOOK_RELS)
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "xl/styles.xml",
|
|
215
|
+
data: encoder.encode(STYLES)
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "xl/worksheets/sheet1.xml",
|
|
219
|
+
data: encoder.encode(worksheetXml(table, options))
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
return zip(entries);
|
|
223
|
+
};
|
|
224
|
+
const downloadXlsx = (table, options = {}) => {
|
|
225
|
+
const blob = new Blob([exportXlsx(table, options)], { type: MIME_TYPE });
|
|
226
|
+
const url = URL.createObjectURL(blob);
|
|
227
|
+
const anchor = document.createElement("a");
|
|
228
|
+
anchor.href = url;
|
|
229
|
+
anchor.download = options.filename ?? "export.xlsx";
|
|
230
|
+
anchor.style.display = "none";
|
|
231
|
+
document.body.append(anchor);
|
|
232
|
+
anchor.click();
|
|
233
|
+
anchor.remove();
|
|
234
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
235
|
+
};
|
|
236
|
+
//#endregion
|
|
237
|
+
exports.downloadXlsx = downloadXlsx;
|
|
238
|
+
exports.exportXlsx = exportXlsx;
|
|
239
|
+
|
|
240
|
+
//# sourceMappingURL=xlsx.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xlsx.cjs","names":["widthFor","columnsFor","rowsFor","headerFor","formatterFor"],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]/g\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<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/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<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>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,IAAI,WAA+B;AAEnC,MAAM,oBAAiC;CACrC,IAAI,UACF,OAAO;CAGT,MAAM,wBAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI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.io)
|
|
3
|
+
* Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
*/
|
|
6
|
+
import { a as widthFor, i as rowsFor, n as formatterFor, r as headerFor, t as columnsFor } from "./export-table-CNAKStzj.mjs";
|
|
7
|
+
//#region src/util/zip.ts
|
|
8
|
+
/**
|
|
9
|
+
* --------------------------------------------------------------------------
|
|
10
|
+
* CoreUI PRO data-grid util/zip.ts
|
|
11
|
+
* License (https://coreui.io/pro/license/)
|
|
12
|
+
* --------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
const DOS_EPOCH_TIME = 0;
|
|
15
|
+
const DOS_EPOCH_DATE = 33;
|
|
16
|
+
const FLAG_UTF8 = 2048;
|
|
17
|
+
let crcTable = null;
|
|
18
|
+
const getCrcTable = () => {
|
|
19
|
+
if (crcTable) return crcTable;
|
|
20
|
+
const table = /* @__PURE__ */ new Uint32Array(256);
|
|
21
|
+
for (let index = 0; index < 256; index++) {
|
|
22
|
+
let value = index;
|
|
23
|
+
for (let bit = 0; bit < 8; bit++) value = value & 1 ? 3988292384 ^ value >>> 1 : value >>> 1;
|
|
24
|
+
table[index] = value >>> 0;
|
|
25
|
+
}
|
|
26
|
+
crcTable = table;
|
|
27
|
+
return table;
|
|
28
|
+
};
|
|
29
|
+
const crc32 = (bytes) => {
|
|
30
|
+
const table = getCrcTable();
|
|
31
|
+
let crc = 4294967295;
|
|
32
|
+
for (const byte of bytes) crc = table[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
33
|
+
return (crc ^ 4294967295) >>> 0;
|
|
34
|
+
};
|
|
35
|
+
const LOCAL_HEADER_SIZE = 30;
|
|
36
|
+
const CENTRAL_HEADER_SIZE = 46;
|
|
37
|
+
const END_RECORD_SIZE = 22;
|
|
38
|
+
var ByteWriter = class {
|
|
39
|
+
constructor(size) {
|
|
40
|
+
this.cursor = 0;
|
|
41
|
+
this.bytes = new Uint8Array(size);
|
|
42
|
+
this.view = new DataView(this.bytes.buffer);
|
|
43
|
+
}
|
|
44
|
+
u16(value) {
|
|
45
|
+
this.view.setUint16(this.cursor, value, true);
|
|
46
|
+
this.cursor += 2;
|
|
47
|
+
}
|
|
48
|
+
u32(value) {
|
|
49
|
+
this.view.setUint32(this.cursor, value, true);
|
|
50
|
+
this.cursor += 4;
|
|
51
|
+
}
|
|
52
|
+
raw(value) {
|
|
53
|
+
this.bytes.set(value, this.cursor);
|
|
54
|
+
this.cursor += value.length;
|
|
55
|
+
}
|
|
56
|
+
result() {
|
|
57
|
+
return this.bytes;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const zip = (entries) => {
|
|
61
|
+
const encoder = new TextEncoder();
|
|
62
|
+
const staged = [];
|
|
63
|
+
let offset = 0;
|
|
64
|
+
for (const entry of entries) {
|
|
65
|
+
const nameBytes = encoder.encode(entry.name);
|
|
66
|
+
staged.push({
|
|
67
|
+
...entry,
|
|
68
|
+
crc: crc32(entry.data),
|
|
69
|
+
nameBytes,
|
|
70
|
+
offset
|
|
71
|
+
});
|
|
72
|
+
offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length;
|
|
73
|
+
}
|
|
74
|
+
const centralDirectoryOffset = offset;
|
|
75
|
+
const centralDirectorySize = staged.reduce((total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length, 0);
|
|
76
|
+
const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE);
|
|
77
|
+
for (const entry of staged) {
|
|
78
|
+
writer.u32(67324752);
|
|
79
|
+
writer.u16(20);
|
|
80
|
+
writer.u16(FLAG_UTF8);
|
|
81
|
+
writer.u16(0);
|
|
82
|
+
writer.u16(DOS_EPOCH_TIME);
|
|
83
|
+
writer.u16(DOS_EPOCH_DATE);
|
|
84
|
+
writer.u32(entry.crc);
|
|
85
|
+
writer.u32(entry.data.length);
|
|
86
|
+
writer.u32(entry.data.length);
|
|
87
|
+
writer.u16(entry.nameBytes.length);
|
|
88
|
+
writer.u16(0);
|
|
89
|
+
writer.raw(entry.nameBytes);
|
|
90
|
+
writer.raw(entry.data);
|
|
91
|
+
}
|
|
92
|
+
for (const entry of staged) {
|
|
93
|
+
writer.u32(33639248);
|
|
94
|
+
writer.u16(20);
|
|
95
|
+
writer.u16(20);
|
|
96
|
+
writer.u16(FLAG_UTF8);
|
|
97
|
+
writer.u16(0);
|
|
98
|
+
writer.u16(DOS_EPOCH_TIME);
|
|
99
|
+
writer.u16(DOS_EPOCH_DATE);
|
|
100
|
+
writer.u32(entry.crc);
|
|
101
|
+
writer.u32(entry.data.length);
|
|
102
|
+
writer.u32(entry.data.length);
|
|
103
|
+
writer.u16(entry.nameBytes.length);
|
|
104
|
+
writer.u16(0);
|
|
105
|
+
writer.u16(0);
|
|
106
|
+
writer.u16(0);
|
|
107
|
+
writer.u16(0);
|
|
108
|
+
writer.u32(0);
|
|
109
|
+
writer.u32(entry.offset);
|
|
110
|
+
writer.raw(entry.nameBytes);
|
|
111
|
+
}
|
|
112
|
+
writer.u32(101010256);
|
|
113
|
+
writer.u16(0);
|
|
114
|
+
writer.u16(0);
|
|
115
|
+
writer.u16(staged.length);
|
|
116
|
+
writer.u16(staged.length);
|
|
117
|
+
writer.u32(centralDirectorySize);
|
|
118
|
+
writer.u32(centralDirectoryOffset);
|
|
119
|
+
writer.u16(0);
|
|
120
|
+
return writer.result();
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/util/xlsx.ts
|
|
124
|
+
/**
|
|
125
|
+
* --------------------------------------------------------------------------
|
|
126
|
+
* CoreUI PRO data-grid util/xlsx.ts
|
|
127
|
+
* License (https://coreui.io/pro/license/)
|
|
128
|
+
* --------------------------------------------------------------------------
|
|
129
|
+
*/
|
|
130
|
+
const MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
131
|
+
const DEFAULT_SHEET_NAME = "Sheet1";
|
|
132
|
+
const PX_PER_CHARACTER = 7;
|
|
133
|
+
const CELL_PADDING_PX = 5;
|
|
134
|
+
const MIN_COLUMN_WIDTH = 4;
|
|
135
|
+
const MAX_COLUMN_WIDTH = 120;
|
|
136
|
+
const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
|
|
137
|
+
const escapeXml = (value) => value.replace(CONTROL_CHARACTERS, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
138
|
+
const cellReference = (columnIndex, rowNumber) => {
|
|
139
|
+
let reference = "";
|
|
140
|
+
let index = columnIndex;
|
|
141
|
+
while (index >= 0) {
|
|
142
|
+
reference = String.fromCodePoint(65 + index % 26) + reference;
|
|
143
|
+
index = Math.floor(index / 26) - 1;
|
|
144
|
+
}
|
|
145
|
+
return `${reference}${rowNumber}`;
|
|
146
|
+
};
|
|
147
|
+
const sheetNameFor = (name) => {
|
|
148
|
+
const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\/?*[\]]/g, " ").trim().slice(0, 31);
|
|
149
|
+
return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME;
|
|
150
|
+
};
|
|
151
|
+
const sheetWidthFor = (column) => {
|
|
152
|
+
const size = widthFor(column);
|
|
153
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) return null;
|
|
154
|
+
const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER;
|
|
155
|
+
return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100));
|
|
156
|
+
};
|
|
157
|
+
const cellXml = (reference, value, styleIndex) => {
|
|
158
|
+
const style = styleIndex > 0 ? ` s="${styleIndex}"` : "";
|
|
159
|
+
if (typeof value === "number" && Number.isFinite(value)) return `<c r="${reference}"${style}><v>${value}</v></c>`;
|
|
160
|
+
if (typeof value === "boolean") return `<c r="${reference}"${style} t="b"><v>${value ? 1 : 0}</v></c>`;
|
|
161
|
+
const text = String(value ?? "");
|
|
162
|
+
if (text === "") return `<c r="${reference}"${style}/>`;
|
|
163
|
+
return `<c r="${reference}"${style} t="inlineStr"><is><t xml:space="preserve">${escapeXml(text)}</t></is></c>`;
|
|
164
|
+
};
|
|
165
|
+
const CONTENT_TYPES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
166
|
+
<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/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`;
|
|
167
|
+
const ROOT_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
168
|
+
<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>`;
|
|
169
|
+
const WORKBOOK_RELS = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
170
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`;
|
|
171
|
+
const STYLES = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
172
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
|
|
173
|
+
const workbookXml = (sheetName) => `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
174
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="${escapeXml(sheetName)}" sheetId="1" r:id="rId1"/></sheets></workbook>`;
|
|
175
|
+
const worksheetXml = (table, options) => {
|
|
176
|
+
const columns = columnsFor(table);
|
|
177
|
+
const rows = rowsFor(table, options.scope);
|
|
178
|
+
const widths = columns.map((column, index) => {
|
|
179
|
+
const width = sheetWidthFor(column);
|
|
180
|
+
return width === null ? null : `<col min="${index + 1}" max="${index + 1}" width="${width}" customWidth="1"/>`;
|
|
181
|
+
}).filter((entry) => entry !== null);
|
|
182
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
183
|
+
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">${widths.length > 0 ? `<cols>${widths.join("")}</cols>` : ""}<sheetData><row r="1">${columns.map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1)).join("")}</row>${rows.map((row, rowIndex) => {
|
|
184
|
+
const rowNumber = rowIndex + 2;
|
|
185
|
+
return `<row r="${rowNumber}">${columns.map((column, columnIndex) => {
|
|
186
|
+
const value = row.getValue(column.id);
|
|
187
|
+
const formatter = formatterFor(column);
|
|
188
|
+
return cellXml(cellReference(columnIndex, rowNumber), formatter ? formatter(value, row.original) ?? "" : value, 0);
|
|
189
|
+
}).join("")}</row>`;
|
|
190
|
+
}).join("")}</sheetData></worksheet>`;
|
|
191
|
+
};
|
|
192
|
+
const exportXlsx = (table, options = {}) => {
|
|
193
|
+
const encoder = new TextEncoder();
|
|
194
|
+
const sheetName = sheetNameFor(options.sheetName);
|
|
195
|
+
const entries = [
|
|
196
|
+
{
|
|
197
|
+
name: "[Content_Types].xml",
|
|
198
|
+
data: encoder.encode(CONTENT_TYPES)
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "_rels/.rels",
|
|
202
|
+
data: encoder.encode(ROOT_RELS)
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "xl/workbook.xml",
|
|
206
|
+
data: encoder.encode(workbookXml(sheetName))
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "xl/_rels/workbook.xml.rels",
|
|
210
|
+
data: encoder.encode(WORKBOOK_RELS)
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "xl/styles.xml",
|
|
214
|
+
data: encoder.encode(STYLES)
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "xl/worksheets/sheet1.xml",
|
|
218
|
+
data: encoder.encode(worksheetXml(table, options))
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
return zip(entries);
|
|
222
|
+
};
|
|
223
|
+
const downloadXlsx = (table, options = {}) => {
|
|
224
|
+
const blob = new Blob([exportXlsx(table, options)], { type: MIME_TYPE });
|
|
225
|
+
const url = URL.createObjectURL(blob);
|
|
226
|
+
const anchor = document.createElement("a");
|
|
227
|
+
anchor.href = url;
|
|
228
|
+
anchor.download = options.filename ?? "export.xlsx";
|
|
229
|
+
anchor.style.display = "none";
|
|
230
|
+
document.body.append(anchor);
|
|
231
|
+
anchor.click();
|
|
232
|
+
anchor.remove();
|
|
233
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
234
|
+
};
|
|
235
|
+
//#endregion
|
|
236
|
+
export { downloadXlsx, exportXlsx };
|
|
237
|
+
|
|
238
|
+
//# sourceMappingURL=xlsx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xlsx.mjs","names":[],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]/g\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<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/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<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>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,IAAI,WAA+B;AAEnC,MAAM,oBAAiC;CACrC,IAAI,UACF,OAAO;CAGT,MAAM,wBAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;EACxC,IAAI,QAAQ;EACZ,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OACzB,QAAQ,QAAQ,IAAI,aAAiB,UAAU,IAAK,UAAU;EAGhE,MAAM,SAAS,UAAU;CAC3B;CAEA,WAAW;CACX,OAAO;AACT;AAEA,MAAM,SAAS,UAA8B;CAC3C,MAAM,QAAQ,YAAY;CAC1B,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,OACjB,MAAM,OAAO,MAAM,QAAQ,OAAU,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,MAAM,QAAQ,OAAO,SAAS;EAAE;EACvD;GAAE,MAAM;GAAmB,MAAM,QAAQ,OAAO,YAAY,SAAS,CAAC;EAAE;EACxE;GAAE,MAAM;GAA8B,MAAM,QAAQ,OAAO,aAAa;EAAE;EAC1E;GAAE,MAAM;GAAiB,MAAM,QAAQ,OAAO,MAAM;EAAE;EACtD;GAAE,MAAM;GAA4B,MAAM,QAAQ,OAAO,aAAa,OAAO,OAAO,CAAC;EAAE;CACzF;CAEA,OAAO,IAAI,OAAO;AACpB;AAEA,MAAa,gBAAgB,OAAkB,UAA+B,CAAC,MAAY;CACzF,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,OAAO,OAAO,CAAa,GAAG,EAAE,MAAM,UAAU,CAAC;CACnF,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,SAAS,SAAS,cAAc,GAAG;CACzC,OAAO,OAAO;CACd,OAAO,WAAW,QAAQ,YAAY;CACtC,OAAO,MAAM,UAAU;CAEvB,SAAS,KAAK,OAAO,MAAM;CAC3B,OAAO,MAAM;CACb,OAAO,OAAO;CACd,iBAAiB,IAAI,gBAAgB,GAAG,CAAC;AAC3C"}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI base-component.ts
|
|
4
|
+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
|
+
*
|
|
6
|
+
* This component is a modified version of the Bootstrap's base-component.ts
|
|
7
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
8
|
+
* --------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import Config, { type ComponentConfig } from './util/config.js';
|
|
11
|
+
/**
|
|
12
|
+
* Class definition
|
|
13
|
+
*/
|
|
14
|
+
declare class BaseComponent extends Config {
|
|
15
|
+
['constructor']: typeof BaseComponent;
|
|
16
|
+
protected _element: HTMLElement;
|
|
17
|
+
protected _config: ComponentConfig;
|
|
18
|
+
constructor(element?: string | Element | null, config?: ComponentConfig | null);
|
|
19
|
+
dispose(): void;
|
|
20
|
+
_queueCallback(callback: () => void, element: Element, isAnimated?: boolean): void;
|
|
21
|
+
_getConfig(config?: ComponentConfig | null): ComponentConfig;
|
|
22
|
+
static getInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null): InstanceType<T> | null;
|
|
23
|
+
static getOrCreateInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null, config?: ComponentConfig | null): InstanceType<T>;
|
|
24
|
+
static get VERSION(): string;
|
|
25
|
+
static get DATA_KEY(): string;
|
|
26
|
+
static get EVENT_KEY(): string;
|
|
27
|
+
static eventName(name: string): string;
|
|
19
28
|
}
|
|
29
|
+
export default BaseComponent;
|