@reportwright/engine 0.0.0-stage → 0.11.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/CHANGELOG.md +206 -0
- package/LICENSE +23 -0
- package/README.md +67 -2
- package/dist/index.js +20267 -0
- package/dist/index.js.map +6 -0
- package/dist/types/packages/engine/entry.d.ts +75 -0
- package/dist/types/src/designer/tableGen.d.ts +119 -0
- package/dist/types/src/engine/data/guard.d.ts +50 -0
- package/dist/types/src/engine/data/index.d.ts +120 -0
- package/dist/types/src/engine/data/odata.d.ts +35 -0
- package/dist/types/src/engine/data/xml.d.ts +108 -0
- package/dist/types/src/engine/expr/evaluate.d.ts +183 -0
- package/dist/types/src/engine/expr/format.d.ts +122 -0
- package/dist/types/src/engine/expr/javafmt.d.ts +26 -0
- package/dist/types/src/engine/expr/parser.d.ts +29 -0
- package/dist/types/src/engine/image.d.ts +107 -0
- package/dist/types/src/engine/index.d.ts +224 -0
- package/dist/types/src/engine/items/barcode.d.ts +121 -0
- package/dist/types/src/engine/items/cells.d.ts +11 -0
- package/dist/types/src/engine/items/chart-kit.d.ts +75 -0
- package/dist/types/src/engine/items/chart-more.d.ts +52 -0
- package/dist/types/src/engine/items/chart-round.d.ts +28 -0
- package/dist/types/src/engine/items/chart.d.ts +42 -0
- package/dist/types/src/engine/items/hpage.d.ts +33 -0
- package/dist/types/src/engine/items/index.d.ts +117 -0
- package/dist/types/src/engine/items/map.d.ts +11 -0
- package/dist/types/src/engine/items/paint.d.ts +138 -0
- package/dist/types/src/engine/items/pivot.d.ts +45 -0
- package/dist/types/src/engine/items/rich.d.ts +105 -0
- package/dist/types/src/engine/items/toc.d.ts +10 -0
- package/dist/types/src/engine/items/visuals.d.ts +5 -0
- package/dist/types/src/engine/layout.d.ts +24 -0
- package/dist/types/src/engine/paginate/index.d.ts +17 -0
- package/dist/types/src/engine/reuse.d.ts +120 -0
- package/dist/types/src/engine/schema/report.schema.d.ts +2421 -0
- package/dist/types/src/engine/schema/template.d.ts +212 -0
- package/dist/types/src/engine/schema/validate.d.ts +21 -0
- package/dist/types/src/engine/style.d.ts +70 -0
- package/dist/types/src/engine/text/fonts.d.ts +96 -0
- package/dist/types/src/engine/text/measure.d.ts +145 -0
- package/dist/types/src/engine/text/rich.d.ts +48 -0
- package/dist/types/src/engine/text/shaper.d.ts +20 -0
- package/dist/types/src/engine/units.d.ts +53 -0
- package/dist/types/src/engine/url.d.ts +23 -0
- package/dist/types/src/exporters/color.d.ts +9 -0
- package/dist/types/src/exporters/csv.d.ts +44 -0
- package/dist/types/src/exporters/deadline.d.ts +6 -0
- package/dist/types/src/exporters/docx.d.ts +19 -0
- package/dist/types/src/exporters/encrypt.d.ts +39 -0
- package/dist/types/src/exporters/figures.d.ts +112 -0
- package/dist/types/src/exporters/html.d.ts +24 -0
- package/dist/types/src/exporters/htmldata.d.ts +32 -0
- package/dist/types/src/exporters/pdf.d.ts +45 -0
- package/dist/types/src/exporters/pdfa.d.ts +31 -0
- package/dist/types/src/exporters/pdfua.d.ts +17 -0
- package/dist/types/src/exporters/png.d.ts +10 -0
- package/dist/types/src/exporters/pptx.d.ts +14 -0
- package/dist/types/src/exporters/regions.d.ts +30 -0
- package/dist/types/src/exporters/subset.d.ts +5 -0
- package/dist/types/src/exporters/svg.d.ts +26 -0
- package/dist/types/src/exporters/svgimage.d.ts +33 -0
- package/dist/types/src/exporters/xlsx.d.ts +61 -0
- package/dist/types/src/exporters/xlsxchart.d.ts +26 -0
- package/dist/types/src/exporters/xlsxwriter.d.ts +83 -0
- package/dist/types/src/importers/xml.d.ts +34 -0
- package/index.d.ts +3 -0
- package/package.json +78 -4
- package/pool/index.d.ts +23 -0
- package/pool/index.js +85 -0
- package/pool/worker.js +27 -0
- package/report.d.ts +638 -0
- package/schema.json +2517 -0
package/report.d.ts
ADDED
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
// Types for a ReportWright report definition (pagewright/report@1), the JSON that render() takes.
|
|
2
|
+
// GENERATED from src/engine/schema/report.schema.js by scripts/gen-report-types.mjs: do not edit by hand.
|
|
3
|
+
// The same schema is published as @reportwright/engine/schema.json, and validate() checks against it.
|
|
4
|
+
// Any value marked Expr may be a literal or an expression string starting with "=" (e.g. "=Fields.amount").
|
|
5
|
+
|
|
6
|
+
/** A literal value or an expression ("=Sum(Fields.amount)"). */
|
|
7
|
+
export type Expr<T = string | number | boolean> = T | `=${string}`;
|
|
8
|
+
/** Text and box style. Values may also be expressions. Unknown keys are allowed (newer engine versions add more). */
|
|
9
|
+
export interface Style {
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
fontSize?: number | string;
|
|
12
|
+
fontWeight?: 'normal' | 'bold' | number | string;
|
|
13
|
+
fontStyle?: 'normal' | 'italic' | string;
|
|
14
|
+
color?: string;
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
backgroundImage?: string;
|
|
17
|
+
backgroundFit?: 'contain' | 'cover' | 'fill' | string;
|
|
18
|
+
textAlign?: 'left' | 'center' | 'right' | 'justify' | 'auto' | string;
|
|
19
|
+
verticalAlign?: 'top' | 'middle' | 'bottom' | string;
|
|
20
|
+
textDecoration?: string;
|
|
21
|
+
lineHeight?: number | string;
|
|
22
|
+
padding?: number | [number, number, number, number] | string;
|
|
23
|
+
border?: string;
|
|
24
|
+
borderTop?: string;
|
|
25
|
+
borderRight?: string;
|
|
26
|
+
borderBottom?: string;
|
|
27
|
+
borderLeft?: string;
|
|
28
|
+
format?: string;
|
|
29
|
+
writingMode?: string;
|
|
30
|
+
stroke?: string;
|
|
31
|
+
strokeWidth?: number | string;
|
|
32
|
+
strokeDash?: string;
|
|
33
|
+
fill?: string;
|
|
34
|
+
radius?: number | string;
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
/** What a click does: open a URL, drill to another report, jump to a bookmark, or set parameters and run again. */
|
|
38
|
+
export type Action = {
|
|
39
|
+
type: 'none';
|
|
40
|
+
} | {
|
|
41
|
+
type: 'url';
|
|
42
|
+
url: Expr<string>;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'report';
|
|
45
|
+
report: Expr<string>;
|
|
46
|
+
params?: Record<string, Expr>;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'bookmark';
|
|
49
|
+
target: Expr<string>;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'params';
|
|
52
|
+
params: Record<string, Expr>;
|
|
53
|
+
toggle?: boolean;
|
|
54
|
+
};
|
|
55
|
+
interface ItemBase {
|
|
56
|
+
id?: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
w: number;
|
|
61
|
+
h: number;
|
|
62
|
+
style?: Style;
|
|
63
|
+
styleName?: string;
|
|
64
|
+
hidden?: Expr<boolean>;
|
|
65
|
+
dataSet?: string | null;
|
|
66
|
+
/** alternative text for screen readers (accessible PDF, Word, HTML) */
|
|
67
|
+
alt?: string;
|
|
68
|
+
keepTogether?: boolean;
|
|
69
|
+
pageBreakBefore?: boolean;
|
|
70
|
+
pageBreakAfter?: boolean;
|
|
71
|
+
bookmark?: Expr<string>;
|
|
72
|
+
tooltip?: Expr<string>;
|
|
73
|
+
action?: Action;
|
|
74
|
+
}
|
|
75
|
+
export interface TextBox extends ItemBase {
|
|
76
|
+
type: 'textbox';
|
|
77
|
+
value?: Expr;
|
|
78
|
+
canGrow?: boolean;
|
|
79
|
+
canShrink?: boolean;
|
|
80
|
+
shrinkToFit?: boolean;
|
|
81
|
+
minFontSize?: number;
|
|
82
|
+
shrinkStep?: number;
|
|
83
|
+
rotate?: number;
|
|
84
|
+
/** 1–6: listed by a table of contents with source "headings" */
|
|
85
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6';
|
|
86
|
+
/** text direction: auto (default) from the first strong character */
|
|
87
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
88
|
+
}
|
|
89
|
+
export interface RichText extends ItemBase {
|
|
90
|
+
type: 'richtext';
|
|
91
|
+
value?: string;
|
|
92
|
+
htmlFromData?: boolean;
|
|
93
|
+
canGrow?: boolean;
|
|
94
|
+
canShrink?: boolean;
|
|
95
|
+
listIndent?: number;
|
|
96
|
+
paragraphSpacing?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface Image extends ItemBase {
|
|
99
|
+
type: 'image';
|
|
100
|
+
/** URL, data URI, "embedded:name" (the report's images), or a field holding base64 text or bytes */
|
|
101
|
+
src?: Expr<string>;
|
|
102
|
+
fit?: 'contain' | 'cover' | 'fill' | 'clip';
|
|
103
|
+
/** size the box to the image (96 dpi); data and embedded images only */
|
|
104
|
+
autoSize?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface Line extends ItemBase {
|
|
107
|
+
type: 'line';
|
|
108
|
+
direction?: 'down' | 'up';
|
|
109
|
+
}
|
|
110
|
+
export interface Shape extends ItemBase {
|
|
111
|
+
type: 'shape';
|
|
112
|
+
shape?: 'rect' | 'ellipse';
|
|
113
|
+
}
|
|
114
|
+
/** One sort key: the rows (or groups) are ordered by by, ascending or descending. */
|
|
115
|
+
export interface SortSpec {
|
|
116
|
+
/** the expression to sort by, e.g. =Fields.name */
|
|
117
|
+
by: Expr;
|
|
118
|
+
/** asc (default) or desc */
|
|
119
|
+
dir?: 'asc' | 'desc';
|
|
120
|
+
}
|
|
121
|
+
export interface TableCell {
|
|
122
|
+
value?: Expr;
|
|
123
|
+
/** a header cell's interactive sort: the viewer orders the rows by this expression when the header is clicked */
|
|
124
|
+
sortBy?: Expr;
|
|
125
|
+
style?: Style;
|
|
126
|
+
/** columns this cell spans. Either list one entry per column (null under the span), or omit the spanned cells (RDL/HTML style: a row with fewer cells than columns) */
|
|
127
|
+
colSpan?: number;
|
|
128
|
+
/** merged down over this many rows of the same band (header, a group's rows, one record's detail rows, footer) */
|
|
129
|
+
rowSpan?: number;
|
|
130
|
+
/** an item laid out inside the cell, scoped to the row (a related data set gets that row's children) */
|
|
131
|
+
item?: Item;
|
|
132
|
+
action?: Action;
|
|
133
|
+
[key: string]: unknown;
|
|
134
|
+
}
|
|
135
|
+
export interface TableRow {
|
|
136
|
+
cells: (TableCell | null)[];
|
|
137
|
+
height?: number;
|
|
138
|
+
style?: Style;
|
|
139
|
+
[key: string]: unknown;
|
|
140
|
+
}
|
|
141
|
+
export interface TableGroup {
|
|
142
|
+
expr: string;
|
|
143
|
+
name?: string;
|
|
144
|
+
header?: TableRow[];
|
|
145
|
+
footer?: TableRow[];
|
|
146
|
+
/** orders the groups by their value (asc or desc); sortBy orders them by an expression */
|
|
147
|
+
sort?: 'asc' | 'desc' | 'none';
|
|
148
|
+
/** orders the groups by this expression, evaluated in each group's scope (e.g. =Sum(Fields.amount)); the interactive sort on a header wins */
|
|
149
|
+
sortBy?: Expr;
|
|
150
|
+
pageBreak?: string;
|
|
151
|
+
collapsible?: boolean;
|
|
152
|
+
initiallyCollapsed?: boolean;
|
|
153
|
+
/** recursive hierarchy: the parent's id; expr is the node's id. Level() is the depth. */
|
|
154
|
+
parent?: Expr;
|
|
155
|
+
indent?: number;
|
|
156
|
+
expandLevels?: number;
|
|
157
|
+
/** each instance starts on a new page and restarts Globals.PageNumber / TotalPages */
|
|
158
|
+
newSection?: boolean;
|
|
159
|
+
[key: string]: unknown;
|
|
160
|
+
}
|
|
161
|
+
export interface Table extends ItemBase {
|
|
162
|
+
type: 'table';
|
|
163
|
+
columns: {
|
|
164
|
+
width: number;
|
|
165
|
+
[key: string]: unknown;
|
|
166
|
+
}[];
|
|
167
|
+
header?: TableRow[];
|
|
168
|
+
groups?: TableGroup[];
|
|
169
|
+
detail?: TableRow[];
|
|
170
|
+
footer?: TableRow[];
|
|
171
|
+
repeatHeader?: boolean;
|
|
172
|
+
/** Default true: a group of four or more rows never leaves one of its rows alone at a page foot or head, and a group of two or three rows that fits a page moves whole to the next page. false lets a break fall anywhere inside a group. */
|
|
173
|
+
widowControl?: boolean;
|
|
174
|
+
/** Column widths from the content: the header, the first 50 rows and the footer, in proportion, filling the table's width. Columns without a width are measured anyway. */
|
|
175
|
+
fitColumns?: boolean;
|
|
176
|
+
noRowsText?: string;
|
|
177
|
+
/** rows ordered by these entries, in order */
|
|
178
|
+
sort?: SortSpec[];
|
|
179
|
+
filters?: unknown[];
|
|
180
|
+
/** the footer at the bottom of the page the table ends on */
|
|
181
|
+
printAtBottom?: boolean;
|
|
182
|
+
/** wider than the page: continue on the next page set, repeating the first repeatColumns columns */
|
|
183
|
+
overflow?: 'clip' | 'paginate' | 'shrink';
|
|
184
|
+
repeatColumns?: number;
|
|
185
|
+
pageOrder?: 'down' | 'across';
|
|
186
|
+
/** fixed frame: continue rows in */
|
|
187
|
+
overflowTo?: string;
|
|
188
|
+
}
|
|
189
|
+
export interface Container extends ItemBase {
|
|
190
|
+
type: 'container';
|
|
191
|
+
items: Item[];
|
|
192
|
+
}
|
|
193
|
+
export interface List extends ItemBase {
|
|
194
|
+
type: 'list';
|
|
195
|
+
items: Item[];
|
|
196
|
+
groupBy?: Expr<string>;
|
|
197
|
+
pageBreakBetween?: boolean;
|
|
198
|
+
/** rows ordered by these entries, in order */
|
|
199
|
+
sort?: SortSpec[];
|
|
200
|
+
filters?: unknown[];
|
|
201
|
+
/** records across (a grid list) */
|
|
202
|
+
columns?: number;
|
|
203
|
+
columnGap?: number;
|
|
204
|
+
newSection?: boolean;
|
|
205
|
+
/** a new group at every change (not sorted) */
|
|
206
|
+
groupAdjacent?: boolean;
|
|
207
|
+
/** rows of the enclosing list row */
|
|
208
|
+
inheritRows?: boolean;
|
|
209
|
+
}
|
|
210
|
+
export interface CheckBox extends ItemBase {
|
|
211
|
+
type: 'checkbox';
|
|
212
|
+
value?: Expr<boolean>;
|
|
213
|
+
text?: Expr<string>;
|
|
214
|
+
}
|
|
215
|
+
export interface ChartAxis {
|
|
216
|
+
title?: string;
|
|
217
|
+
format?: string;
|
|
218
|
+
min?: number;
|
|
219
|
+
max?: number;
|
|
220
|
+
log?: boolean;
|
|
221
|
+
gridlines?: boolean;
|
|
222
|
+
/** category axis only: turn the labels, e.g. -45 */
|
|
223
|
+
labelAngle?: number;
|
|
224
|
+
reversed?: boolean;
|
|
225
|
+
}
|
|
226
|
+
export interface ChartSeries {
|
|
227
|
+
name?: string;
|
|
228
|
+
value?: Expr;
|
|
229
|
+
color?: string;
|
|
230
|
+
/** combo charts: draw this series as columns, a line or an area */
|
|
231
|
+
type?: 'column' | 'bar' | 'line' | 'area';
|
|
232
|
+
axis?: 'primary' | 'secondary';
|
|
233
|
+
/** a range series (low + high), or with open + close a candlestick / OHLC series */
|
|
234
|
+
low?: Expr;
|
|
235
|
+
high?: Expr;
|
|
236
|
+
open?: Expr;
|
|
237
|
+
close?: Expr;
|
|
238
|
+
/** bubble size, per row */
|
|
239
|
+
size?: Expr;
|
|
240
|
+
line?: 'straight' | 'smooth' | 'step';
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
export type ChartOverlay = {
|
|
244
|
+
type: 'trend';
|
|
245
|
+
kind?: 'linear' | 'exp' | 'poly';
|
|
246
|
+
order?: number;
|
|
247
|
+
series?: number;
|
|
248
|
+
color?: string;
|
|
249
|
+
label?: string;
|
|
250
|
+
} | {
|
|
251
|
+
type: 'movingAverage';
|
|
252
|
+
period?: number;
|
|
253
|
+
series?: number;
|
|
254
|
+
color?: string;
|
|
255
|
+
label?: string;
|
|
256
|
+
} | {
|
|
257
|
+
type: 'line';
|
|
258
|
+
value: number | Expr;
|
|
259
|
+
axis?: 'primary' | 'secondary';
|
|
260
|
+
color?: string;
|
|
261
|
+
label?: string;
|
|
262
|
+
showValue?: boolean;
|
|
263
|
+
} | {
|
|
264
|
+
type: 'band';
|
|
265
|
+
from: number | Expr;
|
|
266
|
+
to: number | Expr;
|
|
267
|
+
axis?: 'primary' | 'secondary';
|
|
268
|
+
color?: string;
|
|
269
|
+
label?: string;
|
|
270
|
+
};
|
|
271
|
+
export type ChartPalette = 'default' | 'office' | 'colorblind' | 'vivid' | 'pastel' | 'ocean' | 'sunset' | 'forest' | 'berry' | 'earth' | 'grayscale' | 'highContrast';
|
|
272
|
+
export interface Chart extends ItemBase {
|
|
273
|
+
type: 'chart';
|
|
274
|
+
chartType?: 'column' | 'bar' | 'line' | 'area' | 'pie' | 'donut' | 'scatter' | 'bubble' | 'radar' | 'polar' | 'candlestick' | 'ohlc' | 'gauge' | 'funnel' | 'treemap' | 'histogram' | 'boxplot' | 'waterfall' | 'gantt';
|
|
275
|
+
title?: Expr<string>;
|
|
276
|
+
category?: Expr<string>;
|
|
277
|
+
categorySort?: 'asc' | 'desc';
|
|
278
|
+
categoryFormat?: string;
|
|
279
|
+
series?: ChartSeries[];
|
|
280
|
+
seriesGroup?: Expr<string>;
|
|
281
|
+
stacked?: boolean | 'percent';
|
|
282
|
+
showValues?: boolean;
|
|
283
|
+
valueFormat?: string;
|
|
284
|
+
legend?: 'bottom' | 'none';
|
|
285
|
+
xValue?: Expr;
|
|
286
|
+
pointAction?: Action;
|
|
287
|
+
pointColor?: Expr<string>;
|
|
288
|
+
tooltips?: boolean;
|
|
289
|
+
xTitle?: string;
|
|
290
|
+
fontSize?: number;
|
|
291
|
+
background?: string;
|
|
292
|
+
maxCategories?: number;
|
|
293
|
+
/** Scatter and bubble. clip: the axes stop at the 1st and 99th percentiles; points beyond are drawn at the edge with a ring and a warning. none: the full range. Unset: clip when 20 or more points have an extreme spread (full range over 5x the 1st-99th percentile range), else none */
|
|
294
|
+
outliers?: 'clip' | 'none';
|
|
295
|
+
line?: 'straight' | 'smooth' | 'step';
|
|
296
|
+
axes?: {
|
|
297
|
+
x?: ChartAxis;
|
|
298
|
+
y?: ChartAxis;
|
|
299
|
+
y2?: ChartAxis;
|
|
300
|
+
};
|
|
301
|
+
overlays?: ChartOverlay[];
|
|
302
|
+
/** {value} {category} {series} {percent}, or an =expression in the point's scope */
|
|
303
|
+
labelTemplate?: string;
|
|
304
|
+
labelPosition?: 'outside' | 'inside' | 'center';
|
|
305
|
+
palette?: ChartPalette | string[];
|
|
306
|
+
/** opt-in: each category (pie, donut, funnel slices; seriesGroup series) keeps one colour in every chart of the report that sets it; off: colours by position */
|
|
307
|
+
colorByCategory?: boolean;
|
|
308
|
+
/** viewer only; exports stay static */
|
|
309
|
+
animation?: 'none' | 'grow' | 'fade';
|
|
310
|
+
upColor?: string;
|
|
311
|
+
downColor?: string;
|
|
312
|
+
/** number of bins (empty: automatic) */
|
|
313
|
+
binCount?: number;
|
|
314
|
+
/** bin width (instead of a number of bins) */
|
|
315
|
+
binWidth?: number;
|
|
316
|
+
/** mark the mean */
|
|
317
|
+
showMean?: boolean;
|
|
318
|
+
/** subtotal bar when (e.g. =Fields.isTotal) */
|
|
319
|
+
waterfallTotals?: Expr;
|
|
320
|
+
/** total bar at the end */
|
|
321
|
+
showTotal?: boolean;
|
|
322
|
+
/** total bar label */
|
|
323
|
+
totalLabel?: string;
|
|
324
|
+
/** total colour */
|
|
325
|
+
totalColor?: string;
|
|
326
|
+
/** bar start (date or number) */
|
|
327
|
+
ganttStart?: Expr;
|
|
328
|
+
/** bar end (date or number) */
|
|
329
|
+
ganttEnd?: Expr;
|
|
330
|
+
/** today line */
|
|
331
|
+
ganttToday?: boolean;
|
|
332
|
+
/** today line colour */
|
|
333
|
+
todayColor?: string;
|
|
334
|
+
/** gauge shape */
|
|
335
|
+
gaugeShape?: 'half' | 'threeQuarter' | 'full';
|
|
336
|
+
/** value shown by */
|
|
337
|
+
gaugeIndicator?: 'needle' | 'pointer' | 'bar';
|
|
338
|
+
/** needle or pointer colour */
|
|
339
|
+
pointerColor?: string;
|
|
340
|
+
/** tick marks and values */
|
|
341
|
+
gaugeTicks?: boolean;
|
|
342
|
+
}
|
|
343
|
+
export interface FormField extends ItemBase {
|
|
344
|
+
type: 'field';
|
|
345
|
+
kind?: 'text' | 'multiline' | 'checkbox' | 'choice';
|
|
346
|
+
fieldName?: Expr<string>;
|
|
347
|
+
value?: Expr;
|
|
348
|
+
options?: Expr;
|
|
349
|
+
required?: boolean;
|
|
350
|
+
readOnly?: boolean;
|
|
351
|
+
}
|
|
352
|
+
export interface MapItem extends ItemBase {
|
|
353
|
+
type: 'map';
|
|
354
|
+
geojson?: string;
|
|
355
|
+
geometry?: Expr;
|
|
356
|
+
shapeKey?: Expr<string>;
|
|
357
|
+
valueDataSet?: string;
|
|
358
|
+
valueKey?: Expr<string>;
|
|
359
|
+
value?: Expr<number>;
|
|
360
|
+
valueFormat?: string;
|
|
361
|
+
colorLow?: string;
|
|
362
|
+
colorHigh?: string;
|
|
363
|
+
legend?: 'bottom' | 'none';
|
|
364
|
+
pointDataSet?: string;
|
|
365
|
+
lat?: Expr<number>;
|
|
366
|
+
lon?: Expr<number>;
|
|
367
|
+
pointSize?: Expr<number>;
|
|
368
|
+
pointLabel?: Expr<string>;
|
|
369
|
+
pointColor?: string;
|
|
370
|
+
/** colour scale */
|
|
371
|
+
colorScale?: 'continuous' | 'classes';
|
|
372
|
+
/** number of classes (2–9) */
|
|
373
|
+
classes?: number;
|
|
374
|
+
/** lines: colour (LineString shapes) */
|
|
375
|
+
lineColor?: string;
|
|
376
|
+
/** lines: width (pt) */
|
|
377
|
+
lineWidth?: number;
|
|
378
|
+
/** click on a region */
|
|
379
|
+
regionAction?: Action;
|
|
380
|
+
/** tooltips on hover */
|
|
381
|
+
tooltips?: boolean;
|
|
382
|
+
}
|
|
383
|
+
export interface Sparkline extends Omit<ItemBase, 'style'> {
|
|
384
|
+
type: 'sparkline';
|
|
385
|
+
category?: Expr;
|
|
386
|
+
value?: Expr<number>;
|
|
387
|
+
color?: string;
|
|
388
|
+
style?: 'line' | 'column' | 'area' | 'winloss';
|
|
389
|
+
bandLow?: Expr<number>;
|
|
390
|
+
bandHigh?: Expr<number>;
|
|
391
|
+
bandColor?: string;
|
|
392
|
+
negColor?: string;
|
|
393
|
+
/** data bars: the colour of a bar with a negative value (default #dc2626) */
|
|
394
|
+
negativeColor?: string;
|
|
395
|
+
}
|
|
396
|
+
export interface DataBar extends ItemBase {
|
|
397
|
+
type: 'databar';
|
|
398
|
+
value?: Expr<number>;
|
|
399
|
+
max?: Expr<number>;
|
|
400
|
+
color?: string;
|
|
401
|
+
/** the colour of a bar with a negative value (default #dc2626) */
|
|
402
|
+
negativeColor?: string;
|
|
403
|
+
}
|
|
404
|
+
export interface Bullet extends ItemBase {
|
|
405
|
+
type: 'bullet';
|
|
406
|
+
value?: Expr<number>;
|
|
407
|
+
max?: Expr<number>;
|
|
408
|
+
target?: Expr<number>;
|
|
409
|
+
color?: string;
|
|
410
|
+
}
|
|
411
|
+
export interface IconSet extends ItemBase {
|
|
412
|
+
type: 'iconset';
|
|
413
|
+
value?: Expr<number>;
|
|
414
|
+
iconSet?: 'trafficLights' | 'arrows' | 'symbols' | 'flags' | 'ratings';
|
|
415
|
+
lower?: Expr<number>;
|
|
416
|
+
upper?: Expr<number>;
|
|
417
|
+
/** reverse order (higher is worse) */
|
|
418
|
+
reverse?: boolean;
|
|
419
|
+
}
|
|
420
|
+
export interface RangeBar extends ItemBase {
|
|
421
|
+
type: 'rangebar';
|
|
422
|
+
low?: Expr<number>;
|
|
423
|
+
high?: Expr<number>;
|
|
424
|
+
min?: Expr<number>;
|
|
425
|
+
max?: Expr<number>;
|
|
426
|
+
color?: string;
|
|
427
|
+
}
|
|
428
|
+
export interface Barcode extends ItemBase {
|
|
429
|
+
type: 'barcode';
|
|
430
|
+
/** a bwip-js id: code128, qrcode, datamatrix, pdf417, ean13, gs1-128, … */
|
|
431
|
+
symbology?: string;
|
|
432
|
+
value?: Expr<string>;
|
|
433
|
+
showText?: boolean;
|
|
434
|
+
captionPosition?: 'below' | 'above';
|
|
435
|
+
/** points of white around the code */
|
|
436
|
+
quietZone?: number;
|
|
437
|
+
rotate?: 0 | 90 | 180 | 270 | '0' | '90' | '180' | '270';
|
|
438
|
+
qrErrorLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
439
|
+
qrVersion?: number;
|
|
440
|
+
qrMask?: number;
|
|
441
|
+
dmShape?: 'square' | 'rectangle';
|
|
442
|
+
dmSize?: string;
|
|
443
|
+
pdfColumns?: number;
|
|
444
|
+
pdfRows?: number;
|
|
445
|
+
pdfErrorLevel?: number;
|
|
446
|
+
pdfCompact?: boolean;
|
|
447
|
+
aztecLayers?: number;
|
|
448
|
+
aztecErrorPercent?: number;
|
|
449
|
+
maxiMode?: number;
|
|
450
|
+
checkDigit?: boolean;
|
|
451
|
+
barRatio?: number;
|
|
452
|
+
}
|
|
453
|
+
export interface PivotGroup {
|
|
454
|
+
expr: Expr;
|
|
455
|
+
name?: string;
|
|
456
|
+
label?: Expr<string>;
|
|
457
|
+
format?: string;
|
|
458
|
+
sort?: 'asc' | 'desc' | 'none';
|
|
459
|
+
sortBy?: Expr;
|
|
460
|
+
/** a total of this group's instances inside the group above (the first group's total is the grand total) */
|
|
461
|
+
total?: 'none' | 'before' | 'after';
|
|
462
|
+
totalLabel?: string;
|
|
463
|
+
collapsible?: boolean;
|
|
464
|
+
initiallyCollapsed?: boolean;
|
|
465
|
+
/** row groups: the header column's width and title */
|
|
466
|
+
width?: number;
|
|
467
|
+
header?: string;
|
|
468
|
+
style?: Style;
|
|
469
|
+
}
|
|
470
|
+
export interface PivotValue {
|
|
471
|
+
value: Expr;
|
|
472
|
+
name?: string;
|
|
473
|
+
label?: string;
|
|
474
|
+
format?: string;
|
|
475
|
+
show?: 'value' | 'percentOfTotal' | 'percentOfRow' | 'percentOfColumn';
|
|
476
|
+
width?: number;
|
|
477
|
+
style?: Style;
|
|
478
|
+
}
|
|
479
|
+
export interface Matrix extends ItemBase {
|
|
480
|
+
type: 'matrix';
|
|
481
|
+
/** the tablix form: nested row and column groups, several values */
|
|
482
|
+
rowGroups?: PivotGroup[];
|
|
483
|
+
columnGroups?: PivotGroup[];
|
|
484
|
+
values?: PivotValue[];
|
|
485
|
+
overflow?: 'paginate' | 'shrink' | 'clip';
|
|
486
|
+
pageOrder?: 'down' | 'across';
|
|
487
|
+
/** the older single-group form (still read when the arrays are absent) */
|
|
488
|
+
rowGroup?: Expr<string>;
|
|
489
|
+
columnGroup?: Expr<string>;
|
|
490
|
+
value?: Expr;
|
|
491
|
+
valueFormat?: string;
|
|
492
|
+
rowSort?: 'asc' | 'desc' | 'none';
|
|
493
|
+
columnSort?: 'asc' | 'desc' | 'none';
|
|
494
|
+
rowTotals?: boolean;
|
|
495
|
+
columnTotals?: boolean;
|
|
496
|
+
corner?: string;
|
|
497
|
+
rowHeaderWidth?: number;
|
|
498
|
+
columnWidth?: number;
|
|
499
|
+
repeatHeader?: boolean;
|
|
500
|
+
headerStyle?: Style;
|
|
501
|
+
cellStyle?: Style;
|
|
502
|
+
totalStyle?: Style;
|
|
503
|
+
}
|
|
504
|
+
export interface Subreport extends ItemBase {
|
|
505
|
+
type: 'subreport';
|
|
506
|
+
report: string;
|
|
507
|
+
params?: Record<string, Expr>;
|
|
508
|
+
}
|
|
509
|
+
export interface TableOfContents extends ItemBase {
|
|
510
|
+
type: 'toc';
|
|
511
|
+
title?: string;
|
|
512
|
+
levels?: number;
|
|
513
|
+
/** bookmarks (default) or text boxes with a headingLevel */
|
|
514
|
+
source?: 'bookmarks' | 'headings';
|
|
515
|
+
/** decimal, roman or alpha; one per level as an array or "roman,alpha" (the last repeats) */
|
|
516
|
+
numbering?: string | ('decimal' | 'roman' | 'alpha')[];
|
|
517
|
+
}
|
|
518
|
+
export type Item = TextBox | RichText | Image | Line | Shape | Table | Container | List | CheckBox | Chart | FormField | MapItem | Sparkline | DataBar | Bullet | IconSet | RangeBar | Barcode | Matrix | Subreport | TableOfContents;
|
|
519
|
+
export type ItemType = Item['type'];
|
|
520
|
+
export interface Band {
|
|
521
|
+
height?: number;
|
|
522
|
+
items: Item[];
|
|
523
|
+
printOnFirstPage?: boolean;
|
|
524
|
+
printOnLastPage?: boolean;
|
|
525
|
+
columns?: {
|
|
526
|
+
count: number;
|
|
527
|
+
gap?: number;
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
/** A body section with its own page settings (missing keys come from the report's page). */
|
|
531
|
+
export interface BodySection extends Band {
|
|
532
|
+
name?: string;
|
|
533
|
+
page?: Report['page'];
|
|
534
|
+
}
|
|
535
|
+
export interface Field {
|
|
536
|
+
name: string;
|
|
537
|
+
/** 'string' keeps text as text: an ISO date string in it is not turned into a date */
|
|
538
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'datetime';
|
|
539
|
+
path?: string;
|
|
540
|
+
expr?: string;
|
|
541
|
+
}
|
|
542
|
+
export interface Parameter {
|
|
543
|
+
name: string;
|
|
544
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'datetime';
|
|
545
|
+
prompt?: string;
|
|
546
|
+
default?: unknown;
|
|
547
|
+
required?: boolean;
|
|
548
|
+
multi?: boolean;
|
|
549
|
+
hidden?: boolean;
|
|
550
|
+
options?: (string | number | { value: unknown; label?: string })[];
|
|
551
|
+
optionsFrom?: {
|
|
552
|
+
dataSet: string;
|
|
553
|
+
value: string;
|
|
554
|
+
label?: string;
|
|
555
|
+
};
|
|
556
|
+
editor?: string;
|
|
557
|
+
[key: string]: unknown;
|
|
558
|
+
}
|
|
559
|
+
export type DataSource = {
|
|
560
|
+
name: string;
|
|
561
|
+
type: 'json';
|
|
562
|
+
data: unknown;
|
|
563
|
+
} | {
|
|
564
|
+
name: string;
|
|
565
|
+
type: 'csv';
|
|
566
|
+
data?: string;
|
|
567
|
+
url?: string;
|
|
568
|
+
[key: string]: unknown;
|
|
569
|
+
} | {
|
|
570
|
+
name: string;
|
|
571
|
+
type: 'rest' | 'graphql';
|
|
572
|
+
url: string;
|
|
573
|
+
method?: string;
|
|
574
|
+
headers?: Record<string, string>;
|
|
575
|
+
query?: string;
|
|
576
|
+
[key: string]: unknown;
|
|
577
|
+
} | {
|
|
578
|
+
name: string;
|
|
579
|
+
type: 'sql';
|
|
580
|
+
connection: string;
|
|
581
|
+
query: string;
|
|
582
|
+
[key: string]: unknown;
|
|
583
|
+
};
|
|
584
|
+
export interface DataSet {
|
|
585
|
+
name: string;
|
|
586
|
+
source: string;
|
|
587
|
+
path?: string;
|
|
588
|
+
/** false: strings that look like ISO dates stay text (default true: they become dates when fields are detected) */
|
|
589
|
+
detectDates?: boolean;
|
|
590
|
+
/** the fields, typed; none: detected from the rows */
|
|
591
|
+
fields?: Field[];
|
|
592
|
+
filters?: unknown[];
|
|
593
|
+
/** rows ordered by these entries, in order */
|
|
594
|
+
sort?: SortSpec[];
|
|
595
|
+
[key: string]: unknown;
|
|
596
|
+
}
|
|
597
|
+
/** A ReportWright report definition (pagewright/report@1).
|
|
598
|
+
* @example
|
|
599
|
+
* {"$schema":"pagewright/report@1","name":"Invoice","page":{"size":"A4","margins":[36,36,36,36]},"dataSources":[{"name":"orders","type":"json","data":{"rows":[{"customer":"Asha Rao","amount":1200.5}]}}],"dataSets":[{"name":"Rows","source":"orders","path":"$.rows"}],"sections":{"body":{"items":[{"type":"textbox","name":"Title","x":0,"y":0,"w":300,"h":24,"value":"Invoice","style":{"fontSize":18,"fontWeight":"bold"}},{"type":"table","name":"Lines","x":0,"y":40,"w":400,"h":40,"dataSet":"Rows","columns":[{"width":250},{"width":150}],"header":[{"height":18,"cells":[{"value":"Customer","colSpan":1},{"value":"Amount"}]}],"detail":[{"height":18,"cells":[{"value":"=Fields.customer"},{"value":"=Fields.amount","style":{"format":"C2"}}]}],"footer":[{"height":18,"cells":[{"value":"Total","colSpan":2}]}]}]}}}
|
|
600
|
+
*/
|
|
601
|
+
export interface Report {
|
|
602
|
+
/** pagewright/report@1; reportwright/report@1 is the same format under the new name. */
|
|
603
|
+
$schema: 'pagewright/report@1' | 'reportwright/report@1';
|
|
604
|
+
name?: string;
|
|
605
|
+
description?: string;
|
|
606
|
+
locale?: string;
|
|
607
|
+
/** ISO 4217 code for C formats; none: the locale's own currency (en-IN: INR) */
|
|
608
|
+
currency?: string;
|
|
609
|
+
/** how Infinity and NaN (1/0, 0/0) print: as SSRS (default), blank, or #Error */
|
|
610
|
+
nonFinite?: 'blank' | 'error';
|
|
611
|
+
/** digit grouping of numbers: as the locale's rule (default, Intl/CLDR: es-ES 1234,50), always, or never */
|
|
612
|
+
grouping?: 'always' | 'never';
|
|
613
|
+
page?: {
|
|
614
|
+
size?: 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'Pageless' | string | [number, number];
|
|
615
|
+
orientation?: 'portrait' | 'landscape';
|
|
616
|
+
/** top, right, bottom, left in points */
|
|
617
|
+
margins?: [number, number, number, number] | number;
|
|
618
|
+
width?: number;
|
|
619
|
+
height?: number;
|
|
620
|
+
[key: string]: unknown;
|
|
621
|
+
};
|
|
622
|
+
parameters?: Parameter[];
|
|
623
|
+
parameterLayout?: unknown;
|
|
624
|
+
liveParameters?: boolean;
|
|
625
|
+
dataSources?: DataSource[];
|
|
626
|
+
dataSets?: DataSet[];
|
|
627
|
+
styles?: {
|
|
628
|
+
base?: Style;
|
|
629
|
+
named?: Record<string, Style>;
|
|
630
|
+
};
|
|
631
|
+
/** images the report carries, by name, as data:image/… URIs; an image's src "embedded:<name>" uses one */
|
|
632
|
+
images?: Record<string, `data:image/${string}`>;
|
|
633
|
+
sections: {
|
|
634
|
+
pageHeader?: Band;
|
|
635
|
+
body: Band | BodySection[];
|
|
636
|
+
pageFooter?: Band;
|
|
637
|
+
};
|
|
638
|
+
}
|