@floless/app 0.50.0 → 0.51.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/dist/floless-server.cjs +5287 -1030
- package/dist/web/aware.js +36 -0
- package/package.json +2 -1
package/dist/web/aware.js
CHANGED
|
@@ -1072,6 +1072,8 @@
|
|
|
1072
1072
|
// Export/write group — visually separated from the look-and-read actions above.
|
|
1073
1073
|
addNodeActionDivider(card);
|
|
1074
1074
|
addNodeAction(card, 'Export IFC ▸', () => exportContractIfc(currentId));
|
|
1075
|
+
addNodeAction(card, 'Export BOM (CSV) ▸', () => exportContractBom(currentId, 'csv'));
|
|
1076
|
+
addNodeAction(card, 'Export BOM (Excel) ▸', () => exportContractBom(currentId, 'xlsx'));
|
|
1075
1077
|
const teklaBtn = addNodeAction(card, 'Send to Tekla ▸', () => exportContractTekla(currentId));
|
|
1076
1078
|
teklaBtn.dataset.tip = 'Tekla must be open with a model loaded. Click to create native parts in it.';
|
|
1077
1079
|
card.dataset.tip = 'Double-click to open the contract editor';
|
|
@@ -1544,6 +1546,40 @@
|
|
|
1544
1546
|
}
|
|
1545
1547
|
}
|
|
1546
1548
|
|
|
1549
|
+
// Export BOM ▸ — write the approved takeoff's Bill of Materials OUT to a CSV or a real .xlsx and
|
|
1550
|
+
// download it. Generated host-side (no model): the server reuses the same BOM aggregation the
|
|
1551
|
+
// canvas BOM node shows, saves the file under ~/.floless/exports/<appId>/, and returns the bytes
|
|
1552
|
+
// (csv text, or xlsx base64) which the browser turns into a download. api() throws on any failure
|
|
1553
|
+
// (no contract, all-RFI 422, write error).
|
|
1554
|
+
async function exportContractBom(appId, format) {
|
|
1555
|
+
const label = format === 'xlsx' ? 'Excel' : 'CSV';
|
|
1556
|
+
showToast(`Generating BOM ${label}…`, 'info');
|
|
1557
|
+
try {
|
|
1558
|
+
const res = await api('/api/contract/' + encodeURIComponent(appId) + '/export-bom/' + format, { method: 'POST' });
|
|
1559
|
+
const body = res.encoding === 'base64' ? b64ToBytes(res.content || '') : (res.content || '');
|
|
1560
|
+
const mime = format === 'xlsx'
|
|
1561
|
+
? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
1562
|
+
: 'text/csv';
|
|
1563
|
+
const blob = new Blob([body], { type: mime });
|
|
1564
|
+
const url = URL.createObjectURL(blob);
|
|
1565
|
+
const a = document.createElement('a');
|
|
1566
|
+
a.href = url; a.download = res.filename || (appId + '-bom.' + format);
|
|
1567
|
+
document.body.appendChild(a); a.click(); a.remove();
|
|
1568
|
+
setTimeout(() => URL.revokeObjectURL(url), 4000);
|
|
1569
|
+
showToast(`BOM ${label} saved & downloaded — ${res.filename || appId + '-bom.' + format}`, 'ok');
|
|
1570
|
+
} catch (e) {
|
|
1571
|
+
showToast(`BOM ${label} export failed: ` + (e && e.message ? e.message : String(e)), 'warn');
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// Decode a base64 string into a Uint8Array for a binary download (the .xlsx bytes).
|
|
1576
|
+
function b64ToBytes(b64) {
|
|
1577
|
+
const bin = atob(b64);
|
|
1578
|
+
const out = new Uint8Array(bin.length);
|
|
1579
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
1580
|
+
return out;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1547
1583
|
// Send to Tekla ▸ — create native parts in the OPEN Tekla model from the approved takeoff. Needs
|
|
1548
1584
|
// Tekla running with a model; when it's not, the server returns a clear needsTekla state (api()
|
|
1549
1585
|
// throws with err.body.needsTekla) — surfaced as an informational nudge, not a hard error.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floless/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
|
|
6
6
|
"bin": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"rcedit": "^5.0.2",
|
|
40
40
|
"tsx": "^4.19.0",
|
|
41
41
|
"typescript": "^5.6.0",
|
|
42
|
+
"write-excel-file": "^4.1.1",
|
|
42
43
|
"yaml": "^2.9.0"
|
|
43
44
|
}
|
|
44
45
|
}
|