@motifx-community/ui 0.1.0-beta.17 → 0.1.0-beta.18
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 +23 -0
- package/dist/components/datagrid/DataGrid.d.ts +2 -1
- package/dist/components/datagrid/grid-column.d.ts +6 -0
- package/dist/components/datagrid/model/ColumnModel.d.ts +2 -0
- package/dist/components/datagrid/model/GridModel.d.ts +4 -0
- package/dist/components/datagrid/view/ColumnStyles.d.ts +7 -3
- package/dist/components/datagrid/view/GridBody.d.ts +56 -4
- package/dist/excel/index.js +1 -1
- package/dist/excel/index.js.map +1 -1
- package/dist/index.js +370 -24
- package/dist/index.js.map +1 -1
- package/dist/parts/table/RowHeights.d.ts +23 -0
- package/dist/parts/table/ScrollGeometry.d.ts +6 -1
- package/dist/parts/table/table-sheet-column.d.ts +2 -0
- package/dist/pdf/index.js +1 -1
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/pdf-export-options.d.ts +4 -1
- package/dist/styles.css +4 -0
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/appbar.md +1 -1
- package/docs/appmenu-api.md +1 -1
- package/docs/appmenu-programmatic.md +1 -1
- package/docs/appmenu-search.md +1 -1
- package/docs/appmenu.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bar-gauge-angles.md +1 -1
- package/docs/bar-gauge-data.md +1 -1
- package/docs/bar-gauge-labels.md +1 -1
- package/docs/bar-gauge.md +1 -1
- package/docs/barcode.md +1 -1
- package/docs/bottomnavigation.md +1 -1
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/buttons.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/chart-bars.md +1 -1
- package/docs/chart-candles.md +1 -1
- package/docs/chart-funnel.md +1 -1
- package/docs/chart-heatmap.md +1 -1
- package/docs/chart-lines.md +1 -1
- package/docs/chart-live.md +1 -1
- package/docs/chart-pie.md +1 -1
- package/docs/chart-radar.md +1 -1
- package/docs/chart-ranges.md +1 -1
- package/docs/chart-references.md +1 -1
- package/docs/chart-scatter.md +1 -1
- package/docs/chart-waterfall.md +1 -1
- package/docs/chart-zoom.md +1 -1
- package/docs/chart.md +1 -1
- package/docs/chat.md +1 -1
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +1 -1
- package/docs/choice.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +1 -1
- package/docs/commands.md +1 -1
- package/docs/control.md +1 -1
- package/docs/data.md +1 -1
- package/docs/datagrid-api.md +3 -2
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +1 -1
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +77 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +1 -1
- package/docs/daterangebox.md +1 -1
- package/docs/diagram-api.md +1 -1
- package/docs/diagram-commands.md +1 -1
- package/docs/diagram-connections.md +1 -1
- package/docs/diagram-custom-nodes.md +1 -1
- package/docs/diagram-designer.md +1 -1
- package/docs/diagram-editing.md +1 -1
- package/docs/diagram-flow.md +1 -1
- package/docs/diagram-keyboard.md +1 -1
- package/docs/diagram-layout.md +1 -1
- package/docs/diagram-nodes.md +1 -1
- package/docs/diagram-tables.md +1 -1
- package/docs/diagram.md +1 -1
- package/docs/display.md +1 -1
- package/docs/draggable.md +1 -1
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +1 -1
- package/docs/editors.md +1 -1
- package/docs/expressioneditor.md +1 -1
- package/docs/expressions.md +1 -1
- package/docs/feedback.md +1 -1
- package/docs/fileuploader.md +1 -1
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout-schema.md +1 -1
- package/docs/formlayout.md +1 -1
- package/docs/foundations.md +1 -1
- package/docs/gallery.md +1 -1
- package/docs/gauge-base.md +1 -1
- package/docs/gauge-circular.md +1 -1
- package/docs/gauge-dashboards.md +1 -1
- package/docs/gauge-linear.md +1 -1
- package/docs/gauge-markers.md +1 -1
- package/docs/gauge-marks.md +1 -1
- package/docs/gauge-ranges.md +1 -1
- package/docs/gauge-scales.md +1 -1
- package/docs/gauge.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/language.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +1 -1
- package/docs/loadpanel.md +1 -1
- package/docs/lookup.md +1 -1
- package/docs/markdown.md +1 -1
- package/docs/menus-api.md +1 -1
- package/docs/menus-context.md +1 -1
- package/docs/menus-customization.md +1 -1
- package/docs/menus-merging.md +1 -1
- package/docs/menus-programmatic.md +1 -1
- package/docs/menus.md +1 -1
- package/docs/multiview.md +1 -1
- package/docs/navigation.md +1 -1
- package/docs/numberbox.md +1 -1
- package/docs/otpinput.md +1 -1
- package/docs/pagination.md +1 -1
- package/docs/pivotgrid-api.md +1 -1
- package/docs/pivotgrid-chart.md +1 -1
- package/docs/pivotgrid-drilldown.md +1 -1
- package/docs/pivotgrid-export.md +1 -1
- package/docs/pivotgrid-fields.md +1 -1
- package/docs/pivotgrid-keyboard.md +1 -1
- package/docs/pivotgrid-layout.md +1 -1
- package/docs/pivotgrid-panel.md +1 -1
- package/docs/pivotgrid-remote.md +1 -1
- package/docs/pivotgrid-sorting.md +1 -1
- package/docs/pivotgrid-state.md +1 -1
- package/docs/pivotgrid-summaries.md +1 -1
- package/docs/pivotgrid.md +1 -1
- package/docs/popover.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/qrcode.md +1 -1
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/resizable.md +1 -1
- package/docs/ribbonmenu-api.md +1 -1
- package/docs/ribbonmenu-commands.md +1 -1
- package/docs/ribbonmenu-customization.md +1 -1
- package/docs/ribbonmenu-display.md +1 -1
- package/docs/ribbonmenu-layouts.md +1 -1
- package/docs/ribbonmenu-programmatic.md +1 -1
- package/docs/ribbonmenu.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +1 -1
- package/docs/shortcuteditor.md +1 -1
- package/docs/showcase-flowstudio.md +1 -1
- package/docs/showcase-home.md +1 -1
- package/docs/showcase-mail.md +1 -1
- package/docs/showcase.md +1 -1
- package/docs/signature.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/sortable.md +1 -1
- package/docs/sparkline.md +1 -1
- package/docs/speeddial.md +1 -1
- package/docs/splitter.md +1 -1
- package/docs/stepper.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +1 -1
- package/docs/textarea.md +1 -1
- package/docs/textbox.md +1 -1
- package/docs/tileview.md +1 -1
- package/docs/timeline.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +1 -1
- package/docs/toolbar-api.md +1 -1
- package/docs/toolbar-customization.md +1 -1
- package/docs/toolbar.md +1 -1
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +1 -1
- package/docs/validationsummary.md +1 -1
- package/docs/window.md +1 -1
- package/docs/wizard.md +1 -1
- package/llms-full.txt +269 -192
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,29 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.0-beta.18] - 2026-11-29
|
|
10
|
+
|
|
11
|
+
Needs `@motifx/core` 1.2.0-rc.31 and `@motifx-community/data` 0.1.0-beta.3.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- A `DataGrid` column's `wrap`: the text of its cells wraps onto more lines, a line break in the text starts a new one,
|
|
16
|
+
and a row grows to hold its tallest cell, never shorter than the rows' height. Only the rows on the screen are
|
|
17
|
+
measured, before they are shown, so many rows of notes scroll as rows of one height do. The first row in view stays
|
|
18
|
+
where it is while rows above it are measured, when a column's width changes and when wrapping is turned on or off; a
|
|
19
|
+
row brought into view by the keys stays whole once it is measured, and Page Up and Page Down count the rows that fit
|
|
20
|
+
by their heights. The header, filter, group and summary rows keep one height, and a grid with no such column works as
|
|
21
|
+
before. An Excel export sets the column's data cells to wrap their text, and a PDF export wraps them unless
|
|
22
|
+
`wordWrapEnabled` says otherwise. `wrap` can be a function, or changed with `columnOption`.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- `DataGrid.addRow()` called while the rows load (before the first of them arrive, before the grid is on the page, or
|
|
27
|
+
after the sort changes) waits for them (#9). It placed the new row as if the grid had no rows: the row was added
|
|
28
|
+
(`changes.added`) but never drawn, and no editor opened. It now opens the row once the rows arrive, as it does after
|
|
29
|
+
the load: on the last page in paged mode, with its editor open and the given values filled in. It resolves `false`
|
|
30
|
+
if the grid is disposed first.
|
|
31
|
+
|
|
9
32
|
## [0.1.0-beta.17] - 2026-11-28
|
|
10
33
|
|
|
11
34
|
Needs `@motifx/core` 1.2.0-rc.31 and `@motifx-community/data` 0.1.0-beta.3.
|
|
@@ -342,7 +342,8 @@ export declare class DataGrid<T = any> extends Control<HTMLDivElement, DataGridP
|
|
|
342
342
|
* Opens a new row, as the "New row" button does: at the bottom (the grid moves to the end, and a
|
|
343
343
|
* virtual list loads only the last block) or at the top, with the first cell a new row can fill in
|
|
344
344
|
* edit mode. The row being edited is left first, and no row is added if it cannot be left. `values`
|
|
345
|
-
* fill the new row as if typed.
|
|
345
|
+
* fill the new row as if typed. While the rows load (before the first of them arrive, or after the
|
|
346
|
+
* sort changes), it waits for them; `false` if the grid is disposed first.
|
|
346
347
|
*/
|
|
347
348
|
addRow(values?: Partial<T>): Promise<boolean>;
|
|
348
349
|
/**
|
|
@@ -74,6 +74,12 @@ export interface GridColumn<T = any> {
|
|
|
74
74
|
hidden?: boolean;
|
|
75
75
|
/** The horizontal alignment. By default, `end` for numbers, `center` for booleans and `start` otherwise. */
|
|
76
76
|
align?: 'start' | 'center' | 'end';
|
|
77
|
+
/**
|
|
78
|
+
* The text of the column's cells wraps onto more lines, and a row grows to hold its tallest cell, never shorter than
|
|
79
|
+
* the rows' height. A line break in the text starts a new line. A grid without such a column keeps all its rows one
|
|
80
|
+
* height. A function is tracked.
|
|
81
|
+
*/
|
|
82
|
+
wrap?: Bind<boolean>;
|
|
77
83
|
/** Reads the value in place of `row[field]`. */
|
|
78
84
|
value?: (row: T) => unknown;
|
|
79
85
|
/**
|
|
@@ -102,6 +102,8 @@ export declare class ColumnModel<T> {
|
|
|
102
102
|
title(field: string): string;
|
|
103
103
|
/** Alignment of the column's cells: its own, else by type. */
|
|
104
104
|
align(field: string): 'start' | 'center' | 'end';
|
|
105
|
+
/** Whether the text of the column's cells wraps onto more lines (`wrap`); the grid's own columns never do. */
|
|
106
|
+
wraps(field: string): boolean;
|
|
105
107
|
/** Where a band's caption sits: its own, else the `bandAlign` setting. */
|
|
106
108
|
bandAlign(id: string): 'start' | 'center' | 'end';
|
|
107
109
|
/** Whether the user may use `feature` on this column or band: its own value, else the grid's. */
|
|
@@ -66,6 +66,8 @@ export declare class GridModel<T> {
|
|
|
66
66
|
/** Tells the views that fields of `state` changed (`grid.` and the field). */
|
|
67
67
|
stateChanged(...fields: (keyof GridState & string)[]): void;
|
|
68
68
|
readonly state: GridState;
|
|
69
|
+
/** Set when the grid is disposed: a wait for the rows ends with it. */
|
|
70
|
+
private readonly life;
|
|
69
71
|
/** The new-row area, in display order. */
|
|
70
72
|
readonly addedRows: AddedRow<T>[];
|
|
71
73
|
/** The rows, their source and their unsaved changes; recreated when the data props change. */
|
|
@@ -165,6 +167,8 @@ export declare class GridModel<T> {
|
|
|
165
167
|
loadMore(): boolean;
|
|
166
168
|
/** Infinite mode: loads part after part until `rows` rows show (or every row does); whether they do. */
|
|
167
169
|
loadTo(rows: number): Promise<boolean>;
|
|
170
|
+
/** Resolves once the rows the grid waits for have arrived, or failed to: `false` when the grid is disposed first. */
|
|
171
|
+
rowsLoaded(): Promise<boolean>;
|
|
168
172
|
/** Infinite mode: what the indicator under the rows shows (`loadMoreIndicator`): a part loading, a part that failed, or nothing. Reactive. */
|
|
169
173
|
moreState(): 'loading' | 'failed' | null;
|
|
170
174
|
get saveMode(): data.SaveMode;
|
|
@@ -2,7 +2,7 @@ import type { ComponentBase } from '@motifx/core';
|
|
|
2
2
|
import type { ColumnModel } from '../model/ColumnModel';
|
|
3
3
|
import type { StickyOffset } from '../model/sticky-offset';
|
|
4
4
|
/**
|
|
5
|
-
* Per-column CSS of one grid: columns not shown, the tracks of the columns pinned to the end, alignment and sticky offsets, written as rules keyed
|
|
5
|
+
* Per-column CSS of one grid: columns not shown, the tracks of the columns pinned to the end, alignment, wrapping and sticky offsets, written as rules keyed
|
|
6
6
|
* by `data-field` (a pinned band's header by `data-band`, at the offset of its columns). Changing a width or pinning a column rewrites this sheet only; no cell gets a
|
|
7
7
|
* binding of its own and no row is touched. A rule finds the rows through the parts that hold them (the head, the body,
|
|
8
8
|
* the foot, the copy of a dragged row), which carry the grid's id, and goes on by child combinators only: the rows of a
|
|
@@ -21,12 +21,16 @@ export declare class ColumnStyles<T> {
|
|
|
21
21
|
private style;
|
|
22
22
|
private stopWatch;
|
|
23
23
|
constructor(columns: ColumnModel<T>, gridId: string);
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* `placed`: every column's cells get their track by number, so a row may leave out the cells of columns not drawn (virtual
|
|
26
|
+
* columns). `wrap`: the columns whose cells wrap their text; with any, a data row (in the body, and its copy while it is
|
|
27
|
+
* dragged) is as tall as its tallest cell.
|
|
28
|
+
*/
|
|
25
29
|
update(visible: string[], offsets: Map<string, StickyOffset>, align: Map<string, string>, bands?: readonly {
|
|
26
30
|
id: string;
|
|
27
31
|
first: number;
|
|
28
32
|
count: number;
|
|
29
|
-
}[], placed?: boolean): void;
|
|
33
|
+
}[], placed?: boolean, wrap?: ReadonlySet<string>): void;
|
|
30
34
|
attach(owner: ComponentBase): void;
|
|
31
35
|
detach(): void;
|
|
32
36
|
private drop;
|
|
@@ -21,7 +21,11 @@ import { GroupRow } from './GroupRow';
|
|
|
21
21
|
* detail of the one row that has it open (the columns the width hides) is a detail row too, right
|
|
22
22
|
* under its row and before its details. The viewport is read with the measuring layer: a layout asked for
|
|
23
23
|
* runs at once with the viewport as last read (and as the body scrolled it), and again with the next round
|
|
24
|
-
* if the viewport turns out to be elsewhere; the sizes of details and of the edit form are watched.
|
|
24
|
+
* if the viewport turns out to be elsewhere; the sizes of details and of the edit form are watched. While a
|
|
25
|
+
* column wraps its text, a data row is as tall as its cells: the rows drawn are measured in the round after
|
|
26
|
+
* they are laid out, before the screen is drawn, and again when one changes size; what they add over the
|
|
27
|
+
* rows' height is kept by position (`RowHeights`), and the first row in view stays where it stood when the
|
|
28
|
+
* rows above it come out taller or shorter.
|
|
25
29
|
*/
|
|
26
30
|
export declare class GridBody<T> extends Component<HTMLDivElement> {
|
|
27
31
|
private readonly grid;
|
|
@@ -85,12 +89,57 @@ export declare class GridBody<T> extends Component<HTMLDivElement> {
|
|
|
85
89
|
private dropLine;
|
|
86
90
|
/** The row a dragged row would be dropped onto. */
|
|
87
91
|
private dropRow;
|
|
92
|
+
/** Whether a column wraps its text: data rows are as tall as their cells, measured as they are drawn. */
|
|
93
|
+
private wrapping;
|
|
94
|
+
/** The columns and widths the rows were measured for. */
|
|
95
|
+
private wrapFor;
|
|
96
|
+
/** What the rows laid out add over the rows' height, and the rows and height that was found for. */
|
|
97
|
+
private heights;
|
|
98
|
+
private heightsFor;
|
|
99
|
+
/** The size watches of the pooled rows, while rows are measured. */
|
|
100
|
+
private readonly rowWatches;
|
|
101
|
+
/**
|
|
102
|
+
* The row kept in place after the last layout, the first in view or the one `reveal` brought in: its position, its id,
|
|
103
|
+
* how far below the top of the view its top (or its bottom, `edge`) stood, and the scroll then.
|
|
104
|
+
*/
|
|
105
|
+
private anchor;
|
|
106
|
+
/** The row `reveal` brought into view, at the edge it was brought to: kept there while rows are measured, until the view is scrolled. */
|
|
107
|
+
private pinned;
|
|
88
108
|
constructor(grid: GridModel<T>,
|
|
89
109
|
/** The grid's viewport, the scroller the body sits in; `null` before it is made. */
|
|
90
110
|
viewport: () => ComponentBase | null, widths: ActionWidths, host: Omit<DetailHost<T>, 'owner'>);
|
|
91
111
|
onConfigured(): void;
|
|
92
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Geometry of the rows the body lays out (all rows, or one page); the edit form's row is as tall as the form, open details
|
|
114
|
+
* and the adaptive detail add their height, and so do rows taller than the others while a column wraps.
|
|
115
|
+
*/
|
|
93
116
|
geometry(): ScrollGeometry;
|
|
117
|
+
/**
|
|
118
|
+
* Whether a column wraps its text, and the columns and widths that is for (`key`): with one, rows are measured as they
|
|
119
|
+
* are drawn and when they change size; another key has the rows drawn measured again.
|
|
120
|
+
*/
|
|
121
|
+
setWrap(on: boolean, key: string): void;
|
|
122
|
+
/** Scrolls so that a row noted in the view (`anchor`) stands where it stood, in the rows as they are now. */
|
|
123
|
+
private scrollToAnchor;
|
|
124
|
+
/** What the rows laid out add over the rows' height while a column wraps; found again for other rows or another height. */
|
|
125
|
+
private rowHeights;
|
|
126
|
+
/** Watches a pooled row's size while rows are measured: a row that changes size (its content drawn again) is measured again. */
|
|
127
|
+
private watchRow;
|
|
128
|
+
/** A row drawn came out another size than it was measured at: the rows after it move, with the next round. */
|
|
129
|
+
private rowResized;
|
|
130
|
+
/** The heights of the data rows drawn, read after they were laid out. */
|
|
131
|
+
private readonly readHeights;
|
|
132
|
+
/** Rows that came out another height: the rows are laid out again, the first row in view where it stood. */
|
|
133
|
+
private readonly writeHeights;
|
|
134
|
+
/**
|
|
135
|
+
* While rows are measured, the first row in view stays where it stood when what the rows above it add changed (they were
|
|
136
|
+
* measured, or found again), unless the view was scrolled since: returns the scroll the rows are laid out for.
|
|
137
|
+
*/
|
|
138
|
+
private keepAnchor;
|
|
139
|
+
/** Notes the row to keep where it stands (`keepAnchor`): the one `reveal` brought in, else the first that starts in view. */
|
|
140
|
+
private noteAnchor;
|
|
141
|
+
/** While rows are measured, a row `reveal` scrolled to stays at the edge it came to (`v`: the view's new top). */
|
|
142
|
+
private pin;
|
|
94
143
|
/** The details drawn now, the adaptive detail among them, in grid order (a row's adaptive detail before its details). */
|
|
95
144
|
drawnDetails(): DetailRow<T>[];
|
|
96
145
|
/** The adaptive detail drawn under grid row `index`. */
|
|
@@ -164,8 +213,11 @@ export declare class GridBody<T> extends Component<HTMLDivElement> {
|
|
|
164
213
|
reveal(index: number, align?: 'nearest' | 'start' | 'end'): void;
|
|
165
214
|
/** Back to the first row (after a sort change); the rows follow with the next round. */
|
|
166
215
|
toStart(): void;
|
|
167
|
-
/**
|
|
168
|
-
|
|
216
|
+
/**
|
|
217
|
+
* Rows the viewport shows fully, for PageUp/PageDown: a screen of rows down (`down`) or up from grid row `from`, counted
|
|
218
|
+
* by their heights while some are taller than the others.
|
|
219
|
+
*/
|
|
220
|
+
pageRows(from?: number, down?: boolean): number;
|
|
169
221
|
/** The pooled row that shows grid row `index`, if it is drawn. */
|
|
170
222
|
rowAt(index: number): GridRow<T> | undefined;
|
|
171
223
|
/** The cell of grid row `index`, if that row is drawn; a group row's one cell, or a group footer itself, for any field. */
|
package/dist/excel/index.js
CHANGED
|
@@ -195,7 +195,7 @@ function writeCell(excelCell, cell, rowType, index, col, writer, rtl, options) {
|
|
|
195
195
|
horizontal: align === "center" ? "center" : align === "end" !== rtl ? "right" : "left",
|
|
196
196
|
vertical: "top"
|
|
197
197
|
};
|
|
198
|
-
if (typeof value === "string" && value.includes("\n")) alignment.wrapText = true;
|
|
198
|
+
if (typeof value === "string" && (value.includes("\n") || rowType === "data" && col.wrap)) alignment.wrapText = true;
|
|
199
199
|
excelCell.alignment = alignment;
|
|
200
200
|
if (rowType !== "data") return;
|
|
201
201
|
if (typeof value === "number" && writer.number) {
|
package/dist/excel/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Worksheet","CellRange","ExcelExportOptions","writeSheet","exportDataGrid","options","T","Promise","reject","TypeError","component","worksheet","exportSheet","start","topLeft","topLeftCell","format","selectedRowsOnly","headers","groups","summaries","pageSize","onProgress","signal","loadPanel","sheet","customizeCell","cell","excelCell","gridCell","given","row","column","getCell","Number","col","topLeft","Cell","Worksheet","PivotGridSheet","PivotGridSheetCell","sliceSheet","CellRange","ExcelPivotExportOptions","ExcelPivotExportResult","writeSheet","ExcelSheetOptions","EXCEL_LIMITS","rows","columns","NAME_LENGTH","exportPivotGrid","options","T","Promise","reject","TypeError","component","worksheet","exportSheet","chartData","start","topLeft","topLeftCell","format","headers","onProgress","signal","loadPanel","sheet","tree","rowHeaderLayout","customize","cell","excelCell","p","pivotCell","area","kind","path","length","alignment","indent","customizeCell","writePivotSheets","autoFilterEnabled","booleanText","first","row","column","limits","head","headerRows","side","headerColumns","rowsEach","columnsEach","RangeError","rowParts","Math","max","ceil","columnParts","worksheets","range","r","c","addSheet","part","written","push","n","workbook","named","k","name","slice","String","getWorksheet","addWorksheet","given","getCell","Number","col"],"sources":["../../src/excel/date-format.ts","../../src/excel/number-format.ts","../../src/excel/write-sheet.ts","../../src/excel/export-data-grid.ts","../../src/excel/export-pivot-grid.ts"],"sourcesContent":["/** A day whose parts can be told apart: month 2, day 3, hour 4 (one digit each unless padded). */\r\nconst SAMPLE = new Date(2009, 1, 3, 4, 5, 6, 789);\r\n\r\n/**\r\n * The Excel number format that displays a date as `format` (an `Intl.DateTimeFormat`) writes it, in\r\n * the same order and with the same separators: `dd.mm.yyyy`, `m/d/yy h:mm AM/PM`, `d mmmm yyyy`. Month\r\n * and day names are Excel's own, in the language of the computer that opens the file.\r\n */\r\nexport function excelDateFormat(format: Intl.DateTimeFormat): string {\r\n const locale = format.resolvedOptions().locale;\r\n const longMonth = new Intl.DateTimeFormat(locale, { month: 'long' }).format(SAMPLE);\r\n const longDay = new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(SAMPLE);\r\n return format\r\n .formatToParts(SAMPLE)\r\n .map((p) => {\r\n const v = p.value;\r\n switch (p.type) {\r\n case 'year':\r\n return v.length === 2 ? 'yy' : 'yyyy';\r\n case 'month':\r\n if (/^\\d+$/.test(v)) return v.length === 1 ? 'm' : 'mm';\r\n return v === longMonth ? 'mmmm' : [...v].length === 1 ? 'mmmmm' : 'mmm';\r\n case 'day':\r\n return v.length === 1 ? 'd' : 'dd';\r\n case 'weekday':\r\n return v === longDay ? 'dddd' : 'ddd';\r\n case 'hour':\r\n return v.length === 1 ? 'h' : 'hh';\r\n case 'minute':\r\n return 'mm';\r\n case 'second':\r\n return 'ss';\r\n case 'fractionalSecond':\r\n return '0'.repeat(v.length);\r\n case 'dayPeriod':\r\n return 'AM/PM';\r\n case 'literal':\r\n return [...v].map((ch) => (ch === ' ' ? ' ' : `\\\\${ch}`)).join('');\r\n default:\r\n // Eras and time zone names have no Excel code.\r\n return '';\r\n }\r\n })\r\n .join('');\r\n}\r\n","const NUMBER_PARTS = new Set(['integer', 'group', 'decimal', 'fraction', 'exponentSeparator', 'exponentMinusSign', 'exponentInteger', 'nan', 'infinity']);\r\n\r\n/** Text Excel shows as it is in a number format. */\r\nfunction formatLiteral(text: string): string {\r\n if (text === '') return '';\r\n return text.includes('\"') ? [...text].map((ch) => `\\\\${ch}`).join('') : `\"${text}\"`;\r\n}\r\n\r\n/**\r\n * The Excel number format that displays `value` as `format` (an `Intl.NumberFormat`) writes it: the\r\n * grouping, the fraction digits the value shows, a percent, a currency symbol where the locale puts\r\n * it, and a scientific exponent. Returns `undefined` for what Excel cannot write (compact notation, units).\r\n */\r\nexport function excelNumberFormat(format: Intl.NumberFormat, value: number): string | undefined {\r\n if (!Number.isFinite(value)) return undefined;\r\n const o = format.resolvedOptions();\r\n if (o.notation === 'compact' || o.style === 'unit') return undefined;\r\n const positive = section(format.formatToParts(Math.abs(value)), o);\r\n const negative = format.formatToParts(-Math.abs(value) || -1);\r\n // Excel puts a minus in front by itself; a second section only when the locale writes it otherwise.\r\n if (negative[0]?.type === 'minusSign' && section(negative.slice(1), o) === positive) return positive;\r\n return `${positive};${section(negative, o)}`;\r\n}\r\n\r\nfunction section(parts: readonly Intl.NumberFormatPart[], o: Intl.ResolvedNumberFormatOptions): string {\r\n const first = parts.findIndex((p) => NUMBER_PARTS.has(p.type));\r\n let last = -1;\r\n parts.forEach((p, i) => {\r\n if (NUMBER_PARTS.has(p.type)) last = i;\r\n });\r\n if (first < 0) return 'General';\r\n const fraction = parts.find((p) => p.type === 'fraction')?.value.length ?? 0;\r\n const grouping = (o.useGrouping as unknown) !== false && (o.useGrouping as unknown) !== 'false';\r\n const digits = Math.max(1, o.minimumIntegerDigits ?? 1);\r\n const integer = grouping && digits <= 3 ? `#,${'#'.repeat(3 - digits)}${'0'.repeat(digits)}` : '0'.repeat(digits);\r\n let core = integer + (fraction ? `.${'0'.repeat(fraction)}` : '');\r\n if (o.notation === 'scientific' || o.notation === 'engineering') core = `${'0'.repeat(digits)}${fraction ? `.${'0'.repeat(fraction)}` : ''}E+00`;\r\n return around(parts.slice(0, first)) + core + around(parts.slice(last + 1));\r\n}\r\n\r\n/** The parts before or after the number: a percent sign as Excel's `%`, the rest as quoted text. */\r\nfunction around(parts: readonly Intl.NumberFormatPart[]): string {\r\n let out = '';\r\n let text = '';\r\n for (const p of parts) {\r\n if (p.type !== 'percentSign') {\r\n text += p.value;\r\n continue;\r\n }\r\n out += `${formatLiteral(text)}%`;\r\n text = '';\r\n }\r\n return out + formatLiteral(text);\r\n}\r\n","import type { Alignment, Cell, Worksheet } from 'exceljs';\r\nimport { guardFormula } from '../parts/table/formula-guard';\r\nimport type { TableSheet } from '../parts/table/table-sheet';\r\nimport type { TableSheetCell } from '../parts/table/table-sheet-cell';\r\nimport type { TableSheetColumn } from '../parts/table/table-sheet-column';\r\nimport type { TableSheetRow } from '../parts/table/table-sheet-row';\r\nimport type { CellRange } from './cell-range';\r\nimport { excelDateFormat } from './date-format';\r\nimport type { ExcelExportOptions } from './excel-export-options';\r\nimport { excelNumberFormat } from './number-format';\r\n\r\n/** What the writer reads of an export's options. */\r\nexport type ExcelSheetOptions = Pick<ExcelExportOptions, 'keepColumnWidths' | 'numberFormats' | 'outline' | 'encodeExecutableContent' | 'frozenHeader' | 'autoFilterEnabled' | 'mergeHeaders' | 'booleanText'>;\r\n\r\n/** Pixels of one character of Excel's default font (Calibri 11), which column widths count in. */\r\nconst DIGIT_WIDTH = 7;\r\n/** Excel's widest column, in characters. */\r\nconst MAX_WIDTH = 255;\r\n/** Excel's deepest outline. */\r\nconst MAX_LEVEL = 7;\r\n\r\ntype RowType = TableSheetRow['rowType'];\r\n\r\n/** How a column's cells are written: its number and date formats. */\r\ninterface ColumnWriter {\r\n number: Intl.NumberFormat | null;\r\n date: string | null;\r\n /** Number formats by the fraction digits a value shows. */\r\n numbers: Map<string, string | undefined>;\r\n}\r\n\r\n/**\r\n * Writes a sheet to an ExcelJS worksheet from `start`: the rows with their outline levels, numbers and dates with\r\n * formats made from their column's `Intl` options, the header frozen and merged as the sheet says. `customize` is\r\n * called for every written cell. The export functions of the components write their sheets with it.\r\n */\r\nexport function writeSheet<C extends TableSheetCell>(sheet: TableSheet<C>, worksheet: Worksheet, start: { row: number; column: number }, options: ExcelSheetOptions, customize?: (cell: C, excelCell: Cell) => void): CellRange {\r\n const cols = sheet.columns;\r\n const range: CellRange = { from: { ...start }, to: { row: start.row, column: start.column + Math.max(0, cols.length - 1) } };\r\n worksheet.properties.outlineProperties = { summaryBelow: false, summaryRight: false };\r\n if (options.keepColumnWidths !== false) {\r\n cols.forEach((col, j) => {\r\n if (col.width > 0) worksheet.getColumn(start.column + j).width = Math.min(MAX_WIDTH, Math.floor((col.width / DIGIT_WIDTH) * 100) / 100);\r\n });\r\n }\r\n const formats = options.numberFormats !== false;\r\n const writers = cols.map(\r\n (col): ColumnWriter => ({\r\n number: formats && col.numberFormat ? new Intl.NumberFormat(sheet.locale, col.numberFormat) : null,\r\n date: formats && col.dateFormat ? excelDateFormat(new Intl.DateTimeFormat(sheet.locale, col.dateFormat)) : null,\r\n numbers: new Map(),\r\n }),\r\n );\r\n // A cell with formats of its own has a writer per set of them.\r\n const own = new Map<string, ColumnWriter>();\r\n const writerOf = (cell: C, j: number): ColumnWriter => {\r\n if (!formats || (!cell.numberFormat && !cell.dateFormat)) return writers[j];\r\n const key = JSON.stringify([cell.numberFormat ?? null, cell.dateFormat ?? null]);\r\n let writer = own.get(key);\r\n if (!writer) {\r\n writer = { number: cell.numberFormat ? new Intl.NumberFormat(sheet.locale, cell.numberFormat) : null, date: cell.dateFormat ? excelDateFormat(new Intl.DateTimeFormat(sheet.locale, cell.dateFormat)) : null, numbers: new Map() };\r\n own.set(key, writer);\r\n }\r\n return writer;\r\n };\r\n sheet.rows.forEach((row, i) => {\r\n const excelRow = worksheet.getRow(start.row + i);\r\n if (row.rowType !== 'header' && options.outline !== false) excelRow.outlineLevel = Math.min(MAX_LEVEL, row.level);\r\n row.cells.forEach((cell, j) => {\r\n const excelCell = excelRow.getCell(start.column + j);\r\n writeCell(excelCell, cell, row.rowType, j, cols[j], writerOf(cell, j), sheet.rtl, options);\r\n customize?.(cell, excelCell);\r\n if (options.encodeExecutableContent && typeof excelCell.value === 'string') excelCell.value = guardFormula(excelCell.value);\r\n });\r\n range.to.row = start.row + i;\r\n });\r\n const view = { ...(worksheet.views[0] ?? {}) };\r\n if (sheet.rtl) view.rightToLeft = true;\r\n // The columns of row headers stay in view beside the header rows.\r\n const headerColumns = sheet.headerColumns ?? 0;\r\n if (headerColumns > 0 && options.frozenHeader !== false && !('state' in view)) {\r\n Object.assign(view, { state: 'frozen', xSplit: start.column + headerColumns - 1, ...(sheet.headerRows > 0 ? { ySplit: start.row + sheet.headerRows - 1 } : {}) });\r\n }\r\n if (sheet.headerRows > 0) {\r\n if (options.frozenHeader !== false && !('state' in view)) Object.assign(view, { state: 'frozen', ySplit: start.row + sheet.headerRows - 1 });\r\n if (options.autoFilterEnabled && !worksheet.autoFilter && sheet.rows.length > 0) worksheet.autoFilter = { from: { row: start.row + sheet.headerRows - 1, column: start.column }, to: { ...range.to } };\r\n }\r\n if (Object.keys(view).length) worksheet.views = [view];\r\n // A band's title over its columns, a column's title down the band rows above it.\r\n if (options.mergeHeaders !== false) {\r\n for (const m of sheet.merges ?? []) worksheet.mergeCells(start.row + m.row, start.column + m.column, start.row + m.row + m.rows - 1, start.column + m.column + m.columns - 1);\r\n }\r\n return range;\r\n}\r\n\r\nfunction writeCell(excelCell: Cell, cell: TableSheetCell, rowType: RowType, index: number, col: TableSheetColumn, writer: ColumnWriter, rtl: boolean, options: ExcelSheetOptions) {\r\n const value = cell.value;\r\n if (value instanceof Date) excelCell.value = excelDate(value);\r\n else if (typeof value === 'boolean' && options.booleanText) excelCell.value = cell.text;\r\n else excelCell.value = value;\r\n if (value === null) return;\r\n const header = rowType === 'header';\r\n const groupText = rowType === 'group' && index === 0;\r\n // Header, group, summary and total cells are bold; the header centered, a group's text at the start.\r\n if (rowType !== 'data' || cell.strong) excelCell.font = { ...excelCell.font, bold: true };\r\n const align = header ? 'center' : groupText ? 'start' : col.align;\r\n const alignment: Partial<Alignment> = { ...excelCell.alignment, horizontal: align === 'center' ? 'center' : (align === 'end') !== rtl ? 'right' : 'left', vertical: 'top' };\r\n if (typeof value === 'string' && value.includes('\\n')) alignment.wrapText = true;\r\n excelCell.alignment = alignment;\r\n if (rowType !== 'data') return;\r\n if (typeof value === 'number' && writer.number) {\r\n const numFmt = numberFormatOf(writer, value);\r\n if (numFmt) excelCell.numFmt = numFmt;\r\n } else if (value instanceof Date && writer.date) {\r\n excelCell.numFmt = writer.date;\r\n } else if (typeof value === 'string' && /^[@=+-]/.test(value)) {\r\n // Text, so Excel does not read it as a formula when the cell is edited.\r\n excelCell.numFmt = '@';\r\n }\r\n}\r\n\r\nfunction numberFormatOf(writer: ColumnWriter, value: number): string | undefined {\r\n // The format depends only on the fraction digits a value shows: calculated once per count.\r\n const shown = writer.number!.formatToParts(Math.abs(value));\r\n const key = `${shown.find((p) => p.type === 'fraction')?.value.length ?? 0}`;\r\n if (!writer.numbers.has(key)) writer.numbers.set(key, excelNumberFormat(writer.number!, value));\r\n return writer.numbers.get(key);\r\n}\r\n\r\n/** ExcelJS writes a date as UTC: the local day and time are moved there, so Excel shows what the grid shows. */\r\nfunction excelDate(date: Date): Date {\r\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\r\n}\r\n","import type { Worksheet } from 'exceljs';\r\nimport type { CellRange } from './cell-range';\r\nimport type { ExcelExportOptions } from './excel-export-options';\r\nimport { writeSheet } from './write-sheet';\r\n\r\n/**\r\n * Writes a DataGrid to an ExcelJS worksheet: the header row, the group rows (\"Column: value\", with\r\n * their summaries) with outline levels, the data rows in the grid's order with its filter, search and\r\n * grouping (every matching row, loaded in parts from a server), the group footers and the totals.\r\n * Numbers stay numbers with a number format created from the column's `Intl` format, dates stay dates,\r\n * yes/no cells are `TRUE` / `FALSE`, and lookup and list cells hold their text. Provide your own ExcelJS:\r\n * create the workbook and the worksheet, then save the workbook when the promise resolves with the cells written.\r\n *\r\n * @example\r\n * onExporting={(e) => {\r\n * if (e.format !== 'xlsx') return;\r\n * const workbook = new ExcelJS.Workbook();\r\n * exportDataGrid({ component: e.component, worksheet: workbook.addWorksheet('Orders'), selectedRowsOnly: e.selectedRowsOnly })\r\n * .then(() => workbook.xlsx.writeBuffer())\r\n * .then((buffer) => saveFile(new Blob([buffer]), 'Orders.xlsx'));\r\n * }}\r\n */\r\nexport function exportDataGrid<T = any>(options: ExcelExportOptions<T>): Promise<CellRange> {\r\n if (!options || typeof options !== 'object') return Promise.reject(new TypeError('exportDataGrid needs an options object.'));\r\n const { component, worksheet } = options;\r\n if (!component || typeof component.exportSheet !== 'function') return Promise.reject(new TypeError('exportDataGrid: `component` must be a DataGrid.'));\r\n if (!worksheet || typeof worksheet !== 'object') return Promise.reject(new TypeError('exportDataGrid: `worksheet` must be an ExcelJS worksheet.'));\r\n const start = topLeft(worksheet, options.topLeftCell);\r\n return component.exportSheet(\r\n {\r\n format: 'xlsx',\r\n selectedRowsOnly: options.selectedRowsOnly,\r\n headers: options.headers,\r\n groups: options.groups,\r\n summaries: options.summaries,\r\n pageSize: options.pageSize,\r\n onProgress: options.onProgress,\r\n signal: options.signal,\r\n loadPanel: options.loadPanel ?? true,\r\n },\r\n (sheet) => writeSheet(sheet, worksheet, start, options, options.customizeCell && ((cell, excelCell) => options.customizeCell!({ gridCell: cell.gridCell, excelCell }))),\r\n );\r\n}\r\n\r\nfunction topLeft(worksheet: Worksheet, given: ExcelExportOptions['topLeftCell']): { row: number; column: number } {\r\n if (typeof given === 'string') {\r\n const cell = worksheet.getCell(given);\r\n return { row: Number(cell.row), column: Number(cell.col) };\r\n }\r\n return { row: given?.row ?? 1, column: given?.column ?? 1 };\r\n}\r\n","import type { Cell, Worksheet } from 'exceljs';\r\nimport type { PivotGridSheet, PivotGridSheetCell } from '../components/pivotgrid/pivot-grid-sheet';\r\nimport { sliceSheet } from '../parts/table/slice-sheet';\r\nimport type { CellRange } from './cell-range';\r\nimport type { ExcelPivotExportOptions } from './excel-pivot-export-options';\r\nimport type { ExcelPivotExportResult } from './excel-pivot-export-result';\r\nimport { writeSheet, type ExcelSheetOptions } from './write-sheet';\r\n\r\n/** Excel's rows and columns in a worksheet. */\r\nconst EXCEL_LIMITS = { rows: 1_048_576, columns: 16_384 };\r\n/** Excel's longest worksheet name. */\r\nconst NAME_LENGTH = 31;\r\n\r\n/**\r\n * Writes a PivotGrid to an ExcelJS worksheet: the rows of column headers (merged over the columns they cover) and the\r\n * corner, then a row per line of the table with its row headers (merged down the lines they cover), every open member's\r\n * (read whole where the pivot is read in parts). Numbers stay numbers with the format their cells show them with, totals\r\n * are bold, and the headers stay in view. A table larger than a worksheet (1,048,576 rows, 16,384 columns) goes on in\r\n * worksheets added after it, each with the rows of column headers and the columns of row headers again. Provide your own\r\n * ExcelJS: create the workbook and the worksheet, then save the workbook when the promise resolves.\r\n *\r\n * @example\r\n * onExporting={(e) => {\r\n * if (e.format !== 'xlsx') return;\r\n * const workbook = new ExcelJS.Workbook();\r\n * exportPivotGrid({ component: e.component, worksheet: workbook.addWorksheet('Sales') })\r\n * .then(() => workbook.xlsx.writeBuffer())\r\n * .then((buffer) => saveFile(new Blob([buffer]), 'Sales.xlsx'));\r\n * }}\r\n */\r\nexport function exportPivotGrid<T = any>(options: ExcelPivotExportOptions<T>): Promise<ExcelPivotExportResult> {\r\n if (!options || typeof options !== 'object') return Promise.reject(new TypeError('exportPivotGrid needs an options object.'));\r\n const { component, worksheet } = options;\r\n if (!component || typeof component.exportSheet !== 'function' || typeof component.chartData !== 'function') return Promise.reject(new TypeError('exportPivotGrid: `component` must be a PivotGrid.'));\r\n if (!worksheet || typeof worksheet !== 'object') return Promise.reject(new TypeError('exportPivotGrid: `worksheet` must be an ExcelJS worksheet.'));\r\n const start = topLeft(worksheet, options.topLeftCell);\r\n return component.exportSheet({ format: 'xlsx', headers: options.headers, onProgress: options.onProgress, signal: options.signal, loadPanel: options.loadPanel ?? true }, (sheet) => {\r\n const tree = sheet.rowHeaderLayout === 'tree';\r\n const customize = (cell: PivotGridSheetCell<T>, excelCell: Cell) => {\r\n // A member's header in the tree layout is indented by its level, as the pivot shows it.\r\n const p = cell.pivotCell;\r\n if (tree && p.area === 'row' && p.kind !== 'dataField' && (p.path?.length ?? 0) > 1) excelCell.alignment = { ...excelCell.alignment, indent: p.path!.length - 1 };\r\n options.customizeCell?.({ pivotCell: p, excelCell });\r\n };\r\n return writePivotSheets(sheet, worksheet, start, { ...options, autoFilterEnabled: false, booleanText: false }, customize);\r\n });\r\n}\r\n\r\n/**\r\n * Writes a pivot's sheet from `start` on a worksheet, and where it does not fit in one (`limits`), on worksheets added\r\n * after it: the rows by as many as fit, then the columns, each part under the rows of column headers and after the\r\n * columns of row headers again.\r\n */\r\nexport function writePivotSheets<T>(\r\n sheet: PivotGridSheet<T>,\r\n first: Worksheet,\r\n start: { row: number; column: number },\r\n options: ExcelSheetOptions,\r\n customize: (cell: PivotGridSheetCell<T>, excelCell: Cell) => void,\r\n limits: { rows: number; columns: number } = EXCEL_LIMITS,\r\n): ExcelPivotExportResult {\r\n const head = sheet.headerRows;\r\n const side = sheet.headerColumns;\r\n const rowsEach = limits.rows - (start.row - 1) - head;\r\n const columnsEach = limits.columns - (start.column - 1) - side;\r\n if (rowsEach < 1 || columnsEach < 1) throw new RangeError('exportPivotGrid: the headers do not fit in a worksheet from `topLeftCell`.');\r\n const rowParts = Math.max(1, Math.ceil((sheet.rows.length - head) / rowsEach));\r\n const columnParts = Math.max(1, Math.ceil((sheet.columns.length - side) / columnsEach));\r\n const worksheets: Worksheet[] = [];\r\n let range: CellRange | null = null;\r\n for (let r = 0; r < rowParts; r++) {\r\n for (let c = 0; c < columnParts; c++) {\r\n const worksheet = worksheets.length ? addSheet(first, worksheets.length + 1) : first;\r\n const part = sliceSheet<PivotGridSheetCell<T>, PivotGridSheet<T>>(sheet, head + r * rowsEach, head + (r + 1) * rowsEach, side + c * columnsEach, side + (c + 1) * columnsEach);\r\n const written = writeSheet(part, worksheet, start, options, customize);\r\n range ??= written;\r\n worksheets.push(worksheet);\r\n }\r\n }\r\n return { ...range!, worksheets };\r\n}\r\n\r\n/** A worksheet after the first, named after it with its number: \"Sales (2)\". */\r\nfunction addSheet(first: Worksheet, n: number): Worksheet {\r\n const workbook = first.workbook;\r\n const named = (k: number) => `${first.name.slice(0, NAME_LENGTH - String(k).length - 3)} (${k})`;\r\n let k = n;\r\n while (workbook.getWorksheet(named(k))) k++;\r\n return workbook.addWorksheet(named(k));\r\n}\r\n\r\nfunction topLeft(worksheet: Worksheet, given: ExcelPivotExportOptions['topLeftCell']): { row: number; column: number } {\r\n if (typeof given === 'string') {\r\n const cell = worksheet.getCell(given);\r\n return { row: Number(cell.row), column: Number(cell.col) };\r\n }\r\n return { row: given?.row ?? 1, column: given?.column ?? 1 };\r\n}\r\n"],"mappings":";;;;AACA,IAAM,SAAS,IAAI,KAAK,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;;;;;;AAOhD,SAAgB,gBAAgB,QAAqC;CACnE,MAAM,SAAS,OAAO,gBAAgB,CAAC,CAAC;CACxC,MAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM;CAClF,MAAM,UAAU,IAAI,KAAK,eAAe,QAAQ,EAAE,SAAS,OAAO,CAAC,CAAC,CAAC,OAAO,MAAM;CAClF,OAAO,OACJ,cAAc,MAAM,CAAC,CACrB,KAAK,MAAM;EACV,MAAM,IAAI,EAAE;EACZ,QAAQ,EAAE,MAAV;GACE,KAAK,QACH,OAAO,EAAE,WAAW,IAAI,OAAO;GACjC,KAAK;IACH,IAAI,QAAQ,KAAK,CAAC,GAAG,OAA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ADHJ,WAAqD4B,OAAOsB,OAAOc,IAAIV,UAAUJ,QAAQc,IAAI,KAAKV,UAAUF,OAAOa,IAAIV,aAAaH,QAAQa,IAAI,KAAKV,WACvIY,GAAMlD,WAAWG,OAAOT,SAASoB,SAAS;EACrEgC,UAAUK;EACVN,WAAWO,KAAKpD,SAAS;CAC3B;CAEF,OAAO;EAAE,GAAG8C;EAAQD;CAAW;AACjC;;AAGA,SAASI,SAASpB,OAAkBwB,GAAsB;CACxD,MAAMC,WAAWzB,MAAMyB;CACvB,MAAMC,SAASC,MAAc,GAAG3B,MAAM4B,KAAKC,MAAM,GAAGlE,cAAcmE,OAAOH,CAAC,CAAC,CAAClC,SAAS,CAAC,EAAC,IAAKkC,EAAC;CAC7F,IAAIA,IAAIH;CACR,OAAOC,SAASM,aAAaL,MAAMC,CAAC,CAAC,GAAGA;CACxC,OAAOF,SAASO,aAAaN,MAAMC,CAAC,CAAC;AACvC;AAEA,SAASpD,QAAQJ,WAAsB8D,OAAgF;CACrH,IAAI,OAAOA,UAAU,UAAU;EAC7B,MAAM/C,OAAOf,UAAU+D,QAAQD,KAAK;EACpC,OAAO;GAAEhC,KAAKkC,OAAOjD,KAAKe,GAAG;GAAGC,QAAQiC,OAAOjD,KAAKkD,GAAG;EAAE;CAC3D;CACA,OAAO;EAAEnC,KAAKgC,OAAOhC,OAAO;EAAGC,QAAQ+B,OAAO/B,UAAU;CAAE;AAC5D"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Worksheet","CellRange","ExcelExportOptions","writeSheet","exportDataGrid","options","T","Promise","reject","TypeError","component","worksheet","exportSheet","start","topLeft","topLeftCell","format","selectedRowsOnly","headers","groups","summaries","pageSize","onProgress","signal","loadPanel","sheet","customizeCell","cell","excelCell","gridCell","given","row","column","getCell","Number","col","topLeft","Cell","Worksheet","PivotGridSheet","PivotGridSheetCell","sliceSheet","CellRange","ExcelPivotExportOptions","ExcelPivotExportResult","writeSheet","ExcelSheetOptions","EXCEL_LIMITS","rows","columns","NAME_LENGTH","exportPivotGrid","options","T","Promise","reject","TypeError","component","worksheet","exportSheet","chartData","start","topLeft","topLeftCell","format","headers","onProgress","signal","loadPanel","sheet","tree","rowHeaderLayout","customize","cell","excelCell","p","pivotCell","area","kind","path","length","alignment","indent","customizeCell","writePivotSheets","autoFilterEnabled","booleanText","first","row","column","limits","head","headerRows","side","headerColumns","rowsEach","columnsEach","RangeError","rowParts","Math","max","ceil","columnParts","worksheets","range","r","c","addSheet","part","written","push","n","workbook","named","k","name","slice","String","getWorksheet","addWorksheet","given","getCell","Number","col"],"sources":["../../src/excel/date-format.ts","../../src/excel/number-format.ts","../../src/excel/write-sheet.ts","../../src/excel/export-data-grid.ts","../../src/excel/export-pivot-grid.ts"],"sourcesContent":["/** A day whose parts can be told apart: month 2, day 3, hour 4 (one digit each unless padded). */\r\nconst SAMPLE = new Date(2009, 1, 3, 4, 5, 6, 789);\r\n\r\n/**\r\n * The Excel number format that displays a date as `format` (an `Intl.DateTimeFormat`) writes it, in\r\n * the same order and with the same separators: `dd.mm.yyyy`, `m/d/yy h:mm AM/PM`, `d mmmm yyyy`. Month\r\n * and day names are Excel's own, in the language of the computer that opens the file.\r\n */\r\nexport function excelDateFormat(format: Intl.DateTimeFormat): string {\r\n const locale = format.resolvedOptions().locale;\r\n const longMonth = new Intl.DateTimeFormat(locale, { month: 'long' }).format(SAMPLE);\r\n const longDay = new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(SAMPLE);\r\n return format\r\n .formatToParts(SAMPLE)\r\n .map((p) => {\r\n const v = p.value;\r\n switch (p.type) {\r\n case 'year':\r\n return v.length === 2 ? 'yy' : 'yyyy';\r\n case 'month':\r\n if (/^\\d+$/.test(v)) return v.length === 1 ? 'm' : 'mm';\r\n return v === longMonth ? 'mmmm' : [...v].length === 1 ? 'mmmmm' : 'mmm';\r\n case 'day':\r\n return v.length === 1 ? 'd' : 'dd';\r\n case 'weekday':\r\n return v === longDay ? 'dddd' : 'ddd';\r\n case 'hour':\r\n return v.length === 1 ? 'h' : 'hh';\r\n case 'minute':\r\n return 'mm';\r\n case 'second':\r\n return 'ss';\r\n case 'fractionalSecond':\r\n return '0'.repeat(v.length);\r\n case 'dayPeriod':\r\n return 'AM/PM';\r\n case 'literal':\r\n return [...v].map((ch) => (ch === ' ' ? ' ' : `\\\\${ch}`)).join('');\r\n default:\r\n // Eras and time zone names have no Excel code.\r\n return '';\r\n }\r\n })\r\n .join('');\r\n}\r\n","const NUMBER_PARTS = new Set(['integer', 'group', 'decimal', 'fraction', 'exponentSeparator', 'exponentMinusSign', 'exponentInteger', 'nan', 'infinity']);\r\n\r\n/** Text Excel shows as it is in a number format. */\r\nfunction formatLiteral(text: string): string {\r\n if (text === '') return '';\r\n return text.includes('\"') ? [...text].map((ch) => `\\\\${ch}`).join('') : `\"${text}\"`;\r\n}\r\n\r\n/**\r\n * The Excel number format that displays `value` as `format` (an `Intl.NumberFormat`) writes it: the\r\n * grouping, the fraction digits the value shows, a percent, a currency symbol where the locale puts\r\n * it, and a scientific exponent. Returns `undefined` for what Excel cannot write (compact notation, units).\r\n */\r\nexport function excelNumberFormat(format: Intl.NumberFormat, value: number): string | undefined {\r\n if (!Number.isFinite(value)) return undefined;\r\n const o = format.resolvedOptions();\r\n if (o.notation === 'compact' || o.style === 'unit') return undefined;\r\n const positive = section(format.formatToParts(Math.abs(value)), o);\r\n const negative = format.formatToParts(-Math.abs(value) || -1);\r\n // Excel puts a minus in front by itself; a second section only when the locale writes it otherwise.\r\n if (negative[0]?.type === 'minusSign' && section(negative.slice(1), o) === positive) return positive;\r\n return `${positive};${section(negative, o)}`;\r\n}\r\n\r\nfunction section(parts: readonly Intl.NumberFormatPart[], o: Intl.ResolvedNumberFormatOptions): string {\r\n const first = parts.findIndex((p) => NUMBER_PARTS.has(p.type));\r\n let last = -1;\r\n parts.forEach((p, i) => {\r\n if (NUMBER_PARTS.has(p.type)) last = i;\r\n });\r\n if (first < 0) return 'General';\r\n const fraction = parts.find((p) => p.type === 'fraction')?.value.length ?? 0;\r\n const grouping = (o.useGrouping as unknown) !== false && (o.useGrouping as unknown) !== 'false';\r\n const digits = Math.max(1, o.minimumIntegerDigits ?? 1);\r\n const integer = grouping && digits <= 3 ? `#,${'#'.repeat(3 - digits)}${'0'.repeat(digits)}` : '0'.repeat(digits);\r\n let core = integer + (fraction ? `.${'0'.repeat(fraction)}` : '');\r\n if (o.notation === 'scientific' || o.notation === 'engineering') core = `${'0'.repeat(digits)}${fraction ? `.${'0'.repeat(fraction)}` : ''}E+00`;\r\n return around(parts.slice(0, first)) + core + around(parts.slice(last + 1));\r\n}\r\n\r\n/** The parts before or after the number: a percent sign as Excel's `%`, the rest as quoted text. */\r\nfunction around(parts: readonly Intl.NumberFormatPart[]): string {\r\n let out = '';\r\n let text = '';\r\n for (const p of parts) {\r\n if (p.type !== 'percentSign') {\r\n text += p.value;\r\n continue;\r\n }\r\n out += `${formatLiteral(text)}%`;\r\n text = '';\r\n }\r\n return out + formatLiteral(text);\r\n}\r\n","import type { Alignment, Cell, Worksheet } from 'exceljs';\r\nimport { guardFormula } from '../parts/table/formula-guard';\r\nimport type { TableSheet } from '../parts/table/table-sheet';\r\nimport type { TableSheetCell } from '../parts/table/table-sheet-cell';\r\nimport type { TableSheetColumn } from '../parts/table/table-sheet-column';\r\nimport type { TableSheetRow } from '../parts/table/table-sheet-row';\r\nimport type { CellRange } from './cell-range';\r\nimport { excelDateFormat } from './date-format';\r\nimport type { ExcelExportOptions } from './excel-export-options';\r\nimport { excelNumberFormat } from './number-format';\r\n\r\n/** What the writer reads of an export's options. */\r\nexport type ExcelSheetOptions = Pick<ExcelExportOptions, 'keepColumnWidths' | 'numberFormats' | 'outline' | 'encodeExecutableContent' | 'frozenHeader' | 'autoFilterEnabled' | 'mergeHeaders' | 'booleanText'>;\r\n\r\n/** Pixels of one character of Excel's default font (Calibri 11), which column widths count in. */\r\nconst DIGIT_WIDTH = 7;\r\n/** Excel's widest column, in characters. */\r\nconst MAX_WIDTH = 255;\r\n/** Excel's deepest outline. */\r\nconst MAX_LEVEL = 7;\r\n\r\ntype RowType = TableSheetRow['rowType'];\r\n\r\n/** How a column's cells are written: its number and date formats. */\r\ninterface ColumnWriter {\r\n number: Intl.NumberFormat | null;\r\n date: string | null;\r\n /** Number formats by the fraction digits a value shows. */\r\n numbers: Map<string, string | undefined>;\r\n}\r\n\r\n/**\r\n * Writes a sheet to an ExcelJS worksheet from `start`: the rows with their outline levels, numbers and dates with\r\n * formats made from their column's `Intl` options, the header frozen and merged as the sheet says. `customize` is\r\n * called for every written cell. The export functions of the components write their sheets with it.\r\n */\r\nexport function writeSheet<C extends TableSheetCell>(sheet: TableSheet<C>, worksheet: Worksheet, start: { row: number; column: number }, options: ExcelSheetOptions, customize?: (cell: C, excelCell: Cell) => void): CellRange {\r\n const cols = sheet.columns;\r\n const range: CellRange = { from: { ...start }, to: { row: start.row, column: start.column + Math.max(0, cols.length - 1) } };\r\n worksheet.properties.outlineProperties = { summaryBelow: false, summaryRight: false };\r\n if (options.keepColumnWidths !== false) {\r\n cols.forEach((col, j) => {\r\n if (col.width > 0) worksheet.getColumn(start.column + j).width = Math.min(MAX_WIDTH, Math.floor((col.width / DIGIT_WIDTH) * 100) / 100);\r\n });\r\n }\r\n const formats = options.numberFormats !== false;\r\n const writers = cols.map(\r\n (col): ColumnWriter => ({\r\n number: formats && col.numberFormat ? new Intl.NumberFormat(sheet.locale, col.numberFormat) : null,\r\n date: formats && col.dateFormat ? excelDateFormat(new Intl.DateTimeFormat(sheet.locale, col.dateFormat)) : null,\r\n numbers: new Map(),\r\n }),\r\n );\r\n // A cell with formats of its own has a writer per set of them.\r\n const own = new Map<string, ColumnWriter>();\r\n const writerOf = (cell: C, j: number): ColumnWriter => {\r\n if (!formats || (!cell.numberFormat && !cell.dateFormat)) return writers[j];\r\n const key = JSON.stringify([cell.numberFormat ?? null, cell.dateFormat ?? null]);\r\n let writer = own.get(key);\r\n if (!writer) {\r\n writer = { number: cell.numberFormat ? new Intl.NumberFormat(sheet.locale, cell.numberFormat) : null, date: cell.dateFormat ? excelDateFormat(new Intl.DateTimeFormat(sheet.locale, cell.dateFormat)) : null, numbers: new Map() };\r\n own.set(key, writer);\r\n }\r\n return writer;\r\n };\r\n sheet.rows.forEach((row, i) => {\r\n const excelRow = worksheet.getRow(start.row + i);\r\n if (row.rowType !== 'header' && options.outline !== false) excelRow.outlineLevel = Math.min(MAX_LEVEL, row.level);\r\n row.cells.forEach((cell, j) => {\r\n const excelCell = excelRow.getCell(start.column + j);\r\n writeCell(excelCell, cell, row.rowType, j, cols[j], writerOf(cell, j), sheet.rtl, options);\r\n customize?.(cell, excelCell);\r\n if (options.encodeExecutableContent && typeof excelCell.value === 'string') excelCell.value = guardFormula(excelCell.value);\r\n });\r\n range.to.row = start.row + i;\r\n });\r\n const view = { ...(worksheet.views[0] ?? {}) };\r\n if (sheet.rtl) view.rightToLeft = true;\r\n // The columns of row headers stay in view beside the header rows.\r\n const headerColumns = sheet.headerColumns ?? 0;\r\n if (headerColumns > 0 && options.frozenHeader !== false && !('state' in view)) {\r\n Object.assign(view, { state: 'frozen', xSplit: start.column + headerColumns - 1, ...(sheet.headerRows > 0 ? { ySplit: start.row + sheet.headerRows - 1 } : {}) });\r\n }\r\n if (sheet.headerRows > 0) {\r\n if (options.frozenHeader !== false && !('state' in view)) Object.assign(view, { state: 'frozen', ySplit: start.row + sheet.headerRows - 1 });\r\n if (options.autoFilterEnabled && !worksheet.autoFilter && sheet.rows.length > 0) worksheet.autoFilter = { from: { row: start.row + sheet.headerRows - 1, column: start.column }, to: { ...range.to } };\r\n }\r\n if (Object.keys(view).length) worksheet.views = [view];\r\n // A band's title over its columns, a column's title down the band rows above it.\r\n if (options.mergeHeaders !== false) {\r\n for (const m of sheet.merges ?? []) worksheet.mergeCells(start.row + m.row, start.column + m.column, start.row + m.row + m.rows - 1, start.column + m.column + m.columns - 1);\r\n }\r\n return range;\r\n}\r\n\r\nfunction writeCell(excelCell: Cell, cell: TableSheetCell, rowType: RowType, index: number, col: TableSheetColumn, writer: ColumnWriter, rtl: boolean, options: ExcelSheetOptions) {\r\n const value = cell.value;\r\n if (value instanceof Date) excelCell.value = excelDate(value);\r\n else if (typeof value === 'boolean' && options.booleanText) excelCell.value = cell.text;\r\n else excelCell.value = value;\r\n if (value === null) return;\r\n const header = rowType === 'header';\r\n const groupText = rowType === 'group' && index === 0;\r\n // Header, group, summary and total cells are bold; the header centered, a group's text at the start.\r\n if (rowType !== 'data' || cell.strong) excelCell.font = { ...excelCell.font, bold: true };\r\n const align = header ? 'center' : groupText ? 'start' : col.align;\r\n const alignment: Partial<Alignment> = { ...excelCell.alignment, horizontal: align === 'center' ? 'center' : (align === 'end') !== rtl ? 'right' : 'left', vertical: 'top' };\r\n // A text of more lines, and the data cells of a column that wraps on screen: Excel sizes the row to them.\r\n if (typeof value === 'string' && (value.includes('\\n') || (rowType === 'data' && col.wrap))) alignment.wrapText = true;\r\n excelCell.alignment = alignment;\r\n if (rowType !== 'data') return;\r\n if (typeof value === 'number' && writer.number) {\r\n const numFmt = numberFormatOf(writer, value);\r\n if (numFmt) excelCell.numFmt = numFmt;\r\n } else if (value instanceof Date && writer.date) {\r\n excelCell.numFmt = writer.date;\r\n } else if (typeof value === 'string' && /^[@=+-]/.test(value)) {\r\n // Text, so Excel does not read it as a formula when the cell is edited.\r\n excelCell.numFmt = '@';\r\n }\r\n}\r\n\r\nfunction numberFormatOf(writer: ColumnWriter, value: number): string | undefined {\r\n // The format depends only on the fraction digits a value shows: calculated once per count.\r\n const shown = writer.number!.formatToParts(Math.abs(value));\r\n const key = `${shown.find((p) => p.type === 'fraction')?.value.length ?? 0}`;\r\n if (!writer.numbers.has(key)) writer.numbers.set(key, excelNumberFormat(writer.number!, value));\r\n return writer.numbers.get(key);\r\n}\r\n\r\n/** ExcelJS writes a date as UTC: the local day and time are moved there, so Excel shows what the grid shows. */\r\nfunction excelDate(date: Date): Date {\r\n return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\r\n}\r\n","import type { Worksheet } from 'exceljs';\r\nimport type { CellRange } from './cell-range';\r\nimport type { ExcelExportOptions } from './excel-export-options';\r\nimport { writeSheet } from './write-sheet';\r\n\r\n/**\r\n * Writes a DataGrid to an ExcelJS worksheet: the header row, the group rows (\"Column: value\", with\r\n * their summaries) with outline levels, the data rows in the grid's order with its filter, search and\r\n * grouping (every matching row, loaded in parts from a server), the group footers and the totals.\r\n * Numbers stay numbers with a number format created from the column's `Intl` format, dates stay dates,\r\n * yes/no cells are `TRUE` / `FALSE`, and lookup and list cells hold their text. Provide your own ExcelJS:\r\n * create the workbook and the worksheet, then save the workbook when the promise resolves with the cells written.\r\n *\r\n * @example\r\n * onExporting={(e) => {\r\n * if (e.format !== 'xlsx') return;\r\n * const workbook = new ExcelJS.Workbook();\r\n * exportDataGrid({ component: e.component, worksheet: workbook.addWorksheet('Orders'), selectedRowsOnly: e.selectedRowsOnly })\r\n * .then(() => workbook.xlsx.writeBuffer())\r\n * .then((buffer) => saveFile(new Blob([buffer]), 'Orders.xlsx'));\r\n * }}\r\n */\r\nexport function exportDataGrid<T = any>(options: ExcelExportOptions<T>): Promise<CellRange> {\r\n if (!options || typeof options !== 'object') return Promise.reject(new TypeError('exportDataGrid needs an options object.'));\r\n const { component, worksheet } = options;\r\n if (!component || typeof component.exportSheet !== 'function') return Promise.reject(new TypeError('exportDataGrid: `component` must be a DataGrid.'));\r\n if (!worksheet || typeof worksheet !== 'object') return Promise.reject(new TypeError('exportDataGrid: `worksheet` must be an ExcelJS worksheet.'));\r\n const start = topLeft(worksheet, options.topLeftCell);\r\n return component.exportSheet(\r\n {\r\n format: 'xlsx',\r\n selectedRowsOnly: options.selectedRowsOnly,\r\n headers: options.headers,\r\n groups: options.groups,\r\n summaries: options.summaries,\r\n pageSize: options.pageSize,\r\n onProgress: options.onProgress,\r\n signal: options.signal,\r\n loadPanel: options.loadPanel ?? true,\r\n },\r\n (sheet) => writeSheet(sheet, worksheet, start, options, options.customizeCell && ((cell, excelCell) => options.customizeCell!({ gridCell: cell.gridCell, excelCell }))),\r\n );\r\n}\r\n\r\nfunction topLeft(worksheet: Worksheet, given: ExcelExportOptions['topLeftCell']): { row: number; column: number } {\r\n if (typeof given === 'string') {\r\n const cell = worksheet.getCell(given);\r\n return { row: Number(cell.row), column: Number(cell.col) };\r\n }\r\n return { row: given?.row ?? 1, column: given?.column ?? 1 };\r\n}\r\n","import type { Cell, Worksheet } from 'exceljs';\r\nimport type { PivotGridSheet, PivotGridSheetCell } from '../components/pivotgrid/pivot-grid-sheet';\r\nimport { sliceSheet } from '../parts/table/slice-sheet';\r\nimport type { CellRange } from './cell-range';\r\nimport type { ExcelPivotExportOptions } from './excel-pivot-export-options';\r\nimport type { ExcelPivotExportResult } from './excel-pivot-export-result';\r\nimport { writeSheet, type ExcelSheetOptions } from './write-sheet';\r\n\r\n/** Excel's rows and columns in a worksheet. */\r\nconst EXCEL_LIMITS = { rows: 1_048_576, columns: 16_384 };\r\n/** Excel's longest worksheet name. */\r\nconst NAME_LENGTH = 31;\r\n\r\n/**\r\n * Writes a PivotGrid to an ExcelJS worksheet: the rows of column headers (merged over the columns they cover) and the\r\n * corner, then a row per line of the table with its row headers (merged down the lines they cover), every open member's\r\n * (read whole where the pivot is read in parts). Numbers stay numbers with the format their cells show them with, totals\r\n * are bold, and the headers stay in view. A table larger than a worksheet (1,048,576 rows, 16,384 columns) goes on in\r\n * worksheets added after it, each with the rows of column headers and the columns of row headers again. Provide your own\r\n * ExcelJS: create the workbook and the worksheet, then save the workbook when the promise resolves.\r\n *\r\n * @example\r\n * onExporting={(e) => {\r\n * if (e.format !== 'xlsx') return;\r\n * const workbook = new ExcelJS.Workbook();\r\n * exportPivotGrid({ component: e.component, worksheet: workbook.addWorksheet('Sales') })\r\n * .then(() => workbook.xlsx.writeBuffer())\r\n * .then((buffer) => saveFile(new Blob([buffer]), 'Sales.xlsx'));\r\n * }}\r\n */\r\nexport function exportPivotGrid<T = any>(options: ExcelPivotExportOptions<T>): Promise<ExcelPivotExportResult> {\r\n if (!options || typeof options !== 'object') return Promise.reject(new TypeError('exportPivotGrid needs an options object.'));\r\n const { component, worksheet } = options;\r\n if (!component || typeof component.exportSheet !== 'function' || typeof component.chartData !== 'function') return Promise.reject(new TypeError('exportPivotGrid: `component` must be a PivotGrid.'));\r\n if (!worksheet || typeof worksheet !== 'object') return Promise.reject(new TypeError('exportPivotGrid: `worksheet` must be an ExcelJS worksheet.'));\r\n const start = topLeft(worksheet, options.topLeftCell);\r\n return component.exportSheet({ format: 'xlsx', headers: options.headers, onProgress: options.onProgress, signal: options.signal, loadPanel: options.loadPanel ?? true }, (sheet) => {\r\n const tree = sheet.rowHeaderLayout === 'tree';\r\n const customize = (cell: PivotGridSheetCell<T>, excelCell: Cell) => {\r\n // A member's header in the tree layout is indented by its level, as the pivot shows it.\r\n const p = cell.pivotCell;\r\n if (tree && p.area === 'row' && p.kind !== 'dataField' && (p.path?.length ?? 0) > 1) excelCell.alignment = { ...excelCell.alignment, indent: p.path!.length - 1 };\r\n options.customizeCell?.({ pivotCell: p, excelCell });\r\n };\r\n return writePivotSheets(sheet, worksheet, start, { ...options, autoFilterEnabled: false, booleanText: false }, customize);\r\n });\r\n}\r\n\r\n/**\r\n * Writes a pivot's sheet from `start` on a worksheet, and where it does not fit in one (`limits`), on worksheets added\r\n * after it: the rows by as many as fit, then the columns, each part under the rows of column headers and after the\r\n * columns of row headers again.\r\n */\r\nexport function writePivotSheets<T>(\r\n sheet: PivotGridSheet<T>,\r\n first: Worksheet,\r\n start: { row: number; column: number },\r\n options: ExcelSheetOptions,\r\n customize: (cell: PivotGridSheetCell<T>, excelCell: Cell) => void,\r\n limits: { rows: number; columns: number } = EXCEL_LIMITS,\r\n): ExcelPivotExportResult {\r\n const head = sheet.headerRows;\r\n const side = sheet.headerColumns;\r\n const rowsEach = limits.rows - (start.row - 1) - head;\r\n const columnsEach = limits.columns - (start.column - 1) - side;\r\n if (rowsEach < 1 || columnsEach < 1) throw new RangeError('exportPivotGrid: the headers do not fit in a worksheet from `topLeftCell`.');\r\n const rowParts = Math.max(1, Math.ceil((sheet.rows.length - head) / rowsEach));\r\n const columnParts = Math.max(1, Math.ceil((sheet.columns.length - side) / columnsEach));\r\n const worksheets: Worksheet[] = [];\r\n let range: CellRange | null = null;\r\n for (let r = 0; r < rowParts; r++) {\r\n for (let c = 0; c < columnParts; c++) {\r\n const worksheet = worksheets.length ? addSheet(first, worksheets.length + 1) : first;\r\n const part = sliceSheet<PivotGridSheetCell<T>, PivotGridSheet<T>>(sheet, head + r * rowsEach, head + (r + 1) * rowsEach, side + c * columnsEach, side + (c + 1) * columnsEach);\r\n const written = writeSheet(part, worksheet, start, options, customize);\r\n range ??= written;\r\n worksheets.push(worksheet);\r\n }\r\n }\r\n return { ...range!, worksheets };\r\n}\r\n\r\n/** A worksheet after the first, named after it with its number: \"Sales (2)\". */\r\nfunction addSheet(first: Worksheet, n: number): Worksheet {\r\n const workbook = first.workbook;\r\n const named = (k: number) => `${first.name.slice(0, NAME_LENGTH - String(k).length - 3)} (${k})`;\r\n let k = n;\r\n while (workbook.getWorksheet(named(k))) k++;\r\n return workbook.addWorksheet(named(k));\r\n}\r\n\r\nfunction topLeft(worksheet: Worksheet, given: ExcelPivotExportOptions['topLeftCell']): { row: number; column: number } {\r\n if (typeof given === 'string') {\r\n const cell = worksheet.getCell(given);\r\n return { row: Number(cell.row), column: Number(cell.col) };\r\n }\r\n return { row: given?.row ?? 1, column: given?.column ?? 1 };\r\n}\r\n"],"mappings":";;;;AACA,IAAM,SAAS,IAAI,KAAK,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;;;;;;AAOhD,SAAgB,gBAAgB,QAAqC;CACnE,MAAM,SAAS,OAAO,gBAAgB,CAAC,CAAC;CACxC,MAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,M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