report-studio 1.2.1 → 1.2.2
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/README.md +28 -2
- package/dist/{designer-Be8PdEYf.js → designer-DQlfKnTr.js} +928 -928
- package/dist/designer.js +1 -1
- package/dist/index.js +2 -2
- package/dist/react-designer.js +1 -1
- package/dist/react.js +2 -1
- package/dist/viewer-BSPNCNRU.js +2912 -0
- package/package.json +1 -1
- package/src/engine/csv.js +12 -197
- package/src/engine/index.js +1 -0
- package/src/engine/rows.js +456 -0
- package/src/engine/xlsx-drawing.js +313 -0
- package/src/engine/xlsx-style.js +457 -0
- package/src/engine/xlsx.js +1200 -0
- package/src/engine/zip.js +138 -0
- package/src/index.js +5 -1
- package/src/preview/chrome.js +8 -0
- package/src/preview/viewer.js +42 -1
- package/src/react/index.js +3 -3
- package/types/index.d.ts +53 -0
- package/dist/viewer-5nSb_EH2.js +0 -1727
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ JS or React.**
|
|
|
10
10
|
You draw the report once in a visual designer — headers, footers, groups,
|
|
11
11
|
tables, text, images — and it is saved as a plain JSON file. At runtime your
|
|
12
12
|
app feeds that layout its own data and gets back a page-by-page report viewer,
|
|
13
|
-
with navigation, zoom, search, print and
|
|
13
|
+
with navigation, zoom, search, print, CSV and Excel export.
|
|
14
14
|
|
|
15
15
|
* **Zero runtime dependencies.** The renderer is plain DOM. No server to run,
|
|
16
16
|
no framework required.
|
|
@@ -209,6 +209,32 @@ For CSV, the viewer's export writes every table in the order they print. From
|
|
|
209
209
|
code, `toCSV(pages, { table: 'refunds' })` writes one table, and
|
|
210
210
|
`reportTables(pages)` lists the tables a report has.
|
|
211
211
|
|
|
212
|
+
For Excel, the export writes an `.xlsx` workbook with no extra dependency. It
|
|
213
|
+
has a *Report* sheet that reads like the report, plus one sheet per table with
|
|
214
|
+
a frozen, filterable header row. Numbers, booleans and dates in your data stay
|
|
215
|
+
numbers, booleans and dates.
|
|
216
|
+
|
|
217
|
+
The workbook keeps the report's look: fonts, sizes, colours, alignment, cell
|
|
218
|
+
padding, the table grid and header colours, row heights and column widths. On
|
|
219
|
+
the *Report* sheet each text item goes in the column under where it sits on the
|
|
220
|
+
page (the table columns are the grid), rows are spaced like the page, and
|
|
221
|
+
pictures, lines and boxes are drawn where the page has them, rounded corners
|
|
222
|
+
included. A box with text on it paints its fill into the cells underneath,
|
|
223
|
+
because Excel draws shapes above cells and a filled shape would hide the text.
|
|
224
|
+
A text item that prints only a placeholder's number, such as `{sum(amount)}`,
|
|
225
|
+
becomes a real number you can add up.
|
|
226
|
+
|
|
227
|
+
Pictures stored in the layout as `data:` URIs are embedded straight away.
|
|
228
|
+
Pictures loaded from URLs have to be fetched first, so the viewer's Excel
|
|
229
|
+
download starts a moment later for those reports. PNG, JPEG, GIF and BMP are
|
|
230
|
+
embedded; WebP and AVIF are left out.
|
|
231
|
+
|
|
232
|
+
From code, `toXLSX(pages)` returns the file's bytes (empty when there is
|
|
233
|
+
nothing to write); it embeds `data:` pictures only. `await toXLSXAsync(pages)`
|
|
234
|
+
fetches URL pictures first, and `reportImageSources(pages)` lists the URLs it
|
|
235
|
+
would fetch. Pass `{ report: false }` or `{ tables: false }` to leave a kind of
|
|
236
|
+
sheet out, or `{ styled: false }` for plain data with bold headers.
|
|
237
|
+
|
|
212
238
|
### Images
|
|
213
239
|
|
|
214
240
|
An image item can get its picture in two ways:
|
|
@@ -289,7 +315,7 @@ function SalesReport({ layout, sales }) {
|
|
|
289
315
|
* A layout or data the engine can't use throws a `ReportError` while
|
|
290
316
|
rendering. Wrap the component in an error boundary to show it.
|
|
291
317
|
* A `ref` gives you the viewer's controls: `next()`, `prev()`, `show(index)`,
|
|
292
|
-
`find(text)`, `print()`, `downloadCSV()`, `setZoom(n)`, `fitWidth()`, and
|
|
318
|
+
`find(text)`, `print()`, `downloadCSV()`, `downloadXLSX()`, `setZoom(n)`, `fitWidth()`, and
|
|
293
319
|
`page`, `pageCount` and `zoom`.
|
|
294
320
|
|
|
295
321
|
The designer is a separate import, like the plain-JS one:
|