@robosystems/report-components 0.1.4 → 0.2.1
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-DGP4KRWF.js +721 -0
- package/dist/chunk-DGP4KRWF.js.map +1 -0
- package/dist/index-WkjE6dZu.d.ts +427 -0
- package/dist/index.d.ts +108 -21
- package/dist/index.js +832 -198
- 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-DDFpPfUd.d.ts +0 -208
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PeriodInfo, E as ElementInfo,
|
|
2
|
-
export { B as BalanceType, C as CalcAssociation,
|
|
1
|
+
import { N as NumericKind, P as PeriodInfo, E as ElementInfo, a as NormalizedReport, I as InformationBlock, b as PivotConfig, c as PivotTable, d as PivotRow, U as UnitInfo } from './index-WkjE6dZu.js';
|
|
2
|
+
export { A as AspectKey, B as BalanceType, C as CalcAssociation, e as CypherAdapterConfig, D as DimensionQualifier, f as EntityInfo, F as Fact, g as PeriodType, h as PivotCell, i as PivotColumn, j as PivotColumnHeader, k as PivotSlicer, l as PresAssociation, R as ReportAdapter, m as ResolvedScale, n as RowCell, S as Scale, o as SecQuery, p as SecReportShell, q as SecSection, r as Statement, s as StatementColumn, t as StatementRow, u as StructureInfo, v as cypherAdapter, w as fetchSecReportShell, x as fetchSecSection, y as jsonldFileAdapter, z as mergeSecSections, G as parseJsonld, H as parseStore, J as parseStructureDefinition } from './index-WkjE6dZu.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import 'n3';
|
|
5
5
|
|
|
@@ -28,6 +28,13 @@ declare function qname(iri: string): string;
|
|
|
28
28
|
* fallback for bundles that predate label emit.
|
|
29
29
|
*/
|
|
30
30
|
declare function humanize(iri: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* A large text-block / policy fact whose HTML (or plain-text) body is too big to
|
|
33
|
+
* store inline, so the platform externalizes it to the public CDN and the fact's
|
|
34
|
+
* value is the URL (`…/fact_<hash>.html` or `.txt`). The renderer fetches and
|
|
35
|
+
* embeds these instead of printing the raw link.
|
|
36
|
+
*/
|
|
37
|
+
declare function isExternalFactUrl(value: string | null | undefined): boolean;
|
|
31
38
|
/** Stable display order for the canonical statement blocks; others fall after. */
|
|
32
39
|
declare const BLOCK_ORDER: Record<string, number>;
|
|
33
40
|
/** Friendly section headings keyed by block type. */
|
|
@@ -47,8 +54,72 @@ declare function formatMoney(value: number | null | undefined, opts?: {
|
|
|
47
54
|
}): string;
|
|
48
55
|
/** `2024-03-31` → `Mar 31, 2024`. Falls back to the raw string if unparseable. */
|
|
49
56
|
declare function formatDate(iso: string | null | undefined): string;
|
|
57
|
+
/**
|
|
58
|
+
* Humanize an ISO-8601 duration value (`P10Y` → "10 years", `P1Y6M` → "1 year 6
|
|
59
|
+
* months", `P30D` → "30 days"), or null when the string is not a duration — so a
|
|
60
|
+
* non-numeric fact that happens to start with "P" (a company name) is untouched.
|
|
61
|
+
* XBRL `durationItemType` facts (debt maturities, lease terms) arrive as these
|
|
62
|
+
* strings in the text path.
|
|
63
|
+
*/
|
|
64
|
+
declare function humanizeDuration(value: string | null | undefined): string | null;
|
|
50
65
|
/** A human description of a period — "As of …" for instants, a span for durations. */
|
|
51
66
|
declare function formatPeriod(period: PeriodInfo): string;
|
|
67
|
+
/** The effective numeric kind of an element (explicit, else derived from monetary). */
|
|
68
|
+
declare function numericKindOf(el: ElementInfo): NumericKind;
|
|
69
|
+
/**
|
|
70
|
+
* A display prefix for a monetary unit measure (`iso4217:USD` → `$`), else null.
|
|
71
|
+
* Unknown currencies fall back to their code (`CHF `, `SEK `) rather than a wrong
|
|
72
|
+
* dollar sign — this is what fixes non-USD facts rendering as `$`.
|
|
73
|
+
*/
|
|
74
|
+
declare function currencySymbolFor(measure: string | null | undefined): string | null;
|
|
75
|
+
interface ValueFormat {
|
|
76
|
+
/** Drives symbol, scaling opt-out, and decimal places. Defaults to `monetary`. */
|
|
77
|
+
numericKind?: NumericKind;
|
|
78
|
+
/** Currency symbol for monetary/per-share values (from the fact's unit). */
|
|
79
|
+
symbol?: string | null;
|
|
80
|
+
/** Divide monetary values by this (e.g. 1e6 to show millions); default 1. */
|
|
81
|
+
scaleFactor?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Format a fact value for display: accounting style (negatives in parentheses,
|
|
85
|
+
* em-dash for absent), the fact's own currency symbol (never a hard-coded `$`),
|
|
86
|
+
* and the section scale — with per-share amounts and share counts never rescaled
|
|
87
|
+
* (an EPS of 4.93 stays 4.93 under "in millions"). A `percent` fact stores a
|
|
88
|
+
* decimal fraction, so it is scaled ×100 and suffixed with `%` (0.10 → 10%); a
|
|
89
|
+
* `pure` fact is a bare ratio, shown as a plain decimal (no `%`).
|
|
90
|
+
*/
|
|
91
|
+
declare function formatValue(value: number | null | undefined, fmt?: ValueFormat): string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Derive the default pivot for a section from the aspects its facts actually
|
|
95
|
+
* carry: concept on rows, period on columns, entity a slicer, and each dimension
|
|
96
|
+
* axis on columns when it has more than one member (a real breakdown) or a slicer
|
|
97
|
+
* when it has just one (diced to a single member, e.g. `Consolidated [Domain]`).
|
|
98
|
+
*/
|
|
99
|
+
declare function defaultPivotConfig(model: NormalizedReport, ib: InformationBlock): PivotConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Move every dimension axis to one side of the pivot — the toggle behind a
|
|
102
|
+
* "dimensions as rows / columns" control. Concept stays on rows and period on
|
|
103
|
+
* columns; only `dim:*` aspects move. Rows (nested breakdowns) is the default;
|
|
104
|
+
* columns gives the side-by-side matrix (equity components across the top).
|
|
105
|
+
*/
|
|
106
|
+
declare function pivotDimensionsOn(config: PivotConfig, placement: 'rows' | 'columns'): PivotConfig;
|
|
107
|
+
/**
|
|
108
|
+
* Pivot one section into a `PivotTable`. Pass `config` to override the default
|
|
109
|
+
* arrangement (e.g. move a high-arity axis from columns to rows).
|
|
110
|
+
*/
|
|
111
|
+
declare function buildPivot(model: NormalizedReport, ib: InformationBlock, config?: PivotConfig): PivotTable;
|
|
112
|
+
/** Section metadata (id + display title) for a report, in canonical order. */
|
|
113
|
+
declare function reportSections(model: NormalizedReport): Array<{
|
|
114
|
+
id: string;
|
|
115
|
+
title: string;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Pivot every section of a report, in canonical block order. `configFor` may
|
|
119
|
+
* transform each section's default config before it is built — e.g. to apply a
|
|
120
|
+
* "dimensions as rows / columns" toggle across the whole report.
|
|
121
|
+
*/
|
|
122
|
+
declare function buildPivots(model: NormalizedReport, configFor?: (ib: InformationBlock, defaultConfig: PivotConfig) => PivotConfig): PivotTable[];
|
|
52
123
|
|
|
53
124
|
interface OrderEntry {
|
|
54
125
|
order: number;
|
|
@@ -57,14 +128,20 @@ interface OrderEntry {
|
|
|
57
128
|
/**
|
|
58
129
|
* Post-order the presentation arcs of one structure → `{element: {order, depth}}`.
|
|
59
130
|
* Roots (a `from` that is never a `to`) are visited by their subtree's leading
|
|
60
|
-
* arc order
|
|
61
|
-
*
|
|
131
|
+
* arc order. Retained as a reusable utility; the pivot engine builds its own
|
|
132
|
+
* pre-order tree (it needs abstract headers), but external callers may still want
|
|
133
|
+
* a flat order map.
|
|
62
134
|
*/
|
|
63
135
|
declare function presentationOrder(model: NormalizedReport, structureId: string): Map<string, OrderEntry>;
|
|
64
136
|
/** Concepts that are calculation parents — the authoritative subtotal set. */
|
|
65
137
|
declare function calcSubtotals(model: NormalizedReport): Set<string>;
|
|
66
|
-
/**
|
|
67
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Narrow a whole report to a single section (one Information Block) so it can be
|
|
140
|
+
* rendered on its own. `buildPivots` only iterates `informationBlocks`, so
|
|
141
|
+
* restricting to one yields exactly that section — facts, structures, and
|
|
142
|
+
* networks stay intact because the pivot filters them by the block.
|
|
143
|
+
*/
|
|
144
|
+
declare function sliceReportSection(model: NormalizedReport, informationBlockId: string): NormalizedReport;
|
|
68
145
|
interface FootTerm {
|
|
69
146
|
element: ElementInfo;
|
|
70
147
|
weight: number;
|
|
@@ -83,40 +160,50 @@ interface FootCheck {
|
|
|
83
160
|
/**
|
|
84
161
|
* Foot a subtotal live: sum its calculation children (× weight) and compare to
|
|
85
162
|
* its reported value, e.g. `13,550 + 900 = 14,450 ✓`. Returns `null` when the
|
|
86
|
-
* element is not a calculation parent (nothing to foot).
|
|
163
|
+
* element is not a calculation parent (nothing to foot). Values are read from the
|
|
164
|
+
* consolidated (undimensioned) row for each concept.
|
|
87
165
|
*/
|
|
88
|
-
declare function footCheck(model: NormalizedReport,
|
|
166
|
+
declare function footCheck(model: NormalizedReport, table: PivotTable, elementId: string, columnIndex: number): FootCheck | null;
|
|
167
|
+
|
|
168
|
+
interface ExternalTextBlockProps {
|
|
169
|
+
url: string;
|
|
170
|
+
}
|
|
171
|
+
declare function ExternalTextBlock({ url }: ExternalTextBlockProps): react.JSX.Element;
|
|
89
172
|
|
|
90
173
|
interface FactInspectorProps {
|
|
91
174
|
report: NormalizedReport;
|
|
92
|
-
|
|
93
|
-
row:
|
|
175
|
+
table: PivotTable;
|
|
176
|
+
row: PivotRow;
|
|
94
177
|
columnIndex: number;
|
|
95
178
|
onClose?: () => void;
|
|
96
|
-
currencySymbol?: string;
|
|
97
179
|
}
|
|
98
|
-
declare function FactInspector({ report,
|
|
180
|
+
declare function FactInspector({ report, table, row, columnIndex, onClose }: FactInspectorProps): react.JSX.Element;
|
|
99
181
|
|
|
100
182
|
interface ReportViewProps {
|
|
101
183
|
report: NormalizedReport;
|
|
102
|
-
currencySymbol?: string;
|
|
103
184
|
/** Disable the click-to-inspect fact panel (render-only). */
|
|
104
185
|
inspect?: boolean;
|
|
186
|
+
/** Initial placement for dimension breakdowns (default `rows`). */
|
|
187
|
+
dimensionAxis?: 'rows' | 'columns';
|
|
105
188
|
}
|
|
106
|
-
declare function ReportView({ report,
|
|
189
|
+
declare function ReportView({ report, inspect, dimensionAxis }: ReportViewProps): react.JSX.Element;
|
|
107
190
|
|
|
108
191
|
interface StatementTableProps {
|
|
109
|
-
|
|
192
|
+
table: PivotTable;
|
|
193
|
+
/** The report's units, to resolve each cell's currency symbol. */
|
|
194
|
+
units?: Record<string, UnitInfo>;
|
|
110
195
|
/** Called when a value cell is clicked — drives fact inspection. */
|
|
111
|
-
onCellClick?: (row:
|
|
112
|
-
/** Currency symbol for values (default `$`). */
|
|
113
|
-
currencySymbol?: string;
|
|
196
|
+
onCellClick?: (row: PivotRow, columnIndex: number) => void;
|
|
114
197
|
/** The currently-selected cell, highlighted. */
|
|
115
198
|
selected?: {
|
|
116
|
-
|
|
199
|
+
rowKey: string;
|
|
117
200
|
columnIndex: number;
|
|
118
201
|
} | null;
|
|
202
|
+
/** Current dimension placement — set with `onDimensionPlacementChange` to show the toggle. */
|
|
203
|
+
dimensionPlacement?: 'rows' | 'columns';
|
|
204
|
+
/** Setter for the dimension placement; when provided (and the section is dimensional), a rows/columns toggle renders below the slicers. */
|
|
205
|
+
onDimensionPlacementChange?: (placement: 'rows' | 'columns') => void;
|
|
119
206
|
}
|
|
120
|
-
declare function StatementTable({
|
|
207
|
+
declare function StatementTable({ table, units, onCellClick, selected, dimensionPlacement, onDimensionPlacementChange, }: StatementTableProps): react.JSX.Element;
|
|
121
208
|
|
|
122
|
-
export { BLOCK_ORDER, BLOCK_TITLES, ElementInfo, FactInspector, type FactInspectorProps, type FootCheck, type FootTerm, NS, NormalizedReport, PeriodInfo, ReportView, type ReportViewProps,
|
|
209
|
+
export { BLOCK_ORDER, BLOCK_TITLES, ElementInfo, ExternalTextBlock, type ExternalTextBlockProps, FactInspector, type FactInspectorProps, type FootCheck, type FootTerm, InformationBlock, NS, NormalizedReport, NumericKind, PeriodInfo, PivotConfig, PivotRow, PivotTable, ReportView, type ReportViewProps, StatementTable, type StatementTableProps, UnitInfo, type ValueFormat, buildPivot, buildPivots, calcSubtotals, currencySymbolFor, defaultPivotConfig, footCheck, formatDate, formatMoney, formatPeriod, formatValue, humanize, humanizeDuration, isExternalFactUrl, numericKindOf, pivotDimensionsOn, presentationOrder, qname, reportSections, sliceReportSection };
|