@opencorestack/opengridx 3.1.0 → 3.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/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/index.d.ts +28 -0
- package/dist/opengridx.es.js +3563 -3509
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +13 -13
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +14 -0
- package/docs/features/pdf-export.md +38 -2
- package/lib/index.ts +1 -0
- package/lib/types/index.ts +31 -0
- package/lib/utils/export/exportToPdf.ts +167 -21
- package/lib/utils/export/index.ts +1 -1
- package/llms.txt +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [3.2.0] — 2026-09-29
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Non-blocking `exportToPdf`** — the export now works in ~30 ms slices and yields to the event loop between them, both while formatting rows (including grouped rows and WinAnsi conversion) and while drawing the table: the body is drawn by a series of `jspdf-autotable` calls that continue on the same page with fixed column widths, the header repeated on every new page and the footer only at the end. Pages, row positions, shading and page breaks are unchanged (verified against a single call in Chromium, Firefox and WebKit). Measured with 50,000 grouped rows in Chromium: longest main-thread block 6.3 s → ~0.4–0.6 s (jsPDF's final save, which cannot be split), total time about the same (~6–7 s), file size unchanged.
|
|
13
|
+
- **`PdfExportOptions.onProgress`** — `({ phase: 'prepare' | 'render' | 'save', done, total }) => void`; new exported type `PdfExportProgress`.
|
|
14
|
+
- **`PdfExportOptions.signal`** — an `AbortSignal`; aborting rejects the promise with a `DOMException` named `'AbortError'` and saves no file.
|
|
15
|
+
- **`PdfExportOptions.maxRows`** (default 20,000) — above it a development-mode `console.warn` recommends `exportToCsv` / `exportToExcelAdvanced`. The export still runs; nothing is thrown.
|
|
16
|
+
- Demo: the PDF export page has a row-count selector, a progress bar and a Cancel button.
|
|
17
|
+
|
|
8
18
|
## [3.1.0] — 2026-09-29
|
|
9
19
|
|
|
10
20
|
### Added
|
package/README.md
CHANGED
|
@@ -437,7 +437,7 @@ printGrid(rows, columns, 'Report Title');
|
|
|
437
437
|
|
|
438
438
|
> **Optional peer dependencies:** `exportToExcelAdvanced` requires ExcelJS (`npm install exceljs`); `exportToPdf` requires `npm install jspdf jspdf-autotable`.
|
|
439
439
|
|
|
440
|
-
> **Large exports:** PDF
|
|
440
|
+
> **Large exports:** PDF size and time grow fast (75–120 MB and several seconds for 50,000 grouped rows). Since v3.2 `exportToPdf` yields between slices so the page stays responsive, reports `onProgress` and accepts an abort `signal`; above `maxRows` (default 20,000) it warns in development. For more than a few thousand rows export CSV or `.xlsx`. PDF's built-in font only covers Latin-1: pass the `font` option (a Unicode `.ttf`) for characters such as `₹`, otherwise they print as `?`. See [PDF Export](docs/features/pdf-export.md).
|
|
441
441
|
|
|
442
442
|
CSV and HTML-Excel exports neutralise spreadsheet formulas (text starting with `=`, `+`, `-`, `@`, a tab or a carriage return gets a leading `'`; opt out with `escapeFormulas: false`), and CSV starts with a UTF-8 BOM (`bom: false` omits it). `exportToExcel` writes an HTML table, so a `.xlsx` file name is saved as `.xls`. To export what the grid shows, pass `apiRef.current.getAllFilteredRows()` and `apiRef.current.getVisibleColumns()`; with a custom `getRowId`, also pass `getRowId` in the options so `selectedRows` match. See the [Export Guide](docs/features/export-guide.md).
|
|
443
443
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1767,6 +1767,34 @@ export declare interface PdfExportOptions<R extends GridValidRowModel = GridRowM
|
|
|
1767
1767
|
* Has no effect when the grid has no active `rowGroupingModel`, or when `selectedRows` is non-empty.
|
|
1768
1768
|
*/
|
|
1769
1769
|
groupedRows?: GridGroupedExportRow[];
|
|
1770
|
+
/**
|
|
1771
|
+
* Called as the export advances: `prepare` (formatting rows; `total` = source rows or grouped
|
|
1772
|
+
* entries), `render` (drawing table rows; `total` = table body rows) and `save` (`0/1` before the
|
|
1773
|
+
* file is written, `1/1` after). `done` never decreases within a phase and ends at `total`.
|
|
1774
|
+
* @since v3.2
|
|
1775
|
+
*/
|
|
1776
|
+
onProgress?: (progress: PdfExportProgress) => void;
|
|
1777
|
+
/**
|
|
1778
|
+
* Cancels the export. When aborted, the returned promise rejects with a `DOMException` named
|
|
1779
|
+
* `'AbortError'` and no file is saved. Checked between slices of work, so cancellation takes
|
|
1780
|
+
* effect within one slice; the final save step cannot be interrupted once started.
|
|
1781
|
+
* @since v3.2
|
|
1782
|
+
*/
|
|
1783
|
+
signal?: AbortSignal;
|
|
1784
|
+
/**
|
|
1785
|
+
* Table-row count above which a development-mode warning recommends `exportToCsv` or
|
|
1786
|
+
* `exportToExcelAdvanced`. The export still runs (nothing is thrown). Pass `Infinity` to silence it.
|
|
1787
|
+
* Default: 20000
|
|
1788
|
+
* @since v3.2
|
|
1789
|
+
*/
|
|
1790
|
+
maxRows?: number;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/** Progress reported by `PdfExportOptions.onProgress`. @since v3.2 */
|
|
1794
|
+
export declare interface PdfExportProgress {
|
|
1795
|
+
phase: 'prepare' | 'render' | 'save';
|
|
1796
|
+
done: number;
|
|
1797
|
+
total: number;
|
|
1770
1798
|
}
|
|
1771
1799
|
|
|
1772
1800
|
declare interface PivotResult {
|