report-studio 1.0.0 → 1.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/LICENSE +21 -21
- package/README.md +171 -22
- package/dist/designer-qy59eEux.js +3416 -0
- package/dist/designer.js +2 -3209
- package/dist/index.js +2 -2
- package/dist/react-designer.js +41 -0
- package/dist/react.js +60 -0
- package/dist/{viewer-D-c0lKzQ.js → viewer-xa17tyMJ.js} +682 -537
- package/package.json +105 -66
- package/src/cli/serve.js +135 -135
- package/src/designer/designer.js +2054 -1900
- package/src/designer/dialog.js +708 -708
- package/src/designer/fields.js +51 -2
- package/src/designer/icons.js +5 -0
- package/src/designer/index.html +28 -28
- package/src/designer/main.js +39 -39
- package/src/designer/menu.js +2 -2
- package/src/designer/panel.js +21 -1
- package/src/designer/sample-data.js +180 -9
- package/src/designer/structure.js +87 -6
- package/src/designer/styles.css +1654 -1616
- package/src/designer/tokens.js +9 -0
- package/src/engine/csv.js +350 -315
- package/src/engine/group.js +128 -65
- package/src/engine/index.js +35 -34
- package/src/engine/measure.js +13 -12
- package/src/engine/paginate.js +8 -4
- package/src/engine/resolve.js +37 -0
- package/src/engine/tables.js +87 -0
- package/src/engine/validate.js +97 -22
- package/src/index.html +79 -79
- package/src/index.js +51 -50
- package/src/preview/chrome.css +505 -505
- package/src/preview/chrome.js +147 -147
- package/src/preview/index.html +28 -28
- package/src/preview/viewer.js +763 -745
- package/src/react/designer.js +87 -0
- package/src/react/index.js +117 -0
- package/src/render/items.js +94 -1
- package/src/render/report.css +30 -0
- package/src/server/routes.js +331 -331
- package/src/shared/brand.css +29 -29
- package/src/shared/dropdown.css +136 -136
- package/src/shared/modal.css +125 -125
- package/src/shared/store.js +145 -145
- package/src/shared/theme.css +72 -72
- package/src/shared/window.js +138 -138
- package/types/designer.d.ts +85 -0
- package/types/index.d.ts +204 -0
- package/types/layout.d.ts +179 -0
- package/types/react-designer.d.ts +29 -0
- package/types/react.d.ts +30 -0
- package/types/vite.d.ts +18 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* report-studio - the engine and the viewer.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
Band, BandType, Layout, PaginatedReport, Page, ReportData, TableItem, TextStyle
|
|
7
|
+
} from './layout.js';
|
|
8
|
+
|
|
9
|
+
export type * from './layout.js';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* ---------------------------------------------------------------- engine */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Turns a layout file plus your data into a page list.
|
|
16
|
+
* @throws {ReportError} when the layout or data cannot be used
|
|
17
|
+
*/
|
|
18
|
+
export function buildPages(layout: Layout, data: ReportData): PaginatedReport;
|
|
19
|
+
|
|
20
|
+
/** stage 1 of buildPages: fills in placeholders from the data */
|
|
21
|
+
export function resolve(layout: Layout, data: ReportData): Layout;
|
|
22
|
+
/** stage 2: splits the grouped table's rows into groups */
|
|
23
|
+
export function group(resolved: Layout, data: ReportData): Layout;
|
|
24
|
+
/** stage 3: measures text and table rows */
|
|
25
|
+
export function measure(grouped: Layout): Layout;
|
|
26
|
+
/** stage 4: breaks the measured report into pages */
|
|
27
|
+
export function paginate(measured: Layout): PaginatedReport;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Everything wrong with a layout, as readable messages.
|
|
31
|
+
* @returns an empty array when the layout is usable
|
|
32
|
+
*/
|
|
33
|
+
export function validateLayout(layout: unknown): string[];
|
|
34
|
+
|
|
35
|
+
/** thrown for a layout or data the engine cannot work with */
|
|
36
|
+
export class ReportError extends Error {
|
|
37
|
+
constructor(message: string, issues?: string[]);
|
|
38
|
+
name: 'ReportError';
|
|
39
|
+
issues: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SearchOptions {
|
|
43
|
+
caseSensitive?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface SearchMatch {
|
|
47
|
+
pageNO: number;
|
|
48
|
+
bandType: BandType;
|
|
49
|
+
itemId: string;
|
|
50
|
+
/** the table column it was found in; null for a text item */
|
|
51
|
+
field: string | null;
|
|
52
|
+
text: string;
|
|
53
|
+
start: number;
|
|
54
|
+
end: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** every occurrence of `query` in a built report, in page order */
|
|
58
|
+
export function search(pages: Page[], query: string, options?: SearchOptions): SearchMatch[];
|
|
59
|
+
|
|
60
|
+
/** the distinct page numbers a query appears on, in order */
|
|
61
|
+
export function searchPages(pages: Page[], query: string, options?: SearchOptions): number[];
|
|
62
|
+
|
|
63
|
+
export interface PageRegionsOptions {
|
|
64
|
+
bands: Partial<Record<BandType, Band>>;
|
|
65
|
+
contentHeight: number;
|
|
66
|
+
isFirstPage: boolean;
|
|
67
|
+
isLastPage: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function pageRegions(options: PageRegionsOptions): Record<string, unknown>;
|
|
71
|
+
export function bandZoneHeight(band: Band | null, contentHeight: number): number;
|
|
72
|
+
export function resolveHeight(
|
|
73
|
+
value: number | string | undefined,
|
|
74
|
+
contentHeight: number,
|
|
75
|
+
fallback?: number | string
|
|
76
|
+
): number;
|
|
77
|
+
export const DEFAULT_BAND_HEIGHTS: Readonly<Record<string, string>>;
|
|
78
|
+
|
|
79
|
+
export interface CSVOptions {
|
|
80
|
+
/** the id of the table to write; the first when absent */
|
|
81
|
+
table?: string;
|
|
82
|
+
/** default `','`; use `';'` where Excel expects it */
|
|
83
|
+
delimiter?: string;
|
|
84
|
+
/** default `'\r\n'` */
|
|
85
|
+
newline?: string;
|
|
86
|
+
/** emit the column labels as the first row; default true */
|
|
87
|
+
header?: boolean;
|
|
88
|
+
/** prepend the group key on a grouped table; default true */
|
|
89
|
+
groupColumn?: boolean;
|
|
90
|
+
/** default `'Group'` */
|
|
91
|
+
groupLabel?: string;
|
|
92
|
+
/** stop cells starting `=`, `+`, `-` or `@` running as formulas; default true */
|
|
93
|
+
neutraliseFormulas?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type ReportCSVOptions = Pick<CSVOptions, 'delimiter' | 'newline' | 'neutraliseFormulas'>;
|
|
97
|
+
|
|
98
|
+
/** one table's rows as CSV text; empty when there is no such table */
|
|
99
|
+
export function toCSV(pages: Page[], options?: CSVOptions): string;
|
|
100
|
+
|
|
101
|
+
/** the whole report as CSV, one row per line in the order it is read */
|
|
102
|
+
export function toReportCSV(pages: Page[], options?: ReportCSVOptions): string;
|
|
103
|
+
|
|
104
|
+
/** a download filename from the report's name */
|
|
105
|
+
export function reportFilename(paginated: { name?: string }, extension?: string): string;
|
|
106
|
+
|
|
107
|
+
/** the tables a built report holds, in the order they first appear */
|
|
108
|
+
export function reportTables(pages: Page[]): Array<{ id: string; columns: string[] }>;
|
|
109
|
+
|
|
110
|
+
/** every table item in a layout, in the order they are drawn */
|
|
111
|
+
export function tablesOf(layout: Layout): TableItem[];
|
|
112
|
+
|
|
113
|
+
/** the dataset a table reads: its own, or the layout's */
|
|
114
|
+
export function datasetOf(table: TableItem, layout: Layout): string | null;
|
|
115
|
+
|
|
116
|
+
/** the grouped table and its field, or null when nothing is grouped */
|
|
117
|
+
export function groupingOf(layout: Layout): { table: TableItem; by: string } | null;
|
|
118
|
+
|
|
119
|
+
/** width of one line of text, in pixels */
|
|
120
|
+
export function measureText(text: string, style?: TextStyle): number;
|
|
121
|
+
|
|
122
|
+
/** greedy word wrap to `width` pixels */
|
|
123
|
+
export function wrapLines(text: string, width: number, style?: TextStyle): string[];
|
|
124
|
+
|
|
125
|
+
/** rendered height of wrapped text, in pixels */
|
|
126
|
+
export function textHeight(text: string, width: number, style?: TextStyle): number;
|
|
127
|
+
|
|
128
|
+
/** CSS line-height multiplier the report draws text at */
|
|
129
|
+
export const LINE_HEIGHT_RATIO: number;
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
/* ---------------------------------------------------------------- render */
|
|
133
|
+
|
|
134
|
+
/** a built report as HTML markup, with no viewer around it */
|
|
135
|
+
export function render(paginated: PaginatedReport): string;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
/* ---------------------------------------------------------------- viewer */
|
|
139
|
+
|
|
140
|
+
export interface ViewerOptions {
|
|
141
|
+
/** the element to take over, or a selector for it */
|
|
142
|
+
mount: Element | string;
|
|
143
|
+
/** a buildPages result */
|
|
144
|
+
paginated: PaginatedReport;
|
|
145
|
+
/** shown in the viewer's toolbar */
|
|
146
|
+
title?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ViewerHandle {
|
|
150
|
+
/** go to a page, 0-based */
|
|
151
|
+
show(index: number): void;
|
|
152
|
+
next(): void;
|
|
153
|
+
prev(): void;
|
|
154
|
+
find(query: string): void;
|
|
155
|
+
print(): void;
|
|
156
|
+
/** false when the report has nothing to write */
|
|
157
|
+
downloadCSV(): boolean;
|
|
158
|
+
openExport(): void;
|
|
159
|
+
closeExport(): void;
|
|
160
|
+
confirmExport(): void;
|
|
161
|
+
setZoom(zoom: number): void;
|
|
162
|
+
zoomIn(): void;
|
|
163
|
+
zoomOut(): void;
|
|
164
|
+
fitWidth(): void;
|
|
165
|
+
destroy(): void;
|
|
166
|
+
/** the current page, 1-based */
|
|
167
|
+
readonly page: number;
|
|
168
|
+
readonly pageCount: number;
|
|
169
|
+
readonly zoom: number;
|
|
170
|
+
readonly exportOpen: boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface WindowOptions {
|
|
174
|
+
width?: number;
|
|
175
|
+
height?: number;
|
|
176
|
+
/** passed to window.open as given */
|
|
177
|
+
features?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** mounts the report viewer into an element */
|
|
181
|
+
export function createViewer(options: ViewerOptions): ViewerHandle;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Opens the viewer in a window of its own. Call it from a click or a keypress.
|
|
185
|
+
* @returns null when the browser blocked the window
|
|
186
|
+
*/
|
|
187
|
+
export function openViewerWindow(
|
|
188
|
+
options: Omit<ViewerOptions, 'mount'> & WindowOptions
|
|
189
|
+
): (ViewerHandle & { window: Window }) | null;
|
|
190
|
+
|
|
191
|
+
export interface OpenedWindow {
|
|
192
|
+
window: Window;
|
|
193
|
+
document: Document;
|
|
194
|
+
mount: Element;
|
|
195
|
+
close(): void;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Opens a blank window carrying this page's stylesheets, ready to mount into.
|
|
200
|
+
* @returns null when the browser blocked the window
|
|
201
|
+
*/
|
|
202
|
+
export function openWindow(
|
|
203
|
+
options?: WindowOptions & { title?: string; opener?: Window }
|
|
204
|
+
): OpenedWindow | null;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout file the designer saves, and the page list buildPages makes of it.
|
|
3
|
+
*
|
|
4
|
+
* Hand-written to match src/engine/validate.js. Every object also accepts
|
|
5
|
+
* properties not named here, because the designer adds its own (guides, for
|
|
6
|
+
* one) and a layout from a newer version should still type-check.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type BandType =
|
|
10
|
+
| 'reportHeader'
|
|
11
|
+
| 'pageHeader'
|
|
12
|
+
| 'groupHeader'
|
|
13
|
+
| 'detail'
|
|
14
|
+
| 'groupFooter'
|
|
15
|
+
| 'pageFooter'
|
|
16
|
+
| 'reportFooter';
|
|
17
|
+
|
|
18
|
+
export type ItemType = 'text' | 'table' | 'line' | 'box' | 'image';
|
|
19
|
+
|
|
20
|
+
export type Align = 'left' | 'center' | 'right';
|
|
21
|
+
|
|
22
|
+
export type LineStyle = 'solid' | 'dashed' | 'dotted' | 'double';
|
|
23
|
+
|
|
24
|
+
/** a table's grid and a box's border may also be turned off */
|
|
25
|
+
export type RuleStyle = LineStyle | 'none';
|
|
26
|
+
|
|
27
|
+
export type ImageFit = 'contain' | 'cover' | 'fill';
|
|
28
|
+
|
|
29
|
+
export interface Margin {
|
|
30
|
+
top: number;
|
|
31
|
+
right: number;
|
|
32
|
+
bottom: number;
|
|
33
|
+
left: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** sizes in CSS pixels; A4 at 96dpi is 794 x 1123 */
|
|
37
|
+
export interface PageSetup {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
margin: Margin;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface TextStyle {
|
|
45
|
+
fontFamily?: string;
|
|
46
|
+
fontSize?: number;
|
|
47
|
+
fontWeight?: string;
|
|
48
|
+
fontStyle?: string;
|
|
49
|
+
color?: string;
|
|
50
|
+
align?: Align;
|
|
51
|
+
background?: string | null;
|
|
52
|
+
border?: string | null;
|
|
53
|
+
padding?: number;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ItemBase {
|
|
58
|
+
id: string;
|
|
59
|
+
x?: number;
|
|
60
|
+
y?: number;
|
|
61
|
+
w?: number;
|
|
62
|
+
h?: number;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface TextItem extends ItemBase {
|
|
67
|
+
type: 'text';
|
|
68
|
+
/** literal text and `{placeholders}`, such as `Total: {sum(amount)}` */
|
|
69
|
+
value: string;
|
|
70
|
+
style?: TextStyle;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface TableColumn {
|
|
74
|
+
/** the row property this column shows */
|
|
75
|
+
field: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
width?: number;
|
|
78
|
+
align?: Align;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface TableStyle extends TextStyle {
|
|
83
|
+
borderStyle?: RuleStyle;
|
|
84
|
+
borderWidth?: number;
|
|
85
|
+
borderColor?: string;
|
|
86
|
+
headerColor?: string;
|
|
87
|
+
headerBackground?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface TableItem extends ItemBase {
|
|
91
|
+
type: 'table';
|
|
92
|
+
columns: TableColumn[];
|
|
93
|
+
rowHeight: number;
|
|
94
|
+
headerHeight?: number;
|
|
95
|
+
showHeader?: boolean;
|
|
96
|
+
/** the dataset this table reads rows from; the layout's when absent */
|
|
97
|
+
dataset?: string | null;
|
|
98
|
+
/** group this table's rows by a field. One table per report may */
|
|
99
|
+
groupBy?: string | null;
|
|
100
|
+
/** false keeps each cell to one line with an ellipsis */
|
|
101
|
+
wrap?: boolean;
|
|
102
|
+
style?: TableStyle;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface LineItem extends ItemBase {
|
|
106
|
+
type: 'line';
|
|
107
|
+
orientation?: 'horizontal' | 'vertical';
|
|
108
|
+
style?: {
|
|
109
|
+
thickness?: number;
|
|
110
|
+
lineStyle?: LineStyle;
|
|
111
|
+
color?: string;
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface BoxItem extends ItemBase {
|
|
117
|
+
type: 'box';
|
|
118
|
+
style?: {
|
|
119
|
+
borderStyle?: RuleStyle;
|
|
120
|
+
borderWidth?: number;
|
|
121
|
+
borderColor?: string;
|
|
122
|
+
radius?: number;
|
|
123
|
+
background?: string | null;
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ImageItem extends ItemBase {
|
|
129
|
+
type: 'image';
|
|
130
|
+
/** a picture stored in the layout: a URL or a `data:` URI */
|
|
131
|
+
src?: string | null;
|
|
132
|
+
/** a data path, such as `company.logo`, whose value is the picture's URL */
|
|
133
|
+
field?: string | null;
|
|
134
|
+
fit?: ImageFit;
|
|
135
|
+
alt?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type ReportItem = TextItem | TableItem | LineItem | BoxItem | ImageItem;
|
|
139
|
+
|
|
140
|
+
export interface Band {
|
|
141
|
+
type: BandType;
|
|
142
|
+
/** pixels, or a percentage of the printable height such as `'10%'` */
|
|
143
|
+
height?: number | string;
|
|
144
|
+
items: ReportItem[];
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** what the designer saves as `<name>.json` */
|
|
149
|
+
export interface Layout {
|
|
150
|
+
version?: number;
|
|
151
|
+
name?: string;
|
|
152
|
+
page: PageSetup;
|
|
153
|
+
/** the dataset tables read from when they name none of their own */
|
|
154
|
+
dataset?: string | null;
|
|
155
|
+
/** group the first table's rows by this field */
|
|
156
|
+
groupBy?: string | null;
|
|
157
|
+
bands: Band[];
|
|
158
|
+
[key: string]: unknown;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The host application's data, keyed by dataset name: arrays of rows for
|
|
163
|
+
* tables, and objects or values for text placeholders.
|
|
164
|
+
*/
|
|
165
|
+
export type ReportData = Record<string, unknown>;
|
|
166
|
+
|
|
167
|
+
/** one page of a built report */
|
|
168
|
+
export interface Page {
|
|
169
|
+
/** 1-based */
|
|
170
|
+
pageNO: number;
|
|
171
|
+
bands: Array<Band & Record<string, unknown>>;
|
|
172
|
+
regions: Record<string, unknown>;
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** what buildPages returns: the layout, with every page laid out */
|
|
177
|
+
export interface PaginatedReport extends Layout {
|
|
178
|
+
pages: Page[];
|
|
179
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* report-studio/react/designer - the designer as a React component.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { CSSProperties, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
6
|
+
import type { Layout } from './layout.js';
|
|
7
|
+
import type { DesignerHandle, ReportStore } from './designer.js';
|
|
8
|
+
|
|
9
|
+
export type * from './layout.js';
|
|
10
|
+
export type { DesignerHandle, ReportStore } from './designer.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface ReportDesignerProps {
|
|
14
|
+
/** where the designer starts, like an input's defaultValue */
|
|
15
|
+
layout?: Layout;
|
|
16
|
+
/** the report's filename stem. Changing it opens a fresh designer */
|
|
17
|
+
id?: string | null;
|
|
18
|
+
store?: ReportStore;
|
|
19
|
+
/** confirm before a tab with unsaved changes closes; default true */
|
|
20
|
+
guardUnload?: boolean;
|
|
21
|
+
/** the layout after every edit. The designer's own object: clone it */
|
|
22
|
+
onChange?: (layout: Layout) => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ReportDesigner: ForwardRefExoticComponent<
|
|
28
|
+
ReportDesignerProps & RefAttributes<DesignerHandle>
|
|
29
|
+
>;
|
package/types/react.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* report-studio/react - the viewer as a React component.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { CSSProperties, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
6
|
+
import type { Layout, PaginatedReport, ReportData } from './layout.js';
|
|
7
|
+
import type { ViewerHandle } from './index.js';
|
|
8
|
+
|
|
9
|
+
export type * from './layout.js';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export interface ReportViewerProps {
|
|
13
|
+
/** a layout the designer saved */
|
|
14
|
+
layout?: Layout;
|
|
15
|
+
/** the data for it, keyed by dataset name. Keep it stable between renders */
|
|
16
|
+
data?: ReportData;
|
|
17
|
+
/** a buildPages result, in place of layout and data */
|
|
18
|
+
paginated?: PaginatedReport;
|
|
19
|
+
title?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
/** give the viewer a height; it fills it and scrolls inside */
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** what a ref on ReportViewer receives */
|
|
26
|
+
export type ReportViewerHandle = Omit<ViewerHandle, 'destroy' | 'exportOpen'>;
|
|
27
|
+
|
|
28
|
+
export const ReportViewer: ForwardRefExoticComponent<
|
|
29
|
+
ReportViewerProps & RefAttributes<ReportViewerHandle>
|
|
30
|
+
>;
|
package/types/vite.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* report-studio/vite - mounts the designer's file routes in a Vite dev server.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Plugin } from 'vite';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export interface ReportStudioPluginOptions {
|
|
9
|
+
/** where report files live, relative to the project; default `'reports'` */
|
|
10
|
+
dir?: string;
|
|
11
|
+
/** the URL the routes are served under */
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** dev only: the routes write files, so they are never mounted for a build */
|
|
16
|
+
export function reportStudio(options?: ReportStudioPluginOptions): Plugin;
|
|
17
|
+
|
|
18
|
+
export default reportStudio;
|