@extend-ai/react-xlsx 0.23.2 → 0.24.1

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.
Files changed (80) hide show
  1. package/README.md +22 -2
  2. package/dist/{chunk-UICWNF5V.js → chunk-2TLD35UF.js} +3 -27
  3. package/dist/chunk-2TLD35UF.js.map +1 -0
  4. package/dist/{chunk-A3WA6ZLI.cjs → chunk-GP5SOQQH.cjs} +3 -29
  5. package/dist/chunk-GP5SOQQH.cjs.map +1 -0
  6. package/dist/{chunk-MEZOJBL5.js → chunk-HAV76TR2.js} +57 -1
  7. package/dist/{chunk-MEZOJBL5.js.map → chunk-HAV76TR2.js.map} +1 -1
  8. package/dist/{chunk-JJJZYWAL.js → chunk-MNIFKMIL.js} +57 -1
  9. package/dist/chunk-MNIFKMIL.js.map +1 -0
  10. package/dist/{chunk-3JFYU42O.js → chunk-Q6YY3AB4.js} +2 -28
  11. package/dist/chunk-Q6YY3AB4.js.map +1 -0
  12. package/dist/{chunk-FGJY2TIS.cjs → chunk-WW6G674Q.cjs} +2672 -2340
  13. package/dist/chunk-WW6G674Q.cjs.map +1 -0
  14. package/dist/{chunk-M7QVMFYT.js → chunk-XUHSQ3GF.js} +819 -487
  15. package/dist/chunk-XUHSQ3GF.js.map +1 -0
  16. package/dist/{chunk-JCSAS3M2.cjs → chunk-XZJLPW64.cjs} +2 -26
  17. package/dist/chunk-XZJLPW64.cjs.map +1 -0
  18. package/dist/{chunk-TMYAG7GY.cjs → chunk-YOLIVKZD.cjs} +57 -1
  19. package/dist/chunk-YOLIVKZD.cjs.map +1 -0
  20. package/dist/{chunk-R3FQM7V3.cjs → chunk-Z4WMURVU.cjs} +57 -1
  21. package/dist/chunk-Z4WMURVU.cjs.map +1 -0
  22. package/dist/duke-sheets-provenance.json +5 -5
  23. package/dist/{duke_sheets_wasm-TLSZAVKP.cjs → duke_sheets_wasm-GM4K5QQX.cjs} +57 -1
  24. package/dist/duke_sheets_wasm-GM4K5QQX.cjs.map +1 -0
  25. package/dist/{duke_sheets_wasm-V4J6QYIZ.js → duke_sheets_wasm-MYY4ZNUI.js} +57 -1
  26. package/dist/duke_sheets_wasm-MYY4ZNUI.js.map +1 -0
  27. package/dist/{duke_sheets_wasm-R7KXJNYL.js → duke_sheets_wasm-UXZ2KTVD.js} +57 -1
  28. package/dist/duke_sheets_wasm-UXZ2KTVD.js.map +1 -0
  29. package/dist/duke_sheets_wasm_bg.wasm +0 -0
  30. package/dist/index.cjs +805 -606
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +53 -7
  33. package/dist/index.d.ts +53 -7
  34. package/dist/index.js +784 -585
  35. package/dist/index.js.map +1 -1
  36. package/dist/{internal-BVZRgYaH.d.ts → internal-D5HReXVR.d.cts} +114 -64
  37. package/dist/{internal-BVZRgYaH.d.cts → internal-D5HReXVR.d.ts} +114 -64
  38. package/dist/internal.cjs +4 -4
  39. package/dist/internal.d.cts +1 -1
  40. package/dist/internal.d.ts +1 -1
  41. package/dist/internal.js +3 -3
  42. package/dist/{shared-chart-V24MOVXX.js → shared-chart-24MCGSFJ.js} +2 -2
  43. package/dist/{shared-chart-N44DT2QV.cjs → shared-chart-7E6KMGTG.cjs} +3 -3
  44. package/dist/{shared-chart-N44DT2QV.cjs.map → shared-chart-7E6KMGTG.cjs.map} +1 -1
  45. package/dist/{shared-chart-64L5EL3Z.js → shared-chart-CGEK7EAB.js} +2 -2
  46. package/dist/{shared-chart-BZTEPO7C.cjs → shared-chart-GKNMM72Q.cjs} +15 -15
  47. package/dist/{shared-chart-BZTEPO7C.cjs.map → shared-chart-GKNMM72Q.cjs.map} +1 -1
  48. package/dist/vanilla.cjs +4 -4
  49. package/dist/vanilla.d.cts +2 -2
  50. package/dist/vanilla.d.ts +2 -2
  51. package/dist/vanilla.js +3 -3
  52. package/dist/{workbook-runtime-OJDBGHMM.cjs → workbook-runtime-7WEPIK5Y.cjs} +85 -77
  53. package/dist/workbook-runtime-7WEPIK5Y.cjs.map +1 -0
  54. package/dist/{workbook-runtime-O3QY5UED.js → workbook-runtime-BAAYDYYK.js} +24 -16
  55. package/dist/workbook-runtime-BAAYDYYK.js.map +1 -0
  56. package/dist/{workbook-runtime-FXUSOOFT.js → workbook-runtime-FCKPXLTW.js} +24 -16
  57. package/dist/workbook-runtime-FCKPXLTW.js.map +1 -0
  58. package/dist/{workbook-runtime-2HYFRGZD.cjs → workbook-runtime-MOGSEJ5R.cjs} +83 -75
  59. package/dist/workbook-runtime-MOGSEJ5R.cjs.map +1 -0
  60. package/dist/xlsx-worker.js +23 -15
  61. package/dist/xlsx-worker.js.map +1 -1
  62. package/package.json +2 -2
  63. package/dist/chunk-3JFYU42O.js.map +0 -1
  64. package/dist/chunk-A3WA6ZLI.cjs.map +0 -1
  65. package/dist/chunk-FGJY2TIS.cjs.map +0 -1
  66. package/dist/chunk-JCSAS3M2.cjs.map +0 -1
  67. package/dist/chunk-JJJZYWAL.js.map +0 -1
  68. package/dist/chunk-M7QVMFYT.js.map +0 -1
  69. package/dist/chunk-R3FQM7V3.cjs.map +0 -1
  70. package/dist/chunk-TMYAG7GY.cjs.map +0 -1
  71. package/dist/chunk-UICWNF5V.js.map +0 -1
  72. package/dist/duke_sheets_wasm-R7KXJNYL.js.map +0 -1
  73. package/dist/duke_sheets_wasm-TLSZAVKP.cjs.map +0 -1
  74. package/dist/duke_sheets_wasm-V4J6QYIZ.js.map +0 -1
  75. package/dist/workbook-runtime-2HYFRGZD.cjs.map +0 -1
  76. package/dist/workbook-runtime-FXUSOOFT.js.map +0 -1
  77. package/dist/workbook-runtime-O3QY5UED.js.map +0 -1
  78. package/dist/workbook-runtime-OJDBGHMM.cjs.map +0 -1
  79. /package/dist/{shared-chart-V24MOVXX.js.map → shared-chart-24MCGSFJ.js.map} +0 -0
  80. /package/dist/{shared-chart-64L5EL3Z.js.map → shared-chart-CGEK7EAB.js.map} +0 -0
package/README.md CHANGED
@@ -399,7 +399,8 @@ export function ControlledWorkbook({ file }: { file: ArrayBuffer }) {
399
399
  These hooks work inside `XlsxViewer` or `XlsxViewerProvider` context.
400
400
 
401
401
  - `useXlsxViewer()` for full controller access
402
- - `useXlsxViewerSelection()` for active cell and range state
402
+ - `useXlsxViewerSelection()` for active cell and range state. ⌘-click (Ctrl-click on Windows) adds or removes row and column headers. `selectionRanges` contains all selected areas in selection order, and `selection` is the active area.
403
+ - `useXlsxViewerLayout()` for row and column visibility and freeze panes
403
404
  - `useXlsxViewerZoom()` for zoom controls and limits
404
405
  - `useXlsxViewerEditing()` for editing, persisted style writes, formulas, undo/redo, fill, merge, clipboard, and export actions
405
406
  - `useXlsxViewerTables()` for table metadata and table sorting
@@ -521,6 +522,21 @@ This targets worksheet-backed XLSX pivots. Data Model/OLAP/external connections
521
522
 
522
523
  Exports contain native pivot definitions, cache definitions/records, relationships, and PivotChart associations. See [pivot table APIs and compatibility](https://github.com/extend-hq/react-xlsx/blob/main/docs/pivot-tables.md) for calculation limits and the detailed compatibility boundary.
523
524
 
525
+ ## Worksheet Layout
526
+
527
+ `useXlsxViewerLayout()` and the viewer controller expose the same commands for the active worksheet. In editing mode, layout changes participate in undo and redo and persist in XLSX exports.
528
+
529
+ In read-only mode, set `allowFreezeInReadOnly` to allow freezing and unfreezing or `allowHideInReadOnly` to allow hiding and unhiding rows and columns. Both options default to `false` and also apply when `readOnlyAboveBytes` activates read-only mode. Set them on the controller when supplying your own. Each worksheet keeps its view until the workbook is reloaded. Exports and edit history retain the workbook layout.
530
+
531
+ | Command | Default target | Explicit target |
532
+ | --- | --- | --- |
533
+ | `hideRows()` / `unhideRows()` | Rows covered by the current selection, including separate areas | One zero-based row index or two inclusive indices, as in `hideRows(2, 4)` |
534
+ | `hideColumns()` / `unhideColumns()` | Columns covered by the current selection, including separate areas | One zero-based column index or two inclusive indices, as in `unhideColumns(1)` |
535
+ | `freezePanes()` | Rows above the selected row header, columns to the left of the selected column header, or both axes at the active cell | A zero-based cell address. `freezePanes({ row: 2, col: 1 })` keeps rows 1–2 and column A visible |
536
+ | `unfreezePanes()` | The active worksheet | — |
537
+
538
+ Read `canChangeVisibility` and `canChangeFreezePanes` to enable layout menus. Use `canFreezePanes` to enable a freeze command for the current selection and `frozenPanes` for the current row and column counts, or `null` when unfrozen. To unhide a block from the grid, select headers on both sides and choose **Unhide**. For hidden leading rows or columns, select the first visible header.
539
+
524
540
  ## Merging Cells
525
541
 
526
542
  The controller and `useXlsxViewerEditing()` expose `mergeSelection(mode?)` and `unmergeSelection()`. The merge modes are:
@@ -722,6 +738,8 @@ Right-click a chart, image, worksheet cell, row header, column header, or the to
722
738
 
723
739
  Viewer mode (`readOnly`) offers Copy and selection actions. Editor mode also offers Cut, Paste, Edit cell, Clear contents, Undo/Redo, Merge/Unmerge, and sorting when the target belongs to a table. Actions use the existing controller and undo history. Row and column selections span the displayed grid, matching header selection. Worker-backed viewers copy tab-separated text; editable workbooks also preserve structured cell data when the browser supports custom clipboard formats. Clipboard commands require browser clipboard access; failed operations display an error and Cut only clears cells after copying succeeds.
724
740
 
741
+ Row and column headers have their own menus. In editing mode they offer Cut, Copy, Paste, Clear Contents, Row Height or Column Width, Hide, and Unhide. Sizing uses logical pixels and applies to all selected headers in one undo step. Read-only headers offer Copy and optionally sizing with `allowResizeInReadOnly` and Hide and Unhide with `allowHideInReadOnly`. Shift+F10 opens the same menu for a header selection.
742
+
725
743
  Chart and image menus start with Undo and Redo, followed by a separator. Drawing Cut and Copy are not offered; copying worksheet cells remains supported. Bring to Front and Send to Back contain the one-step layer commands. Charts also have a nested Change Chart Type menu, grouped by family; options that require a different series count are disabled. Drawing positions, sizes, layer order, and chart types participate in undo/redo and are preserved by `download()` and `exportXlsx()`.
726
744
 
727
745
  Pasting drawings from Excel uses browser clipboard APIs and places their top-left corner at the active cell. See [Pasting from Excel](#pasting-from-excel) for supported representations and browser requirements. The controller, `useXlsxViewerCharts()`, and `useXlsxViewerImages()` expose `pasteDrawingFromClipboard()`, `arrangeDrawing(kind, id, order)`, and `changeChartType(id, type)`.
@@ -1085,7 +1103,7 @@ Common source and loading props:
1085
1103
 
1086
1104
  Double-click the divider at the right edge of a column header to fit its contents. Double-click the divider at the bottom of a row header to fit its contents at the current column widths, including wrapped text. Autofit includes offscreen cells and skips hidden cells and merges that span the axis being resized.
1087
1105
 
1088
- `allowResizeInReadOnly` enables autofit and drag resizing in a read-only viewer. When supplying your own controller, set this option on both `useXlsxViewerController` (or `XlsxViewerProvider`) and `XlsxViewer`. Workbooks forced into read-only mode by `readOnlyAboveBytes` remain locked. Autofit uses the selected row or column, so it can evaluate conditional styles whose operands are literals or cells on that axis.
1106
+ `allowResizeInReadOnly` enables autofit and drag resizing in a read-only viewer. When supplying your own controller, set this option on both `useXlsxViewerController` (or `XlsxViewerProvider`) and `XlsxViewer`. Workbooks forced into read-only mode by `readOnlyAboveBytes` keep their original row and column sizes. Autofit uses the selected row or column, so it can evaluate conditional styles whose operands are literals or cells on that axis.
1089
1107
 
1090
1108
  Common rendering props:
1091
1109
 
@@ -1100,6 +1118,8 @@ Common rendering props:
1100
1118
  - `experimentalCanvas?: boolean`
1101
1119
  - `enableGestureZoom?: boolean`
1102
1120
  - `enableCanvasSelectionAnimation?: boolean`
1121
+ - `allowFreezeInReadOnly?: boolean`
1122
+ - `allowHideInReadOnly?: boolean`
1103
1123
  - `allowResizeInReadOnly?: boolean`
1104
1124
  - `highlightedRanges?: string | readonly string[] | null`
1105
1125
  - `autoScrollToHighlightedRanges?: boolean`
@@ -425,30 +425,6 @@ function resolveWorksheetDefaultRowHeightPixels(worksheet, fallbackPx = Math.max
425
425
  const height = typeof worksheet.defaultRowHeight === "number" ? worksheet.defaultRowHeight : Number.NaN;
426
426
  return Number.isFinite(height) && height > 0 ? Math.max(MIN_ROW_HEIGHT_PX, Math.round(height * 1.33)) : fallbackPx;
427
427
  }
428
- function resolveWorksheetHiddenRows(worksheet, maxRow) {
429
- if (!Number.isFinite(maxRow) || maxRow < 0 || typeof worksheet.isRowHidden !== "function") {
430
- return [];
431
- }
432
- const hiddenRows = [];
433
- for (let row = 0; row <= maxRow; row += 1) {
434
- if (worksheet.isRowHidden(row)) {
435
- hiddenRows.push(row);
436
- }
437
- }
438
- return hiddenRows;
439
- }
440
- function resolveWorksheetHiddenCols(worksheet, maxCol) {
441
- if (!Number.isFinite(maxCol) || maxCol < 0 || typeof worksheet.isColumnHidden !== "function") {
442
- return [];
443
- }
444
- const hiddenCols = [];
445
- for (let col = 0; col <= maxCol; col += 1) {
446
- if (worksheet.isColumnHidden(col)) {
447
- hiddenCols.push(col);
448
- }
449
- }
450
- return hiddenCols;
451
- }
452
428
  function resolveWorksheetMergeMetadata(worksheet) {
453
429
  const mergeMetadata = {
454
430
  hasHorizontalMerges: false,
@@ -8187,6 +8163,8 @@ function localizeSizingCells(rows, locale) {
8187
8163
  }
8188
8164
 
8189
8165
  export {
8166
+ XLSX_MAX_ROWS,
8167
+ XLSX_MAX_COLUMNS,
8190
8168
  parseXlsxRange,
8191
8169
  pivotWorkbook,
8192
8170
  readPivotTables,
@@ -8201,8 +8179,6 @@ export {
8201
8179
  getUnmeasuredWorkbookFont,
8202
8180
  resolveWorksheetDefaultColumnWidthPixels,
8203
8181
  resolveWorksheetDefaultRowHeightPixels,
8204
- resolveWorksheetHiddenRows,
8205
- resolveWorksheetHiddenCols,
8206
8182
  resolveWorksheetMergeMetadata,
8207
8183
  xlsxAnchorToDukeDrawingAnchor,
8208
8184
  collectWorkbookFormControls,
@@ -8235,4 +8211,4 @@ export {
8235
8211
  tryRecalculate,
8236
8212
  readWorksheetAutofitCells
8237
8213
  };
8238
- //# sourceMappingURL=chunk-UICWNF5V.js.map
8214
+ //# sourceMappingURL=chunk-2TLD35UF.js.map