@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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The markup of a rich text value. Only the literal markup the author typed is HTML. Everything that comes
|
|
3
|
+
* from evaluation (a {Fields.x} part of a template, or the result of a value that is one =expression) is
|
|
4
|
+
* escaped and shows as text, unless the item sets `htmlFromData: true` (HTML stored in trusted data); then
|
|
5
|
+
* it is parsed too, through the same allow-list.
|
|
6
|
+
* @param {any} v @param {any} ctx @param {boolean} [htmlFromData]
|
|
7
|
+
*/
|
|
8
|
+
export function richValue(v: any, ctx: any, htmlFromData?: boolean): string;
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{ id: string, key: string, size: number, lineSize: number, rise: number, color: string,
|
|
11
|
+
* under: boolean, strike: boolean, bg?: string, href?: string }} Look
|
|
12
|
+
* @typedef {{ text: string, look: Look, x: number, w: number }} Frag
|
|
13
|
+
* @typedef {{ frags: Frag[], w: number, h: number, base: number, left: number, align: string, p: number, br: boolean, gap: number }} RichLine
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('../text/rich.js').RichBlock[]} blocks
|
|
17
|
+
* @param {any} st the item's resolved style
|
|
18
|
+
* @param {number} width
|
|
19
|
+
* @param {import('../text/measure.js').TextMeasurer} m
|
|
20
|
+
* @param {{ listIndent?: number, paragraphSpacing?: number, maxLineHeight?: number, warn?: (msg: string) => void }} [opt]
|
|
21
|
+
*/
|
|
22
|
+
export function layoutRich(blocks: import("../text/rich.js").RichBlock[], st: any, width: number, m: import("../text/measure.js").TextMeasurer, opt?: {
|
|
23
|
+
listIndent?: number;
|
|
24
|
+
paragraphSpacing?: number;
|
|
25
|
+
maxLineHeight?: number;
|
|
26
|
+
warn?: (msg: string) => void;
|
|
27
|
+
}): {
|
|
28
|
+
lines: RichLine[];
|
|
29
|
+
needed: any;
|
|
30
|
+
pad: any;
|
|
31
|
+
inner: number;
|
|
32
|
+
fragments: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Page-model items for rich text lines in a box: background, span backgrounds, one text item per fragment,
|
|
36
|
+
* decorations, borders, then links. Lines that do not fit the box are left out.
|
|
37
|
+
* @param {{ x: number, y: number, w: number, h: number, st: any, rl: { lines: RichLine[], pad: number[], inner: number },
|
|
38
|
+
* m: import('../text/measure.js').TextMeasurer, id: string }} o
|
|
39
|
+
*/
|
|
40
|
+
export function paintRich({ x, y, w, h, st, rl, m, id }: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
w: number;
|
|
44
|
+
h: number;
|
|
45
|
+
st: any;
|
|
46
|
+
rl: {
|
|
47
|
+
lines: RichLine[];
|
|
48
|
+
pad: number[];
|
|
49
|
+
inner: number;
|
|
50
|
+
};
|
|
51
|
+
m: import("../text/measure.js").TextMeasurer;
|
|
52
|
+
id: string;
|
|
53
|
+
}): any[];
|
|
54
|
+
/**
|
|
55
|
+
* Vertical text (writing-mode tb-rl): columns from right to left, each read top to bottom. Upright characters
|
|
56
|
+
* (CJK) are stacked one em apart, one text item per column; runs of other text (Latin, digits) are text items
|
|
57
|
+
* turned 90° clockwise about their own centre, so every exporter draws them with Phase 1's rotation.
|
|
58
|
+
* The box keeps its designed size; text past the last column that fits is left out.
|
|
59
|
+
* @param {{ x: number, y: number, w: number, h: number, st: any, text: string, m: import('../text/measure.js').TextMeasurer }} o
|
|
60
|
+
*/
|
|
61
|
+
export function paintVertical({ x, y, w, h, st, text, m }: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
w: number;
|
|
65
|
+
h: number;
|
|
66
|
+
st: any;
|
|
67
|
+
text: string;
|
|
68
|
+
m: import("../text/measure.js").TextMeasurer;
|
|
69
|
+
}): any[];
|
|
70
|
+
export namespace RICH_DEFAULTS {
|
|
71
|
+
let listIndent: number;
|
|
72
|
+
let paragraphSpacing: number;
|
|
73
|
+
let linkColor: string;
|
|
74
|
+
let maxFragments: number;
|
|
75
|
+
let maxLines: number;
|
|
76
|
+
}
|
|
77
|
+
export type Look = {
|
|
78
|
+
id: string;
|
|
79
|
+
key: string;
|
|
80
|
+
size: number;
|
|
81
|
+
lineSize: number;
|
|
82
|
+
rise: number;
|
|
83
|
+
color: string;
|
|
84
|
+
under: boolean;
|
|
85
|
+
strike: boolean;
|
|
86
|
+
bg?: string;
|
|
87
|
+
href?: string;
|
|
88
|
+
};
|
|
89
|
+
export type Frag = {
|
|
90
|
+
text: string;
|
|
91
|
+
look: Look;
|
|
92
|
+
x: number;
|
|
93
|
+
w: number;
|
|
94
|
+
};
|
|
95
|
+
export type RichLine = {
|
|
96
|
+
frags: Frag[];
|
|
97
|
+
w: number;
|
|
98
|
+
h: number;
|
|
99
|
+
base: number;
|
|
100
|
+
left: number;
|
|
101
|
+
align: string;
|
|
102
|
+
p: number;
|
|
103
|
+
br: boolean;
|
|
104
|
+
gap: number;
|
|
105
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @param {number} n @param {string} kind 'decimal' | 'roman' | 'alpha' */
|
|
2
|
+
export function formatNumber(n: number, kind: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* The number of each entry. A deeper level restarts when a higher one moves on; a skipped level counts as 1.
|
|
5
|
+
* @param {{ level?: number }[]} entries
|
|
6
|
+
* @param {string | string[]} numbering one format for every level, or one per level (the last repeats)
|
|
7
|
+
*/
|
|
8
|
+
export function tocNumbers(entries: {
|
|
9
|
+
level?: number;
|
|
10
|
+
}[], numbering: string | string[]): string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lay out a set of free-positioned items (a band body, a container, one list row).
|
|
3
|
+
* Applies the RDL push rule: when an item grows by Δ, every item below it that
|
|
4
|
+
* overlaps it horizontally moves down by Δ.
|
|
5
|
+
*
|
|
6
|
+
* @param {any[]} items
|
|
7
|
+
* @param {any} lc layout context
|
|
8
|
+
* @param {{ dx?: number }} [opt] x offset of the parent
|
|
9
|
+
* @returns {{ units: any[], tables: any[], height: number }}
|
|
10
|
+
* units and tables in coordinates relative to the top of this set
|
|
11
|
+
*/
|
|
12
|
+
export function layoutItems(items: any[], lc: any, { dx }?: {
|
|
13
|
+
dx?: number;
|
|
14
|
+
}): {
|
|
15
|
+
units: any[];
|
|
16
|
+
tables: any[];
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Which items a render leaves out because of their layer: `layers: [{ name, target, visible }]`. Targets follow
|
|
21
|
+
* ActiveReports' TargetDevice: all, screen, print (paper), export, design (none: the designer only).
|
|
22
|
+
* @returns {((it: any) => boolean) | null}
|
|
23
|
+
*/
|
|
24
|
+
export function layerFilter(layers: any, target: any): ((it: any) => boolean) | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {any[]} units sorted by top
|
|
3
|
+
* @param {any[]} tables
|
|
4
|
+
* @param {number} pageH content height available for the body
|
|
5
|
+
* @param {(msg: string, clip?: boolean) => void} warn
|
|
6
|
+
* @param {{ work: number }} [stats] counts the comparisons the search makes (the complexity test reads it)
|
|
7
|
+
* @returns {{ top: number, bottom: number, offset: number, repeat: any[], units: any[] }[]}
|
|
8
|
+
*/
|
|
9
|
+
export function paginate(units: any[], tables: any[], pageH: number, warn: (msg: string, clip?: boolean) => void, stats?: {
|
|
10
|
+
work: number;
|
|
11
|
+
}): {
|
|
12
|
+
top: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
offset: number;
|
|
15
|
+
repeat: any[];
|
|
16
|
+
units: any[];
|
|
17
|
+
}[];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A loader for one render (and its subreports): each id loaded once, at most REUSE_LIMITS.reports ids.
|
|
3
|
+
* @param {((id: string) => Promise<any>) | undefined} load
|
|
4
|
+
* @param {Map<string, Promise<any>>} [cache]
|
|
5
|
+
*/
|
|
6
|
+
export function makeLoader(load: ((id: string) => Promise<any>) | undefined, cache?: Map<string, Promise<any>>): (id: any) => Promise<any>;
|
|
7
|
+
/** Report ids a definition reuses by a fixed id (not expressions): master, stylesheet, theme and part libraries. */
|
|
8
|
+
export function reuseRefs(def: any): Set<any>;
|
|
9
|
+
/**
|
|
10
|
+
* The reports a definition opens by a fixed id: drill-through actions (an item's, a cell's, a chart point's, a matrix
|
|
11
|
+
* header's) and subreports, each with where it is ("Ledger cell", "Chart1"). Ids given by an expression are not listed.
|
|
12
|
+
* @param {any} def @returns {{ report: string, where: string }[]}
|
|
13
|
+
*/
|
|
14
|
+
export function drillRefs(def: any): {
|
|
15
|
+
report: string;
|
|
16
|
+
where: string;
|
|
17
|
+
}[];
|
|
18
|
+
export function findItemNamed(def: any, name: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* The content report merged with its master (and the master's master, up to REUSE_LIMITS.depth).
|
|
21
|
+
* @param {any} def @param {(id: string) => Promise<any>} get @param {(m: string) => void} warn @param {string[]} [chain]
|
|
22
|
+
*/
|
|
23
|
+
export function applyMaster(def: any, get: (id: string) => Promise<any>, warn: (m: string) => void, chain?: string[]): any;
|
|
24
|
+
/** Named styles with `parent` resolved: each style is its parents' properties with its own on top. */
|
|
25
|
+
export function flattenNamed(named: any, warn?: (_m: any) => void): Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Masters, stylesheet and part libraries, before validation. Themes come later (they may depend on parameters).
|
|
28
|
+
* @returns {Promise<{ def: any, parts: Map<string, any> | null }>}
|
|
29
|
+
*/
|
|
30
|
+
export function resolveReuse(def: any, get: any, warn: any, chain?: any[], budget?: {
|
|
31
|
+
items: number;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
def: any;
|
|
34
|
+
parts: Map<string, any> | null;
|
|
35
|
+
}>;
|
|
36
|
+
/** A theme definition as expressions read it: Theme.Colors.Accent1, Theme.Fonts.MajorFont.Family, Theme.Constants.Name. */
|
|
37
|
+
export function themeContext(td: any): {
|
|
38
|
+
Colors: any;
|
|
39
|
+
Fonts: {
|
|
40
|
+
MajorFont: {
|
|
41
|
+
Family: any;
|
|
42
|
+
Size: any;
|
|
43
|
+
Weight: any;
|
|
44
|
+
Style: any;
|
|
45
|
+
};
|
|
46
|
+
MinorFont: {
|
|
47
|
+
Family: any;
|
|
48
|
+
Size: any;
|
|
49
|
+
Weight: any;
|
|
50
|
+
Style: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
Constants: any;
|
|
54
|
+
};
|
|
55
|
+
/** The render's theme: `theme` (a report id, or an expression giving one), else the report's own `themeDef`, else the default. */
|
|
56
|
+
export function resolveTheme(def: any, ctx: any, get: any, warn: any): Promise<{
|
|
57
|
+
Colors: any;
|
|
58
|
+
Fonts: {
|
|
59
|
+
MajorFont: {
|
|
60
|
+
Family: any;
|
|
61
|
+
Size: any;
|
|
62
|
+
Weight: any;
|
|
63
|
+
Style: any;
|
|
64
|
+
};
|
|
65
|
+
MinorFont: {
|
|
66
|
+
Family: any;
|
|
67
|
+
Size: any;
|
|
68
|
+
Weight: any;
|
|
69
|
+
Style: any;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
Constants: any;
|
|
73
|
+
}>;
|
|
74
|
+
export namespace REUSE_LIMITS {
|
|
75
|
+
let depth: number;
|
|
76
|
+
let reports: number;
|
|
77
|
+
let items: number;
|
|
78
|
+
let reportItems: number;
|
|
79
|
+
let parts: number;
|
|
80
|
+
let layers: number;
|
|
81
|
+
let styleDepth: number;
|
|
82
|
+
let repeats: number;
|
|
83
|
+
}
|
|
84
|
+
export function isReportId(v: any): boolean;
|
|
85
|
+
export function isSubreportId(v: any): boolean;
|
|
86
|
+
export namespace DEFAULT_THEME {
|
|
87
|
+
namespace colors {
|
|
88
|
+
let Dark1: string;
|
|
89
|
+
let Light1: string;
|
|
90
|
+
let Dark2: string;
|
|
91
|
+
let Light2: string;
|
|
92
|
+
let Accent1: string;
|
|
93
|
+
let Accent2: string;
|
|
94
|
+
let Accent3: string;
|
|
95
|
+
let Accent4: string;
|
|
96
|
+
let Accent5: string;
|
|
97
|
+
let Accent6: string;
|
|
98
|
+
let Hyperlink: string;
|
|
99
|
+
}
|
|
100
|
+
namespace fonts {
|
|
101
|
+
namespace major {
|
|
102
|
+
let family: string;
|
|
103
|
+
let size: number;
|
|
104
|
+
let weight: string;
|
|
105
|
+
let style: string;
|
|
106
|
+
}
|
|
107
|
+
namespace minor {
|
|
108
|
+
let family_1: string;
|
|
109
|
+
export { family_1 as family };
|
|
110
|
+
let size_1: number;
|
|
111
|
+
export { size_1 as size };
|
|
112
|
+
let weight_1: string;
|
|
113
|
+
export { weight_1 as weight };
|
|
114
|
+
let style_1: string;
|
|
115
|
+
export { style_1 as style };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let constants: {};
|
|
119
|
+
}
|
|
120
|
+
export const THEME_COLORS: string[];
|