@ai-matrx/alchemy 0.8.3 → 0.8.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/CHANGELOG.md +17 -1
- package/dist/core.cjs +8 -47
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +8 -47
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +8 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -47
- package/dist/index.js.map +1 -1
- package/dist/operate-xlsx.cjs +34007 -18
- package/dist/operate-xlsx.cjs.map +1 -1
- package/dist/operate-xlsx.js +34011 -5
- package/dist/operate-xlsx.js.map +1 -1
- package/dist/operate.cjs +8 -47
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.js +8 -47
- package/dist/operate.js.map +1 -1
- package/dist/react-bar.cjs +2 -2
- package/dist/react-bar.cjs.map +1 -1
- package/dist/react-bar.js +2 -2
- package/dist/react-bar.js.map +1 -1
- package/dist/react-menu.cjs +2 -2
- package/dist/react-menu.cjs.map +1 -1
- package/dist/react-menu.js +2 -2
- package/dist/react-menu.js.map +1 -1
- package/dist/react-overflow.cjs.map +1 -1
- package/dist/react-overflow.js.map +1 -1
- package/dist/react-selection.cjs +2 -2
- package/dist/react-selection.cjs.map +1 -1
- package/dist/react-selection.js +2 -2
- package/dist/react-selection.js.map +1 -1
- package/dist/react-sheet.cjs +3 -3
- package/dist/react-sheet.cjs.map +1 -1
- package/dist/react-sheet.js +3 -3
- package/dist/react-sheet.js.map +1 -1
- package/package.json +5 -5
package/dist/operate.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
|
|
3
|
+
var __esm = (fn, res, err) => function __init() {
|
|
4
|
+
if (err) throw err[0];
|
|
5
|
+
try {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
} catch (e) {
|
|
8
|
+
throw err = [e], e;
|
|
9
|
+
}
|
|
5
10
|
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
@@ -1335,50 +1340,6 @@ var init_document = __esm({
|
|
|
1335
1340
|
}
|
|
1336
1341
|
});
|
|
1337
1342
|
|
|
1338
|
-
// src/operate/formats/xlsx.ts
|
|
1339
|
-
var xlsx_exports = {};
|
|
1340
|
-
__export(xlsx_exports, {
|
|
1341
|
-
xlsxEngine: () => xlsxEngine
|
|
1342
|
-
});
|
|
1343
|
-
var cell, xlsxEngine;
|
|
1344
|
-
var init_xlsx = __esm({
|
|
1345
|
-
"src/operate/formats/xlsx.ts"() {
|
|
1346
|
-
"use strict";
|
|
1347
|
-
init_core();
|
|
1348
|
-
cell = (value) => value === void 0 || value === null ? null : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
|
|
1349
|
-
xlsxEngine = {
|
|
1350
|
-
async build(draft, options, signal) {
|
|
1351
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1352
|
-
const p = draft.payload;
|
|
1353
|
-
if (p.kind !== "rows") throw new ContentTransferError("unsupported-format", "An Excel workbook needs table rows. Download it as CSV or JSON instead.");
|
|
1354
|
-
const columns = p.columns.filter(
|
|
1355
|
-
(c) => c.visible && c.exportable !== false && c.classification !== "secret" && c.classification !== "credential"
|
|
1356
|
-
);
|
|
1357
|
-
const XLSX = await import("xlsx");
|
|
1358
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1359
|
-
const sheet = XLSX.utils.aoa_to_sheet([columns.map((c) => c.label), ...p.rows.map((row) => columns.map((c) => cell(readTransferCell(row, c))))]);
|
|
1360
|
-
const book = XLSX.utils.book_new();
|
|
1361
|
-
const filename = options.filename ?? "export.xlsx";
|
|
1362
|
-
const sheetName = filename.replace(/\.xlsx$/i, "").replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
|
|
1363
|
-
XLSX.utils.book_append_sheet(book, sheet, sheetName);
|
|
1364
|
-
const written = XLSX.write(book, { type: "array", bookType: "xlsx", compression: true });
|
|
1365
|
-
return sealTransferArtifact({
|
|
1366
|
-
snapshotId: draft.snapshotId,
|
|
1367
|
-
draftRevision: draft.revision,
|
|
1368
|
-
format: "xlsx",
|
|
1369
|
-
plainText: serialize(draft, "tsv", { spreadsheetSafe: true }).plainText,
|
|
1370
|
-
file: {
|
|
1371
|
-
filename,
|
|
1372
|
-
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1373
|
-
bytes: written instanceof Uint8Array ? written : new Uint8Array(written)
|
|
1374
|
-
},
|
|
1375
|
-
omissions: draft.omissions.map((o) => ({ ...o }))
|
|
1376
|
-
});
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
1343
|
// src/operate.ts
|
|
1383
1344
|
init_core();
|
|
1384
1345
|
|
|
@@ -1515,7 +1476,7 @@ var FORMAT_ADAPTERS = Object.freeze([
|
|
|
1515
1476
|
modes: ["download"],
|
|
1516
1477
|
runsOn: "client",
|
|
1517
1478
|
supports: isRows,
|
|
1518
|
-
load: lazy(async () => (await
|
|
1479
|
+
load: lazy(async () => (await import("@ai-matrx/alchemy/operate/formats/xlsx")).xlsxEngine)
|
|
1519
1480
|
},
|
|
1520
1481
|
{
|
|
1521
1482
|
id: "pdf",
|