@robosystems/report-components 0.1.3 → 0.2.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/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/chunk-POSLHOTN.js +564 -0
- package/dist/chunk-POSLHOTN.js.map +1 -0
- package/dist/{index-DDFpPfUd.d.ts → index-D6FzPTm5.d.ts} +77 -13
- package/dist/index.d.ts +27 -3
- package/dist/index.js +185 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-JTTICHPF.js +0 -273
- package/dist/chunk-JTTICHPF.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BLOCK_ORDER, BLOCK_TITLES, humanize, qname } from './chunk-
|
|
2
|
-
export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, humanize, jsonldFileAdapter, parseJsonld, parseStore, qname } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { isExternalFactUrl, BLOCK_ORDER, BLOCK_TITLES, humanize, qname } from './chunk-POSLHOTN.js';
|
|
2
|
+
export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, fetchSecReportShell, fetchSecSection, humanize, isExternalFactUrl, jsonldFileAdapter, mergeSecSections, parseJsonld, parseStore, parseStructureDefinition, qname } from './chunk-POSLHOTN.js';
|
|
3
|
+
import { useState, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
// src/format.ts
|
|
7
7
|
function formatMoney(value, opts = {}) {
|
|
@@ -81,8 +81,19 @@ function calcSubtotals(model) {
|
|
|
81
81
|
for (const assoc of model.calcAssociations) out.add(assoc.parent);
|
|
82
82
|
return out;
|
|
83
83
|
}
|
|
84
|
-
function structureForBlock(model,
|
|
85
|
-
|
|
84
|
+
function structureForBlock(model, ib) {
|
|
85
|
+
if (ib.structureId) {
|
|
86
|
+
const byId = model.structures.find((s) => s.id === ib.structureId);
|
|
87
|
+
if (byId) return byId;
|
|
88
|
+
}
|
|
89
|
+
return model.structures.find((s) => s.blockType === ib.blockType) ?? null;
|
|
90
|
+
}
|
|
91
|
+
function blockOrder(model, ib) {
|
|
92
|
+
if (ib.structureId) {
|
|
93
|
+
const s = model.structures.find((x) => x.id === ib.structureId);
|
|
94
|
+
if (s?.order !== void 0) return s.order;
|
|
95
|
+
}
|
|
96
|
+
return BLOCK_ORDER[ib.blockType] ?? 99;
|
|
86
97
|
}
|
|
87
98
|
function columnLabel(period) {
|
|
88
99
|
return formatDate(period.end);
|
|
@@ -104,7 +115,7 @@ function deriveColumns(model, facts) {
|
|
|
104
115
|
}).map((period) => ({ key: period.end, label: columnLabel(period), period }));
|
|
105
116
|
}
|
|
106
117
|
function buildStatement(model, ib, subtotals) {
|
|
107
|
-
const structure = structureForBlock(model, ib
|
|
118
|
+
const structure = structureForBlock(model, ib);
|
|
108
119
|
const order = structure ? presentationOrder(model, structure.id) : /* @__PURE__ */ new Map();
|
|
109
120
|
const facts = model.facts.filter((f) => f.factSet !== null && f.factSet === ib.factSet);
|
|
110
121
|
const columns = deriveColumns(model, facts);
|
|
@@ -117,10 +128,10 @@ function buildStatement(model, ib, subtotals) {
|
|
|
117
128
|
if (idx === void 0) continue;
|
|
118
129
|
let cells = cellsByElement.get(fact.element);
|
|
119
130
|
if (!cells) {
|
|
120
|
-
cells = columns.map(() => ({ value: null, fact: null }));
|
|
131
|
+
cells = columns.map(() => ({ value: null, fact: null, textValue: null }));
|
|
121
132
|
cellsByElement.set(fact.element, cells);
|
|
122
133
|
}
|
|
123
|
-
cells[idx] = { value: fact.value, fact };
|
|
134
|
+
cells[idx] = { value: fact.value, fact, textValue: fact.textValue ?? null };
|
|
124
135
|
}
|
|
125
136
|
const rows = [...cellsByElement.keys()].map((id) => {
|
|
126
137
|
const entry = order.get(id);
|
|
@@ -135,19 +146,27 @@ function buildStatement(model, ib, subtotals) {
|
|
|
135
146
|
isSubtotal: subtotals.has(id),
|
|
136
147
|
cells: cellsByElement.get(id)
|
|
137
148
|
}));
|
|
149
|
+
const title = ib.structureId ? structure?.structureName ?? ib.label ?? BLOCK_TITLES[ib.blockType] ?? ib.blockType : BLOCK_TITLES[ib.blockType] ?? ib.label ?? ib.blockType;
|
|
138
150
|
return {
|
|
139
151
|
ib,
|
|
140
152
|
blockType: ib.blockType,
|
|
141
|
-
title
|
|
142
|
-
structureName: structure?.structureName ?? ib.label ?? null,
|
|
153
|
+
title,
|
|
154
|
+
structureName: ib.structureId ? null : structure?.structureName ?? ib.label ?? null,
|
|
143
155
|
columns,
|
|
144
156
|
rows
|
|
145
157
|
};
|
|
146
158
|
}
|
|
159
|
+
function reportSections(model) {
|
|
160
|
+
return buildStatements(model).map((s) => ({ id: s.ib.id, title: s.title }));
|
|
161
|
+
}
|
|
162
|
+
function sliceReportSection(model, informationBlockId) {
|
|
163
|
+
const ib = model.informationBlocks.find((b) => b.id === informationBlockId);
|
|
164
|
+
return { ...model, informationBlocks: ib ? [ib] : [] };
|
|
165
|
+
}
|
|
147
166
|
function buildStatements(model) {
|
|
148
167
|
const subtotals = calcSubtotals(model);
|
|
149
168
|
return [...model.informationBlocks].sort(
|
|
150
|
-
(a, b) => (
|
|
169
|
+
(a, b) => blockOrder(model, a) - blockOrder(model, b) || a.blockType.localeCompare(b.blockType)
|
|
151
170
|
).map((ib) => buildStatement(model, ib, subtotals));
|
|
152
171
|
}
|
|
153
172
|
function footCheck(model, statement, elementId, columnIndex) {
|
|
@@ -176,6 +195,93 @@ function footCheck(model, statement, elementId, columnIndex) {
|
|
|
176
195
|
};
|
|
177
196
|
}
|
|
178
197
|
var styles = {
|
|
198
|
+
status: {
|
|
199
|
+
fontFamily: "var(--rs-font-sans, ui-sans-serif, system-ui, sans-serif)",
|
|
200
|
+
fontSize: "0.85rem",
|
|
201
|
+
color: "var(--rs-muted, #6b7280)",
|
|
202
|
+
padding: "0.75rem 0"
|
|
203
|
+
},
|
|
204
|
+
link: { color: "var(--rs-primary-700, #1d4ed8)" },
|
|
205
|
+
frame: { width: "100%", border: "none", display: "block" },
|
|
206
|
+
pre: {
|
|
207
|
+
whiteSpace: "pre-wrap",
|
|
208
|
+
wordBreak: "break-word",
|
|
209
|
+
fontFamily: "var(--rs-font-mono, ui-monospace, monospace)",
|
|
210
|
+
fontSize: "0.85rem",
|
|
211
|
+
color: "var(--rs-text, #111827)",
|
|
212
|
+
margin: 0
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
function wrapHtml(body) {
|
|
216
|
+
return `<!doctype html><html><head><meta charset="utf-8"><base target="_blank"><style>
|
|
217
|
+
:root { color-scheme: light; }
|
|
218
|
+
body { margin: 0; color: #111827;
|
|
219
|
+
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
220
|
+
font-size: 13px; line-height: 1.45; }
|
|
221
|
+
img, svg { max-width: 100%; height: auto; }
|
|
222
|
+
table { max-width: 100%; border-collapse: collapse; }
|
|
223
|
+
a { color: #1d4ed8; }
|
|
224
|
+
</style></head><body>${body}</body></html>`;
|
|
225
|
+
}
|
|
226
|
+
function SandboxedHtml({ html }) {
|
|
227
|
+
const ref = useRef(null);
|
|
228
|
+
const fit = () => {
|
|
229
|
+
const frame = ref.current;
|
|
230
|
+
const doc = frame?.contentWindow?.document;
|
|
231
|
+
if (!frame || !doc) return;
|
|
232
|
+
try {
|
|
233
|
+
frame.style.height = `${doc.documentElement.scrollHeight}px`;
|
|
234
|
+
} catch {
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
"iframe",
|
|
239
|
+
{
|
|
240
|
+
ref,
|
|
241
|
+
title: "Disclosure",
|
|
242
|
+
sandbox: "allow-same-origin",
|
|
243
|
+
srcDoc: wrapHtml(html),
|
|
244
|
+
style: styles.frame,
|
|
245
|
+
onLoad: () => {
|
|
246
|
+
fit();
|
|
247
|
+
setTimeout(fit, 250);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
function ExternalTextBlock({ url }) {
|
|
253
|
+
const [state, setState] = useState("loading");
|
|
254
|
+
const [body, setBody] = useState("");
|
|
255
|
+
const isHtml = /\.html$/i.test(url);
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
let cancelled = false;
|
|
258
|
+
setState("loading");
|
|
259
|
+
fetch(url).then((r) => {
|
|
260
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
261
|
+
return r.text();
|
|
262
|
+
}).then((text) => {
|
|
263
|
+
if (cancelled) return;
|
|
264
|
+
setBody(text);
|
|
265
|
+
setState("ready");
|
|
266
|
+
}).catch(() => {
|
|
267
|
+
if (!cancelled) setState("error");
|
|
268
|
+
});
|
|
269
|
+
return () => {
|
|
270
|
+
cancelled = true;
|
|
271
|
+
};
|
|
272
|
+
}, [url]);
|
|
273
|
+
if (state === "loading") return /* @__PURE__ */ jsx("div", { style: styles.status, children: "Loading disclosure\u2026" });
|
|
274
|
+
if (state === "error") {
|
|
275
|
+
return /* @__PURE__ */ jsxs("div", { style: styles.status, children: [
|
|
276
|
+
"Could not load this disclosure.",
|
|
277
|
+
" ",
|
|
278
|
+
/* @__PURE__ */ jsx("a", { style: styles.link, href: url, target: "_blank", rel: "noreferrer", children: "Open it directly \u2197" })
|
|
279
|
+
] });
|
|
280
|
+
}
|
|
281
|
+
if (!isHtml) return /* @__PURE__ */ jsx("pre", { style: styles.pre, children: body });
|
|
282
|
+
return /* @__PURE__ */ jsx(SandboxedHtml, { html: body });
|
|
283
|
+
}
|
|
284
|
+
var styles2 = {
|
|
179
285
|
panel: {
|
|
180
286
|
fontFamily: "var(--rs-font-sans, ui-sans-serif, system-ui, sans-serif)",
|
|
181
287
|
color: "var(--rs-text, #111827)",
|
|
@@ -192,11 +298,17 @@ var styles = {
|
|
|
192
298
|
gap: "1rem",
|
|
193
299
|
marginBottom: "0.75rem"
|
|
194
300
|
},
|
|
195
|
-
|
|
301
|
+
// `minWidth: 0` lets this flex child shrink below its content so the long
|
|
302
|
+
// label / qname wrap inside the panel instead of overflowing it.
|
|
303
|
+
headerText: { minWidth: 0 },
|
|
304
|
+
label: { fontSize: "1rem", fontWeight: 700, margin: 0, overflowWrap: "anywhere" },
|
|
196
305
|
qname: {
|
|
306
|
+
display: "block",
|
|
197
307
|
fontFamily: "var(--rs-font-mono, ui-monospace, monospace)",
|
|
198
308
|
fontSize: "0.8rem",
|
|
199
|
-
color: "var(--rs-primary-700, #1d4ed8)"
|
|
309
|
+
color: "var(--rs-primary-700, #1d4ed8)",
|
|
310
|
+
// qnames are single unbroken tokens — break anywhere so they don't overflow.
|
|
311
|
+
overflowWrap: "anywhere"
|
|
200
312
|
},
|
|
201
313
|
close: {
|
|
202
314
|
border: "none",
|
|
@@ -235,7 +347,7 @@ var styles = {
|
|
|
235
347
|
};
|
|
236
348
|
function Field({ k, children }) {
|
|
237
349
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
238
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
350
|
+
/* @__PURE__ */ jsx("span", { style: styles2.key, children: k }),
|
|
239
351
|
/* @__PURE__ */ jsx("span", { children })
|
|
240
352
|
] });
|
|
241
353
|
}
|
|
@@ -253,20 +365,20 @@ function FactInspector({
|
|
|
253
365
|
const unit = cell.fact?.unit ? report.units[cell.fact.unit] : null;
|
|
254
366
|
const foot = footCheck(report, statement, element.id, columnIndex);
|
|
255
367
|
const sym = currencySymbol;
|
|
256
|
-
return /* @__PURE__ */ jsxs("div", { style:
|
|
257
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
258
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
259
|
-
/* @__PURE__ */ jsx("p", { style:
|
|
260
|
-
/* @__PURE__ */ jsx("span", { style:
|
|
368
|
+
return /* @__PURE__ */ jsxs("div", { style: styles2.panel, children: [
|
|
369
|
+
/* @__PURE__ */ jsxs("div", { style: styles2.header, children: [
|
|
370
|
+
/* @__PURE__ */ jsxs("div", { style: styles2.headerText, children: [
|
|
371
|
+
/* @__PURE__ */ jsx("p", { style: styles2.label, children: element.label }),
|
|
372
|
+
/* @__PURE__ */ jsx("span", { style: styles2.qname, children: element.qname })
|
|
261
373
|
] }),
|
|
262
|
-
onClose ? /* @__PURE__ */ jsx("button", { style:
|
|
374
|
+
onClose ? /* @__PURE__ */ jsx("button", { style: styles2.close, onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
|
|
263
375
|
] }),
|
|
264
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
265
|
-
/* @__PURE__ */ jsx(Field, { k: "Value", children: /* @__PURE__ */ jsx("span", { style:
|
|
376
|
+
/* @__PURE__ */ jsxs("div", { style: styles2.grid, children: [
|
|
377
|
+
/* @__PURE__ */ jsx(Field, { k: "Value", children: cell.value === null && cell.textValue ? /* @__PURE__ */ jsx("span", { children: cell.textValue }) : /* @__PURE__ */ jsx("span", { style: styles2.mono, children: formatMoney(cell.value, { currencySymbol: sym }) }) }),
|
|
266
378
|
/* @__PURE__ */ jsxs(Field, { k: "Period", children: [
|
|
267
379
|
formatPeriod(column.period),
|
|
268
380
|
" ",
|
|
269
|
-
/* @__PURE__ */ jsxs("span", { style:
|
|
381
|
+
/* @__PURE__ */ jsxs("span", { style: styles2.key, children: [
|
|
270
382
|
"(",
|
|
271
383
|
column.period.type,
|
|
272
384
|
")"
|
|
@@ -276,12 +388,12 @@ function FactInspector({
|
|
|
276
388
|
element.balance ? /* @__PURE__ */ jsx(Field, { k: "Balance", children: element.balance }) : null,
|
|
277
389
|
cell.fact?.decimals ? /* @__PURE__ */ jsx(Field, { k: "Decimals", children: cell.fact.decimals }) : null
|
|
278
390
|
] }),
|
|
279
|
-
foot ? /* @__PURE__ */ jsxs("div", { style:
|
|
280
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
391
|
+
foot ? /* @__PURE__ */ jsxs("div", { style: styles2.footing, children: [
|
|
392
|
+
/* @__PURE__ */ jsxs("div", { style: styles2.footTitle, children: [
|
|
281
393
|
"Calculation ",
|
|
282
394
|
foot.ok ? "\u2713 foots" : "\u26A0 does not foot"
|
|
283
395
|
] }),
|
|
284
|
-
/* @__PURE__ */ jsxs("div", { style:
|
|
396
|
+
/* @__PURE__ */ jsxs("div", { style: styles2.equation, children: [
|
|
285
397
|
foot.terms.map((term, i) => {
|
|
286
398
|
const op = i === 0 ? term.weight < 0 ? "\u2212" : "" : term.weight < 0 ? " \u2212 " : " + ";
|
|
287
399
|
return /* @__PURE__ */ jsxs("span", { title: term.element.qname, children: [
|
|
@@ -303,7 +415,7 @@ function FactInspector({
|
|
|
303
415
|
] }) : null
|
|
304
416
|
] });
|
|
305
417
|
}
|
|
306
|
-
var
|
|
418
|
+
var styles3 = {
|
|
307
419
|
wrap: {
|
|
308
420
|
fontFamily: "var(--rs-font-sans, ui-sans-serif, system-ui, sans-serif)",
|
|
309
421
|
color: "var(--rs-text, #111827)",
|
|
@@ -349,6 +461,18 @@ var styles2 = {
|
|
|
349
461
|
whiteSpace: "nowrap",
|
|
350
462
|
fontFamily: "var(--rs-font-mono, ui-monospace, SFMono-Regular, monospace)",
|
|
351
463
|
fontVariantNumeric: "tabular-nums"
|
|
464
|
+
},
|
|
465
|
+
textBlockCell: {
|
|
466
|
+
padding: "0.75rem",
|
|
467
|
+
borderTop: "1px solid var(--rs-border, #e5e7eb)"
|
|
468
|
+
},
|
|
469
|
+
textBlockLabel: {
|
|
470
|
+
fontSize: "0.7rem",
|
|
471
|
+
textTransform: "uppercase",
|
|
472
|
+
letterSpacing: "0.05em",
|
|
473
|
+
fontWeight: 600,
|
|
474
|
+
color: "var(--rs-muted, #6b7280)",
|
|
475
|
+
marginBottom: "0.5rem"
|
|
352
476
|
}
|
|
353
477
|
};
|
|
354
478
|
function StatementTable({
|
|
@@ -359,25 +483,34 @@ function StatementTable({
|
|
|
359
483
|
}) {
|
|
360
484
|
const { columns, rows } = statement;
|
|
361
485
|
const periodCaption = columns.length === 1 ? formatPeriod(columns[0].period) : null;
|
|
362
|
-
return /* @__PURE__ */ jsxs("section", { style:
|
|
363
|
-
/* @__PURE__ */ jsxs("header", { style:
|
|
364
|
-
/* @__PURE__ */ jsx("h3", { style:
|
|
365
|
-
statement.structureName ? /* @__PURE__ */ jsx("div", { style:
|
|
366
|
-
periodCaption ? /* @__PURE__ */ jsx("div", { style:
|
|
486
|
+
return /* @__PURE__ */ jsxs("section", { style: styles3.wrap, children: [
|
|
487
|
+
/* @__PURE__ */ jsxs("header", { style: styles3.heading, children: [
|
|
488
|
+
/* @__PURE__ */ jsx("h3", { style: styles3.title, children: statement.title }),
|
|
489
|
+
statement.structureName ? /* @__PURE__ */ jsx("div", { style: styles3.subtitle, children: statement.structureName }) : null,
|
|
490
|
+
periodCaption ? /* @__PURE__ */ jsx("div", { style: styles3.subtitle, children: periodCaption }) : null
|
|
367
491
|
] }),
|
|
368
|
-
/* @__PURE__ */ jsxs("table", { style:
|
|
492
|
+
/* @__PURE__ */ jsxs("table", { style: styles3.table, children: [
|
|
369
493
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
370
|
-
/* @__PURE__ */ jsx("th", { style: { ...
|
|
371
|
-
columns.map((col) => /* @__PURE__ */ jsx("th", { style: { ...
|
|
494
|
+
/* @__PURE__ */ jsx("th", { style: { ...styles3.th, ...styles3.thConcept }, children: "Concept" }),
|
|
495
|
+
columns.map((col) => /* @__PURE__ */ jsx("th", { style: { ...styles3.th, ...styles3.thNum }, children: col.label }, col.key))
|
|
372
496
|
] }) }),
|
|
373
497
|
/* @__PURE__ */ jsx("tbody", { children: rows.map((row) => {
|
|
498
|
+
const textBlock = row.cells.find(
|
|
499
|
+
(c) => c.value === null && isExternalFactUrl(c.textValue)
|
|
500
|
+
);
|
|
501
|
+
if (textBlock?.textValue) {
|
|
502
|
+
return /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { colSpan: columns.length + 1, style: styles3.textBlockCell, children: [
|
|
503
|
+
/* @__PURE__ */ jsx("div", { style: styles3.textBlockLabel, title: row.element.qname, children: row.element.label }),
|
|
504
|
+
/* @__PURE__ */ jsx(ExternalTextBlock, { url: textBlock.textValue })
|
|
505
|
+
] }) }, row.element.id);
|
|
506
|
+
}
|
|
374
507
|
const isGrandTotal = row.isSubtotal && row.depth === 0;
|
|
375
508
|
const allZeroOrNull = row.cells.every((c) => c.value === null || c.value === 0);
|
|
376
509
|
const rowStyle = {
|
|
377
510
|
backgroundColor: row.isSubtotal ? "var(--rs-subtotal-bg, #f9fafb)" : void 0
|
|
378
511
|
};
|
|
379
512
|
const labelStyle = {
|
|
380
|
-
...
|
|
513
|
+
...styles3.labelCell,
|
|
381
514
|
paddingLeft: `${row.depth * 20 + 12}px`,
|
|
382
515
|
fontWeight: row.isSubtotal ? 600 : 400,
|
|
383
516
|
color: !row.isSubtotal && allZeroOrNull ? "var(--rs-muted, #9ca3af)" : void 0,
|
|
@@ -388,20 +521,26 @@ function StatementTable({
|
|
|
388
521
|
row.cells.map((cell, i) => {
|
|
389
522
|
const isSelected = selected !== null && selected.elementId === row.element.id && selected.columnIndex === i;
|
|
390
523
|
const clickable = onCellClick && cell.fact !== null;
|
|
524
|
+
const isText = cell.value === null && cell.textValue != null && cell.textValue !== "";
|
|
391
525
|
const numStyle = {
|
|
392
|
-
...
|
|
526
|
+
...styles3.numCell,
|
|
393
527
|
fontWeight: row.isSubtotal ? 600 : 400,
|
|
394
528
|
borderBottom: isGrandTotal ? "3px double var(--rs-text, #111827)" : void 0,
|
|
395
529
|
cursor: clickable ? "pointer" : "default",
|
|
396
530
|
backgroundColor: isSelected ? "var(--rs-selected-bg, #dbeafe)" : void 0,
|
|
397
|
-
color: !row.isSubtotal && (cell.value === null || cell.value === 0) ? "var(--rs-muted, #9ca3af)" : void 0
|
|
531
|
+
color: !isText && !row.isSubtotal && (cell.value === null || cell.value === 0) ? "var(--rs-muted, #9ca3af)" : void 0,
|
|
532
|
+
...isText ? {
|
|
533
|
+
textAlign: "left",
|
|
534
|
+
whiteSpace: "normal",
|
|
535
|
+
fontFamily: "var(--rs-font-sans, ui-sans-serif, system-ui, sans-serif)"
|
|
536
|
+
} : {}
|
|
398
537
|
};
|
|
399
538
|
return /* @__PURE__ */ jsx(
|
|
400
539
|
"td",
|
|
401
540
|
{
|
|
402
541
|
style: numStyle,
|
|
403
542
|
onClick: clickable ? () => onCellClick?.(row, i) : void 0,
|
|
404
|
-
children: formatMoney(cell.value, { currencySymbol })
|
|
543
|
+
children: isText ? cell.textValue : formatMoney(cell.value, { currencySymbol })
|
|
405
544
|
},
|
|
406
545
|
columns[i].key
|
|
407
546
|
);
|
|
@@ -411,7 +550,7 @@ function StatementTable({
|
|
|
411
550
|
] })
|
|
412
551
|
] });
|
|
413
552
|
}
|
|
414
|
-
var
|
|
553
|
+
var styles4 = {
|
|
415
554
|
layout: {
|
|
416
555
|
display: "grid",
|
|
417
556
|
gridTemplateColumns: "minmax(0, 1fr)",
|
|
@@ -432,7 +571,6 @@ var styles3 = {
|
|
|
432
571
|
margin: 0,
|
|
433
572
|
color: "var(--rs-text, #111827)"
|
|
434
573
|
},
|
|
435
|
-
entitySub: { fontSize: "0.85rem", color: "var(--rs-muted, #6b7280)" },
|
|
436
574
|
panel: { position: "sticky", top: "1rem" }
|
|
437
575
|
};
|
|
438
576
|
function ReportView({ report, currencySymbol = "$", inspect = true }) {
|
|
@@ -441,16 +579,13 @@ function ReportView({ report, currencySymbol = "$", inspect = true }) {
|
|
|
441
579
|
const selected = selection !== null ? statements[selection.statementIndex] : null;
|
|
442
580
|
const selectedRow = selected?.rows.find((r) => r.element.id === selection?.elementId) ?? null;
|
|
443
581
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
444
|
-
report.entity ? /* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */ jsx("h2", { style: styles3.entityName, children: report.entity.name }),
|
|
446
|
-
report.entity.country ? /* @__PURE__ */ jsx("div", { style: styles3.entitySub, children: report.entity.country }) : null
|
|
447
|
-
] }) : null,
|
|
582
|
+
report.entity ? /* @__PURE__ */ jsx("header", { style: styles4.entity, children: /* @__PURE__ */ jsx("h2", { style: styles4.entityName, children: report.entity.name }) }) : null,
|
|
448
583
|
/* @__PURE__ */ jsxs(
|
|
449
584
|
"div",
|
|
450
585
|
{
|
|
451
586
|
style: {
|
|
452
|
-
...
|
|
453
|
-
...inspect && selectedRow ?
|
|
587
|
+
...styles4.layout,
|
|
588
|
+
...inspect && selectedRow ? styles4.layoutWithPanel : {}
|
|
454
589
|
},
|
|
455
590
|
children: [
|
|
456
591
|
/* @__PURE__ */ jsx("div", { children: statements.map((statement, statementIndex) => /* @__PURE__ */ jsx(
|
|
@@ -470,7 +605,7 @@ function ReportView({ report, currencySymbol = "$", inspect = true }) {
|
|
|
470
605
|
},
|
|
471
606
|
statement.ib.id
|
|
472
607
|
)) }),
|
|
473
|
-
inspect && selected && selectedRow && selection ? /* @__PURE__ */ jsx("div", { style:
|
|
608
|
+
inspect && selected && selectedRow && selection ? /* @__PURE__ */ jsx("div", { style: styles4.panel, children: /* @__PURE__ */ jsx(
|
|
474
609
|
FactInspector,
|
|
475
610
|
{
|
|
476
611
|
report,
|
|
@@ -487,6 +622,6 @@ function ReportView({ report, currencySymbol = "$", inspect = true }) {
|
|
|
487
622
|
] });
|
|
488
623
|
}
|
|
489
624
|
|
|
490
|
-
export { FactInspector, ReportView, StatementTable, buildStatements, calcSubtotals, footCheck, formatDate, formatMoney, formatPeriod, presentationOrder };
|
|
625
|
+
export { ExternalTextBlock, FactInspector, ReportView, StatementTable, buildStatements, calcSubtotals, footCheck, formatDate, formatMoney, formatPeriod, presentationOrder, reportSections, sliceReportSection };
|
|
491
626
|
//# sourceMappingURL=index.js.map
|
|
492
627
|
//# sourceMappingURL=index.js.map
|