@rowsncolumns/spreadsheet 10.10.4 → 10.11.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.
Files changed (114) hide show
  1. package/dist/cjs/api/error-checking.d.ts +39 -3
  2. package/dist/cjs/api/error-checking.d.ts.map +1 -1
  3. package/dist/cjs/api/error-checking.js +169 -13
  4. package/dist/cjs/api/excel-edit-value.d.ts +18 -0
  5. package/dist/cjs/api/excel-edit-value.d.ts.map +1 -0
  6. package/dist/cjs/api/excel-edit-value.js +98 -0
  7. package/dist/cjs/api/split-pane.d.ts +29 -0
  8. package/dist/cjs/api/split-pane.d.ts.map +1 -0
  9. package/dist/cjs/api/split-pane.js +98 -0
  10. package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
  11. package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
  12. package/dist/cjs/components/canvas-grid/index.js +189 -70
  13. package/dist/cjs/components/canvas-grid/typings.d.ts +38 -1
  14. package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
  15. package/dist/cjs/components/error-check-smart-tag/index.d.ts +3 -2
  16. package/dist/cjs/components/error-check-smart-tag/index.d.ts.map +1 -1
  17. package/dist/cjs/components/error-check-smart-tag/index.js +4 -2
  18. package/dist/cjs/components/filter-box/filter-by-color.d.ts +1 -1
  19. package/dist/cjs/components/filter-box/filter-by-color.d.ts.map +1 -1
  20. package/dist/cjs/components/filter-box/filter-by-color.js +3 -6
  21. package/dist/cjs/components/filter-box/index.d.ts.map +1 -1
  22. package/dist/cjs/components/filter-box/index.js +1 -3
  23. package/dist/cjs/components/print-preview/page-block.d.ts +2 -0
  24. package/dist/cjs/components/print-preview/page-block.d.ts.map +1 -1
  25. package/dist/cjs/components/print-preview/page-block.js +131 -101
  26. package/dist/cjs/components/print-preview/page-break-preview.d.ts.map +1 -1
  27. package/dist/cjs/components/print-preview/page-break-preview.js +5 -3
  28. package/dist/cjs/components/print-preview/print-preview-dialog.d.ts +1 -1
  29. package/dist/cjs/components/print-preview/print-preview-dialog.d.ts.map +1 -1
  30. package/dist/cjs/components/print-preview/print-preview-dialog.js +38 -17
  31. package/dist/cjs/components/print-preview/settings.d.ts +22 -1
  32. package/dist/cjs/components/print-preview/settings.d.ts.map +1 -1
  33. package/dist/cjs/components/print-preview/settings.js +54 -1
  34. package/dist/cjs/components/print-preview/sheet-page-setup.d.ts +22 -1
  35. package/dist/cjs/components/print-preview/sheet-page-setup.d.ts.map +1 -1
  36. package/dist/cjs/components/print-preview/sheet-page-setup.js +59 -3
  37. package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
  38. package/dist/cjs/hooks/use-copy-paste-cut.js +5 -2
  39. package/dist/cjs/hooks/use-editor-submit.d.ts +9 -1
  40. package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
  41. package/dist/cjs/hooks/use-editor-submit.js +39 -15
  42. package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
  43. package/dist/cjs/hooks/use-embeds-charts.js +6 -4
  44. package/dist/cjs/hooks/use-grid-children.d.ts +8 -2
  45. package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
  46. package/dist/cjs/hooks/use-grid-children.js +71 -4
  47. package/dist/cjs/hooks/use-selection-renderer.d.ts +3 -1
  48. package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
  49. package/dist/cjs/hooks/use-selection-renderer.js +4 -3
  50. package/dist/cjs/index.d.ts +1 -0
  51. package/dist/cjs/index.d.ts.map +1 -1
  52. package/dist/cjs/index.js +1 -0
  53. package/dist/cjs/release-date.js +1 -1
  54. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  55. package/dist/cjs/types.d.ts +44 -2
  56. package/dist/cjs/types.d.ts.map +1 -1
  57. package/dist/esm/api/error-checking.d.ts +39 -3
  58. package/dist/esm/api/error-checking.d.ts.map +1 -1
  59. package/dist/esm/api/error-checking.js +128 -3
  60. package/dist/esm/api/excel-edit-value.d.ts +18 -0
  61. package/dist/esm/api/excel-edit-value.d.ts.map +1 -0
  62. package/dist/esm/api/excel-edit-value.js +90 -0
  63. package/dist/esm/api/split-pane.d.ts +29 -0
  64. package/dist/esm/api/split-pane.d.ts.map +1 -0
  65. package/dist/esm/api/split-pane.js +88 -0
  66. package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
  67. package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
  68. package/dist/esm/components/canvas-grid/index.js +122 -7
  69. package/dist/esm/components/canvas-grid/typings.d.ts +38 -1
  70. package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
  71. package/dist/esm/components/error-check-smart-tag/index.d.ts +3 -2
  72. package/dist/esm/components/error-check-smart-tag/index.d.ts.map +1 -1
  73. package/dist/esm/components/error-check-smart-tag/index.js +4 -2
  74. package/dist/esm/components/filter-box/filter-by-color.d.ts +1 -1
  75. package/dist/esm/components/filter-box/filter-by-color.d.ts.map +1 -1
  76. package/dist/esm/components/filter-box/filter-by-color.js +3 -6
  77. package/dist/esm/components/filter-box/index.d.ts.map +1 -1
  78. package/dist/esm/components/filter-box/index.js +1 -3
  79. package/dist/esm/components/print-preview/page-block.d.ts +2 -0
  80. package/dist/esm/components/print-preview/page-block.d.ts.map +1 -1
  81. package/dist/esm/components/print-preview/page-block.js +141 -110
  82. package/dist/esm/components/print-preview/page-break-preview.d.ts.map +1 -1
  83. package/dist/esm/components/print-preview/page-break-preview.js +6 -4
  84. package/dist/esm/components/print-preview/print-preview-dialog.d.ts +1 -1
  85. package/dist/esm/components/print-preview/print-preview-dialog.d.ts.map +1 -1
  86. package/dist/esm/components/print-preview/print-preview-dialog.js +40 -19
  87. package/dist/esm/components/print-preview/settings.d.ts +22 -1
  88. package/dist/esm/components/print-preview/settings.d.ts.map +1 -1
  89. package/dist/esm/components/print-preview/settings.js +50 -0
  90. package/dist/esm/components/print-preview/sheet-page-setup.d.ts +22 -1
  91. package/dist/esm/components/print-preview/sheet-page-setup.d.ts.map +1 -1
  92. package/dist/esm/components/print-preview/sheet-page-setup.js +51 -0
  93. package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
  94. package/dist/esm/hooks/use-copy-paste-cut.js +5 -2
  95. package/dist/esm/hooks/use-editor-submit.d.ts +9 -1
  96. package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
  97. package/dist/esm/hooks/use-editor-submit.js +24 -1
  98. package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
  99. package/dist/esm/hooks/use-embeds-charts.js +7 -4
  100. package/dist/esm/hooks/use-grid-children.d.ts +8 -2
  101. package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
  102. package/dist/esm/hooks/use-grid-children.js +71 -4
  103. package/dist/esm/hooks/use-selection-renderer.d.ts +3 -1
  104. package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
  105. package/dist/esm/hooks/use-selection-renderer.js +4 -3
  106. package/dist/esm/index.d.ts +1 -0
  107. package/dist/esm/index.d.ts.map +1 -1
  108. package/dist/esm/index.js +1 -0
  109. package/dist/esm/release-date.js +1 -1
  110. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  111. package/dist/esm/types.d.ts +44 -2
  112. package/dist/esm/types.d.ts.map +1 -1
  113. package/dist/spreadsheet.min.css +1 -1
  114. package/package.json +7 -7
@@ -0,0 +1,88 @@
1
+ /** Twentieths of a point per CSS pixel (96 px = 72 pt = 1440 twips). */
2
+ export const TWIPS_PER_PIXEL = 15;
3
+ const columnLetters = (column) => {
4
+ let letters = "";
5
+ for (let n = column; n > 0; n = Math.floor((n - 1) / 26)) {
6
+ letters = String.fromCharCode(65 + ((n - 1) % 26)) + letters;
7
+ }
8
+ return letters;
9
+ };
10
+ /**
11
+ * Excel's View ▸ Split at the active cell: the window splits above and left of it, so the cell
12
+ * starts the bottom-right pane. A cell in the first visible row splits only vertically (left /
13
+ * right), one in the first visible column only horizontally (top / bottom), and the first visible
14
+ * cell itself splits the window into four panes at its middle, as Excel does. `getColumnWidth` /
15
+ * `getRowHeight` are the on-screen sizes in px (at 100% zoom); `firstVisible` is the top-left
16
+ * cell of the scrolled window. Returns `undefined` when there is nothing to split.
17
+ */
18
+ export const splitPaneAtCell = (activeCell, firstVisible, getColumnWidth, getRowHeight) => {
19
+ const { rowIndex, columnIndex } = activeCell;
20
+ if (rowIndex <= firstVisible.rowIndex && columnIndex <= firstVisible.columnIndex) {
21
+ // Excel splits the window at the middle when the active cell is its first cell.
22
+ let width = 0;
23
+ let column = firstVisible.columnIndex;
24
+ let height = 0;
25
+ let row = firstVisible.rowIndex;
26
+ // Half a default window: 10 columns and 20 rows.
27
+ for (let i = 0; i < 5; i++)
28
+ width += getColumnWidth(column++);
29
+ for (let i = 0; i < 10; i++)
30
+ height += getRowHeight(row++);
31
+ return {
32
+ xSplit: Math.round(width * TWIPS_PER_PIXEL),
33
+ ySplit: Math.round(height * TWIPS_PER_PIXEL),
34
+ topLeftCell: `${columnLetters(column)}${row}`,
35
+ activePane: "bottomRight",
36
+ };
37
+ }
38
+ let width = 0;
39
+ for (let column = firstVisible.columnIndex; column < columnIndex; column++) {
40
+ width += getColumnWidth(column);
41
+ }
42
+ let height = 0;
43
+ for (let row = firstVisible.rowIndex; row < rowIndex; row++) {
44
+ height += getRowHeight(row);
45
+ }
46
+ if (width <= 0 && height <= 0)
47
+ return undefined;
48
+ const pane = {
49
+ topLeftCell: `${columnLetters(Math.max(columnIndex, 1))}${Math.max(rowIndex, 1)}`,
50
+ };
51
+ if (width > 0)
52
+ pane.xSplit = Math.round(width * TWIPS_PER_PIXEL);
53
+ if (height > 0)
54
+ pane.ySplit = Math.round(height * TWIPS_PER_PIXEL);
55
+ pane.activePane =
56
+ width > 0 && height > 0 ? "bottomRight" : width > 0 ? "topRight" : "bottomLeft";
57
+ return pane;
58
+ };
59
+ /** A split's positions in CSS px from the grid's top-left (`undefined` = no split on that axis). */
60
+ export const splitPanePixels = (pane) => {
61
+ const px = (twips) => typeof twips === "number" && twips > 0 ? twips / TWIPS_PER_PIXEL : undefined;
62
+ return { x: px(pane?.xSplit), y: px(pane?.ySplit) };
63
+ };
64
+ /**
65
+ * The sheet's `<pane>` for a split the grid reports in CSS px — the inverse of
66
+ * {@link splitPanePixels}. What the sheet already stored about the split (which pane is active,
67
+ * the bottom-right pane's first cell) is kept; `null` from the grid means the split was removed,
68
+ * which the caller stores as a `null` `splitPane`.
69
+ */
70
+ export const splitPaneFromPixels = (pixels, previous) => {
71
+ const twips = (px) => typeof px === "number" && px > 0 ? Math.round(px * TWIPS_PER_PIXEL) : undefined;
72
+ const pane = {};
73
+ const xSplit = twips(pixels.x);
74
+ const ySplit = twips(pixels.y);
75
+ if (xSplit !== undefined)
76
+ pane.xSplit = xSplit;
77
+ if (ySplit !== undefined)
78
+ pane.ySplit = ySplit;
79
+ if (previous?.topLeftCell)
80
+ pane.topLeftCell = previous.topLeftCell;
81
+ pane.activePane =
82
+ xSplit !== undefined && ySplit !== undefined
83
+ ? "bottomRight"
84
+ : xSplit !== undefined
85
+ ? "topRight"
86
+ : "bottomLeft";
87
+ return pane;
88
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"cell-input-context.atom.d.ts","sourceRoot":"","sources":["../../../atoms/cell-input-context.atom.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,mBAAmB;;;;oBAC+4uF,CAAC;qBAAwB,CAAC;;;;;;;;;;;CAD13uF,CAAC"}
1
+ {"version":3,"file":"cell-input-context.atom.d.ts","sourceRoot":"","sources":["../../../atoms/cell-input-context.atom.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,mBAAmB;;;;oBACy2yF,CAAC;qBAAwB,CAAC;;;;;;;;;;;CADp1yF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAmEA,OAAO,KASN,MAAM,OAAO,CAAC;AAuQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AAgkOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAoEA,OAAO,KASN,MAAM,OAAO,CAAC;AAyQf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AA6sOnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
@@ -11,6 +11,8 @@ import merge from "lodash/merge";
11
11
  import throttle from "lodash/throttle";
12
12
  import React, { forwardRef, memo, startTransition, useCallback, useEffect, useMemo, useRef, useState, } from "react";
13
13
  import { getBandedCells } from "../../api/banded-ranges";
14
+ import { splitPaneFromPixels, splitPanePixels } from "../../api/split-pane";
15
+ import { excelEditValueOfNumber } from "../../api/excel-edit-value";
14
16
  import { getErrorCheckKind, isErrorIgnored, runErrorCheckOption, } from "../../api/error-checking";
15
17
  import { formulaBarEditorInstanceAtom } from "../../atoms/formula-bar-editor-value.atom";
16
18
  import { clearRangeForInsertedBand, formatsForInsertOption, insertedBandHasValues, } from "../../api/insert-options";
@@ -156,7 +158,7 @@ function isDetachedEditor(editor) {
156
158
  return element != null && !element.isConnected;
157
159
  }
158
160
  function CanvasGridComponent(props, forwardedRef) {
159
- const { licenseKey, sheetId, sheetType, ChartSheetView: ChartSheetViewComponent = ChartSheetView, instanceId, activeCell = DEFAULT_ACTIVE_CELL, selections = DEFAULT_ARRAY, frozenColumnCount = 0, frozenRowCount = 0, rowCount = DEFAULT_ROW_COUNT, columnCount = DEFAULT_COLUMN_COUNT, autoFocus, basicFilter, tables, namedRanges, bandedRanges = DEFAULT_ARRAY, tableBorderColor = "#008000", filterIconColor = FILTER_BUTTON_GLYPH_COLOR, conditionalFormats, showFilterIcon = true, showCalculatedColumnIcon = true, showHeaders = true, defaultColumnWidth = DEFAULT_COLUMN_WIDTH, defaultRowHeight = DEFAULT_ROW_HEIGHT, lineHeightMode = "fontMetrics", columnHeaderHeight = COLUMN_HEADER_HEIGHT, rowHeaderWidth = ROW_HEADER_WIDTH, gridLineColor = GRIDLINE_COLOR, cellBackgroundColor = DEFAULT_CELL_BACKGROUND_COLOR, cellColor = DEFAULT_CELL_COLOR, headerBorderColor = DEFAULT_HEADER_BORDER_COLOR, headerBackgroundColor = DEFAULT_HEADER_BG, headerColor = DEFAULT_HEADER_COLOR, headerActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_BG, headerSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_BG, headerSelectedColor = "white", headerTableBackgroundColor = DEFAULT_HEADER_TABLE_BG, headerTableActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_TABLE_BG, headerTableSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_TABLE_BG, frozenShadowColor = headerBorderColor, frozenShadowThickness = 1, selectionBackgroundColor = SELECTION_BG, selectionBorderColor = SELECTION_BORDER, selectionStrokeWidth, showActiveCellBorderInSelection, selectionDragBorderColor = SELECTION_BORDER, chartSelectedColor, chipBackgroundColor = CHIP_COLOR, merges = DEFAULT_ARRAY, borderStyles, protectedRanges, allowEditRanges, isWorkbookProtected: isWorkbookProtectedProp = false, getSheetProtection, pivotTables, charts, onUpdateChart, onChangeZOrder, embeds, slicers, rowMetadata = DEFAULT_ARRAY, columnMetadata = DEFAULT_ARRAY, scale: zoomScale = 1, zoomSpeed = 1, overscanCount = 3, enableEditOnEnterKey: enableEditOnEnterKeyProp, enterKeyDirection = "down", enableAutoCorrect, shouldHandleKeyDown, enableTextOverflow = true, showGridLines: _showGridLines, showZeros, rightToLeft: _rightToLeft, pageBreaks, pageBreakPreview: pageBreakPreviewProp, workbookView, printSettings, onChangeHeaderFooter, showRulers = true, workbookTitle, showFormulas = false, protectFormulas = false, showFrozenSeparator = true, HeaderCell = DefaultHeaderCell, Cell = DefaultCell, SelectionTitleComponent = SelectionTitle, CellEditor = DefaultCellEditor, CellTooltip, ContextMenu = DefaultContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, FilterBox = DefaultFilterBox, HeaderMoveDragComponent = DefaultHeaderMoveDragComponent, SuggestionsDropdown, stickyEditor = true, scrollSnap = false, scrollThrottleTimeout, preventBrowserDefaultScroll, mouseMoveThrottleTimeout = 60, tooltipIntentInterval = 60, selectionPolicy, users, userId, renderCollaboratorCursor, functionDescriptions, showHeaderMenuButton = true, scrollbarSize = SCROLLBAR_SIZE, theme = defaultSpreadsheetTheme, showNotes = true, showAllNotes = false, isNoteVisible: isNoteVisibleProp, showComments = true, circleInvalidData = false, getIgnoredErrors, locale, formulaLocale: formulaLocaleProp, referenceStyle = "A1", agentSuggestions, onReviewSuggestion, onShowFormulas, getDataRowCount, getDataRegion, getArrayFormula, getChartComponent, getEmbedComponent, getLinkedPictureSource: getLinkedPictureSourceProp, getSlicerComponent, onChange, onChangeBatch, onChangeArrayFormula, onExpandCollapse, onPivotDrillDown, onDelete, onChangeEditorValue, onFill, onRequestCalculate, onRequestFunctionArguments, onChangeActiveCell, onChangeActiveSheet, onChangeSelections, getSheetName, getSheetId, getCellData, getNote: getNoteProp, getTextFormatRuns, getDataValidation, getEffectiveFormat, getFormattedValue: getFormattedValueProp, getTooltipContent, errorResolutionComponent, getEffectiveValue: getEffectiveValueProp, getSparklineGroup, getUserEnteredExtendedValue, getEffectiveExtendedValue, getSheetRowCount, getSheetColumnCount, getCellPopoverContent, onScroll, onViewPortChange, windowConditionalFormats = false, engineConditionalFormatResults = false, getConditionalFormatRuleStats, onResize, onAutoResize, onHideColumn, onHideRow, onShowColumn, onShowRow, onGroupRows, onUngroupRows, onCollapseRowGroup, onExpandRowGroup, onGroupColumns, onUngroupColumns, onCollapseColumnGroup, onExpandColumnGroup, onSetOutlineDepth, onDeleteRow, onDeleteColumn, onInsertRow, onInsertColumn, onChangeAutoExpandTables, onChangeAutoCalculatedColumns, onInsertCellsShiftDown, onInsertCellsShiftRight, onDeleteCellsShiftLeft, onDeleteCellsShiftUp, onClearContents, onMoveColumns, onMoveRows, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onKeyDown, onChangeFormatting, onRepeatFormatting, onClearFormatting, onRequestEditProtectedRange, onRequestUnlockAllowEditRange, onMoveChart, onResizeChart, onDeleteChart, onCutChart, onCopyChart, onMoveEmbed, onResizeEmbed, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFillRange, onFlashFill, onFlashFillSuggest, onAcceptFlashFill, disableFillRightShortcut, keymap, enableAutoComplete = true, onCalculateNow, onRequestGoTo, onMoveSelection, onInsertCutCells, onInsertCopiedCells, onInsertTime, onInsertDate, onInsertDateTime, onInsertAutoSum, onUndo, onRedo, batchHistory, onPaste, onReapplyPaste, onCopy, onCut, onSortColumn, onSortTable, onFilterTable, onFilterPivot, onResizeTable, onUndoTableAutoExpansion, onUndoCalculatedColumn, onOverwriteCalculatedColumn, onRequestEditTable, onRequestEditPivotTable, onRequestDeletePivotTable, onRequestCreatePivotChart, onRemoveTable, onCreateTable, onRequestCreateTable, onInsertTableColumn, onDeleteTableColumn, onInsertTableRow, onDeleteTableRow, onUpdateTable, onRequestResizeTable, onRequestInsertSlicer, onCreateBasicFilter, onRequestDefineNamedRange, onRequestFormatCells, onRequestConditionalFormat, onRequestDataValidation, onRequestInsertComment, onRequestInsertLink, onFreezeColumn, onFreezeRow, onUpdateNote, onProtectRange, onUnProtectRange, onSortRange, onRequestSearch, onRequestReplace, onRequestResize, getRowHeaderText = getDefaultRowHeader, getColumnHeaderText: getColumnHeaderTextProp, getAdditionalCellSpacing, tokenizer: defaultTokenizer = defaultFormulaTokenizer, onChangeScale, onRemoveLink, onSelectLink, onSplitTextToColumns, onRemoveDuplicates, onGoalSeek, onSubtotal, onAdvancedFilter, onRequestExpand, cellExpandPredicate, StructuredResult = DefaultStructuredResult, getMentions, getStructuredProperties: getStructuredPropertiesProp, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, showSelectionResizeHandles = true, enableMagicFill, enableQuickEdit = true, MagicFillComponent, MagicFillContent, QuickEdit, PasteMenu, SuggestionAction, HiddenRowMarkers, HiddenColumnMarkers, enableResizerOverflow, className, defaultFontSizePoint = DEFAULT_FONT_SIZE_PT, defaultCellFormat, readonly, isComparing = false, getCellDiff, enableDataBoundaryNavigation, footerHeight, footerComponent, arrowComponents,
161
+ const { licenseKey, sheetId, sheetType, ChartSheetView: ChartSheetViewComponent = ChartSheetView, instanceId, activeCell = DEFAULT_ACTIVE_CELL, selections = DEFAULT_ARRAY, frozenColumnCount = 0, frozenRowCount = 0, rowCount = DEFAULT_ROW_COUNT, columnCount = DEFAULT_COLUMN_COUNT, autoFocus, basicFilter, tables, namedRanges, bandedRanges = DEFAULT_ARRAY, tableBorderColor = "#008000", filterIconColor = FILTER_BUTTON_GLYPH_COLOR, conditionalFormats, showFilterIcon = true, showCalculatedColumnIcon = true, showHeaders = true, defaultColumnWidth = DEFAULT_COLUMN_WIDTH, defaultRowHeight = DEFAULT_ROW_HEIGHT, lineHeightMode = "fontMetrics", columnHeaderHeight = COLUMN_HEADER_HEIGHT, rowHeaderWidth = ROW_HEADER_WIDTH, gridLineColor = GRIDLINE_COLOR, cellBackgroundColor = DEFAULT_CELL_BACKGROUND_COLOR, cellColor = DEFAULT_CELL_COLOR, headerBorderColor = DEFAULT_HEADER_BORDER_COLOR, headerBackgroundColor = DEFAULT_HEADER_BG, headerColor = DEFAULT_HEADER_COLOR, headerActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_BG, headerSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_BG, headerSelectedColor = "white", headerTableBackgroundColor = DEFAULT_HEADER_TABLE_BG, headerTableActiveBackgroundColor = DEFAULT_HEADER_ACTIVE_TABLE_BG, headerTableSelectedBackgroundColor = DEFAULT_HEADER_SELECTED_TABLE_BG, frozenShadowColor = headerBorderColor, frozenShadowThickness = 1, selectionBackgroundColor = SELECTION_BG, selectionBorderColor = SELECTION_BORDER, selectionStrokeWidth, showActiveCellBorderInSelection, selectionDragBorderColor = SELECTION_BORDER, chartSelectedColor, chipBackgroundColor = CHIP_COLOR, merges = DEFAULT_ARRAY, borderStyles, protectedRanges, allowEditRanges, isWorkbookProtected: isWorkbookProtectedProp = false, getSheetProtection, pivotTables, charts, onUpdateChart, onChangeZOrder, embeds, slicers, rowMetadata = DEFAULT_ARRAY, columnMetadata = DEFAULT_ARRAY, scale: zoomScale = 1, zoomSpeed = 1, overscanCount = 3, enableEditOnEnterKey: enableEditOnEnterKeyProp, enterKeyDirection = "down", enableAutoCorrect, shouldHandleKeyDown, enableTextOverflow = true, showGridLines: _showGridLines, showZeros, splitPane, enableCellDragAndDrop = true, alertBeforeOverwritingCells = true, autoPercentEntry = false, errorCheckingRules, rightToLeft: _rightToLeft, pageBreaks, pageBreakPreview: pageBreakPreviewProp, workbookView, printSettings, onChangeHeaderFooter, showRulers = true, workbookTitle, showFormulas = false, protectFormulas = false, showFrozenSeparator = true, HeaderCell = DefaultHeaderCell, Cell = DefaultCell, SelectionTitleComponent = SelectionTitle, CellEditor = DefaultCellEditor, CellTooltip, ContextMenu = DefaultContextMenu, ContextMenuWrapper = DefaultContextMenuWrapper, FilterBox = DefaultFilterBox, HeaderMoveDragComponent = DefaultHeaderMoveDragComponent, SuggestionsDropdown, stickyEditor = true, scrollSnap = false, scrollThrottleTimeout, preventBrowserDefaultScroll, mouseMoveThrottleTimeout = 60, tooltipIntentInterval = 60, selectionPolicy, users, userId, renderCollaboratorCursor, functionDescriptions, showHeaderMenuButton = true, scrollbarSize = SCROLLBAR_SIZE, theme = defaultSpreadsheetTheme, showNotes = true, showAllNotes = false, isNoteVisible: isNoteVisibleProp, showComments = true, circleInvalidData = false, getIgnoredErrors, locale, formulaLocale: formulaLocaleProp, referenceStyle = "A1", agentSuggestions, onReviewSuggestion, onShowFormulas, getDataRowCount, getDataRegion, getArrayFormula, getChartComponent, getEmbedComponent, getLinkedPictureSource: getLinkedPictureSourceProp, getSlicerComponent, onChange, onChangeBatch, onChangeArrayFormula, onExpandCollapse, onPivotDrillDown, onDelete, onChangeEditorValue, onFill, onRequestCalculate, onRequestFunctionArguments, onChangeActiveCell, onChangeActiveSheet, onChangeSelections, getSheetName, getSheetId, getCellData, getNote: getNoteProp, getTextFormatRuns, getDataValidation, getEffectiveFormat, getFormattedValue: getFormattedValueProp, getTooltipContent, errorResolutionComponent, getEffectiveValue: getEffectiveValueProp, getSparklineGroup, getUserEnteredExtendedValue, getEffectiveExtendedValue, getSheetRowCount, getSheetColumnCount, getCellPopoverContent, onScroll, onViewPortChange, windowConditionalFormats = false, engineConditionalFormatResults = false, getConditionalFormatRuleStats, onResize, onAutoResize, onHideColumn, onHideRow, onShowColumn, onShowRow, onGroupRows, onUngroupRows, onCollapseRowGroup, onExpandRowGroup, onGroupColumns, onUngroupColumns, onCollapseColumnGroup, onExpandColumnGroup, onSetOutlineDepth, onDeleteRow, onDeleteColumn, onInsertRow, onInsertColumn, onChangeAutoExpandTables, onChangeAutoCalculatedColumns, onInsertCellsShiftDown, onInsertCellsShiftRight, onDeleteCellsShiftLeft, onDeleteCellsShiftUp, onClearContents, onMoveColumns, onMoveRows, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onKeyDown, onChangeFormatting, onRepeatFormatting, onClearFormatting, onRequestEditProtectedRange, onRequestUnlockAllowEditRange, onMoveChart, onResizeChart, onDeleteChart, onCutChart, onCopyChart, onMoveEmbed, onResizeEmbed, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFillRange, onFlashFill, onFlashFillSuggest, onAcceptFlashFill, disableFillRightShortcut, keymap, enableAutoComplete = true, onCalculateNow, onRequestGoTo, onMoveSelection, onInsertCutCells, onInsertCopiedCells, onInsertTime, onInsertDate, onInsertDateTime, onInsertAutoSum, onUndo, onRedo, batchHistory, onPaste, onReapplyPaste, onCopy, onCut, onSortColumn, onSortTable, onFilterTable, onFilterPivot, onResizeTable, onUndoTableAutoExpansion, onUndoCalculatedColumn, onOverwriteCalculatedColumn, onRequestEditTable, onRequestEditPivotTable, onRequestDeletePivotTable, onRequestCreatePivotChart, onRemoveTable, onCreateTable, onRequestCreateTable, onInsertTableColumn, onDeleteTableColumn, onInsertTableRow, onDeleteTableRow, onUpdateTable, onRequestResizeTable, onRequestInsertSlicer, onCreateBasicFilter, onRequestDefineNamedRange, onRequestFormatCells, onRequestConditionalFormat, onRequestDataValidation, onRequestInsertComment, onRequestInsertLink, onFreezeColumn, onFreezeRow, onUpdateNote, onProtectRange, onUnProtectRange, onSortRange, onRequestSearch, onRequestReplace, onRequestResize, getRowHeaderText = getDefaultRowHeader, getColumnHeaderText: getColumnHeaderTextProp, getAdditionalCellSpacing, tokenizer: defaultTokenizer = defaultFormulaTokenizer, onChangeScale, onRemoveLink, onSelectLink, onSplitTextToColumns, onRemoveDuplicates, onGoalSeek, onSubtotal, onAdvancedFilter, onRequestExpand, cellExpandPredicate, StructuredResult = DefaultStructuredResult, getMentions, getStructuredProperties: getStructuredPropertiesProp, getFunctionParameterSuggestions, shouldFetchFunctionParameters, MentionTagComponent, MentionDropdownItemComponent, showSelectionResizeHandles = true, enableMagicFill, enableQuickEdit = true, MagicFillComponent, MagicFillContent, QuickEdit, PasteMenu, SuggestionAction, HiddenRowMarkers, HiddenColumnMarkers, enableResizerOverflow, className, defaultFontSizePoint = DEFAULT_FONT_SIZE_PT, defaultCellFormat, readonly, isComparing = false, getCellDiff, enableDataBoundaryNavigation, footerHeight, footerComponent, arrowComponents,
160
162
  // Host-driven filter props. `hostHiddenRowRanges`
161
163
  // supplies compact [start, end] hidden-row tuples; `getFilterValues` supplies a
162
164
  // column's distinct values. Both let a million-row filter render without scanning
@@ -364,6 +366,17 @@ function CanvasGridComponent(props, forwardedRef) {
364
366
  const pageBreakPreview = pageLayout ? undefined : pageBreakPreviewProp;
365
367
  const frozenRows = pageLayout ? 1 : (frozenRowCount ?? 0) + 1;
366
368
  const frozenColumns = pageLayout ? 1 : (frozenColumnCount ?? 0) + 1;
369
+ /**
370
+ * View ▸ Split. The grid wants pixels from the first body cell; the sheet stores twentieths of a
371
+ * point. Page Layout view draws pages rather than a window, so it never splits.
372
+ */
373
+ const splitPanePx = useMemo(() => (pageLayout ? undefined : splitPanePixels(splitPane)), [pageLayout, splitPane]);
374
+ /** Moving the bar, or taking the split away, is a change to the sheet. */
375
+ const handleSplitPaneChange = useCallback((next) => {
376
+ onUpdateSheet?.(sheetId, {
377
+ splitPane: next === null ? null : splitPaneFromPixels(next, splitPane),
378
+ });
379
+ }, [onUpdateSheet, sheetId, splitPane]);
367
380
  const selectionTopBound = 1;
368
381
  const selectionLeftBound = 1;
369
382
  const fillHandleSize = 8;
@@ -894,6 +907,34 @@ function CanvasGridComponent(props, forwardedRef) {
894
907
  * @returns ScrollCoords
895
908
  */
896
909
  const getScrollPosition = useCallback(() => gridRef.current?.getScrollPosition() ?? DEFAULT_SCROLL_POSITION, []);
910
+ /** The pane the open editor belongs to; set when the edit starts (`handleBeforeEdit`). */
911
+ const editorPaneIdRef = useRef(undefined);
912
+ /**
913
+ * A pane scrolling on its own does not move the sheet, so nothing else would re-render: this
914
+ * counter is what makes the overlays drawn over the grid read their pane's offsets again.
915
+ */
916
+ const [paneScrollTick, setPaneScrollTick] = useState(0);
917
+ const handlePaneScroll = useCallback(() => {
918
+ setPaneScrollTick((tick) => tick + 1);
919
+ }, []);
920
+ /**
921
+ * What the cell editor is placed by. A sheet with no split answers exactly what
922
+ * `getScrollPosition` answers; a split sheet answers the editor's own pane, so the editor sits
923
+ * over its cell while that pane scrolls and does not move when the other pane does.
924
+ */
925
+ const getEditorScrollPosition = useCallback(() => {
926
+ const grid = gridRef.current;
927
+ if (!grid)
928
+ return DEFAULT_SCROLL_POSITION;
929
+ // `getActivePane()` is undefined on a sheet with no split and allocates nothing; asking for
930
+ // the pane list here would build an array every time the editor is placed.
931
+ if (!grid.getActivePane())
932
+ return grid.getScrollPosition();
933
+ return grid.getPaneScrollPosition(editorPaneIdRef.current);
934
+ // The tick is the dependency on purpose: a pane scrolling must give this callback a new
935
+ // identity, so the editor's position is computed again.
936
+ // eslint-disable-next-line react-hooks/exhaustive-deps
937
+ }, [paneScrollTick]);
897
938
  // Does the column contains a table
898
939
  const columnContainsTable = useCallback((columnIndex) => {
899
940
  const [_, tableColumnHeaderIds] = tableHeaderCells;
@@ -1061,12 +1102,33 @@ function CanvasGridComponent(props, forwardedRef) {
1061
1102
  const activeIgnoredErrorsKey = JSON.stringify(activeIgnoredErrors ?? null);
1062
1103
  // eslint-disable-next-line react-hooks/exhaustive-deps
1063
1104
  const stableIgnoredErrors = useMemo(() => activeIgnoredErrors, [activeIgnoredErrorsKey]);
1105
+ // "Formulas which omit cells in a region" counts the numbers typed as values beside a range.
1106
+ const isNumberValueAt = useCallback((targetSheetId, rowIndex, columnIndex) => {
1107
+ const uev = getUserEnteredValue(targetSheetId, rowIndex, columnIndex);
1108
+ if (!uev || uev.fv != null || uev.formulaValue != null)
1109
+ return false;
1110
+ const value = getEffectiveValue(targetSheetId, rowIndex, columnIndex);
1111
+ return typeof (value?.nv ?? value?.numberValue) === "number";
1112
+ }, [getUserEnteredValue, getEffectiveValue]);
1113
+ // Keyed on the list's content: a host passing an inline array must not repaint every cell.
1114
+ const errorRulesKey = errorCheckingRules?.join(",");
1115
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1116
+ const enabledErrorRules = useMemo(() => errorCheckingRules, [errorRulesKey]);
1117
+ const formulaRangeOn = !enabledErrorRules || enabledErrorRules.includes("formulaRange");
1064
1118
  const getErrorCheck = useCallback((targetSheetId, rowIndex, columnIndex) => {
1065
1119
  const kind = getErrorCheckKind({
1066
1120
  userEnteredValue: getUserEnteredValue(targetSheetId, rowIndex, columnIndex),
1067
1121
  effectiveValue: getEffectiveValue(targetSheetId, rowIndex, columnIndex),
1068
1122
  errorValue: getErrorValue(targetSheetId, rowIndex, columnIndex),
1123
+ cell: { rowIndex, columnIndex },
1124
+ isNumberAt: formulaRangeOn
1125
+ ? (row, column) => isNumberValueAt(targetSheetId, row, column)
1126
+ : undefined,
1069
1127
  });
1128
+ // The person's Error Checking rules: a rule that is off flags nothing.
1129
+ if (kind && enabledErrorRules && !enabledErrorRules.includes(kind)) {
1130
+ return undefined;
1131
+ }
1070
1132
  if (kind &&
1071
1133
  isErrorIgnored(targetSheetId === sheetId
1072
1134
  ? stableIgnoredErrors
@@ -1078,6 +1140,9 @@ function CanvasGridComponent(props, forwardedRef) {
1078
1140
  getUserEnteredValue,
1079
1141
  getEffectiveValue,
1080
1142
  getErrorValue,
1143
+ isNumberValueAt,
1144
+ formulaRangeOn,
1145
+ enabledErrorRules,
1081
1146
  getIgnoredErrorsStable,
1082
1147
  stableIgnoredErrors,
1083
1148
  sheetId,
@@ -1183,14 +1248,22 @@ function CanvasGridComponent(props, forwardedRef) {
1183
1248
  if (stringValue) {
1184
1249
  return stringValue;
1185
1250
  }
1186
- // Check for date value
1187
1251
  const numberFormatType = getCellFormat(sheetId, rowIndex, columnIndex)
1188
1252
  ?.numberFormat?.type;
1253
+ const numberValue = getExtendedValueNumber(userEnteredValue);
1254
+ // A date, time or percentage edits as Excel shows it in the formula bar: the
1255
+ // whole date in the short date (`1/2/2026`, never the display's `2-Jan`), the
1256
+ // time in the long time, the percentage with its `%`.
1257
+ if (!isNil(numberValue)) {
1258
+ const editValue = excelEditValueOfNumber(numberValue, numberFormatType, locale);
1259
+ if (editValue !== undefined) {
1260
+ return editValue;
1261
+ }
1262
+ }
1189
1263
  if (numberFormatType === "DATE" || numberFormatType === "DATE_TIME") {
1190
1264
  return getFormattedValue(sheetId, rowIndex, columnIndex);
1191
1265
  }
1192
1266
  // If the cell is of type number, fallback to number
1193
- const numberValue = getExtendedValueNumber(userEnteredValue);
1194
1267
  if (!isNil(numberValue)) {
1195
1268
  return String(numberValue);
1196
1269
  }
@@ -1203,6 +1276,7 @@ function CanvasGridComponent(props, forwardedRef) {
1203
1276
  getFormattedValue,
1204
1277
  getCellFormat,
1205
1278
  protectFormulas,
1279
+ locale,
1206
1280
  ]);
1207
1281
  // Add a stable reference to get userEnteredString value
1208
1282
  const getUserEnteredStringValueStable = useCallbackRef(getUserEnteredStringValue);
@@ -2787,7 +2861,12 @@ function CanvasGridComponent(props, forwardedRef) {
2787
2861
  */
2788
2862
  const openMoveOverwriteConfirm = useOpenMoveOverwriteConfirm();
2789
2863
  const isMoveOverwriteConfirmMounted = useIsMoveOverwriteConfirmMounted();
2790
- const confirmMoveOverwrite = useMemo(() => isMoveOverwriteConfirmMounted ? openMoveOverwriteConfirm : undefined, [isMoveOverwriteConfirmMounted, openMoveOverwriteConfirm]);
2864
+ const confirmMoveOverwrite = useMemo(() => !alertBeforeOverwritingCells
2865
+ ? // "Alert before overwriting cells" off: a drop replaces the data without asking.
2866
+ () => true
2867
+ : isMoveOverwriteConfirmMounted
2868
+ ? openMoveOverwriteConfirm
2869
+ : undefined, [alertBeforeOverwritingCells, isMoveOverwriteConfirmMounted, openMoveOverwriteConfirm]);
2791
2870
  /**
2792
2871
  * Fill handle dragged BACK inside the selection (Excel): the dragged-over cells lose their
2793
2872
  * contents — formats stay unless Ctrl/Cmd was held — through the same `onDelete` path as the
@@ -3136,6 +3215,7 @@ function CanvasGridComponent(props, forwardedRef) {
3136
3215
  getEffectiveFormat,
3137
3216
  onChangeFormatting,
3138
3217
  autoCorrect,
3218
+ autoPercentEntry,
3139
3219
  });
3140
3220
  /**
3141
3221
  * User cancels editing the cell
@@ -3167,6 +3247,10 @@ function CanvasGridComponent(props, forwardedRef) {
3167
3247
  * Use before edit to store editing cell reference
3168
3248
  */
3169
3249
  const handleBeforeEdit = useCallback((sheetId, cell) => {
3250
+ // Excel's View ▸ Split: the editor opens in the pane that was clicked — the pane the grid
3251
+ // is working in — and stays there while that pane scrolls, even when the same cell is
3252
+ // visible in the other one too. A keyboard edit opens in that same pane.
3253
+ editorPaneIdRef.current = gridRef.current?.getActivePane()?.id;
3170
3254
  setEditingCellCoordinate({
3171
3255
  ...cell,
3172
3256
  sheetId,
@@ -3502,7 +3586,7 @@ function CanvasGridComponent(props, forwardedRef) {
3502
3586
  canEdit: canEditCell,
3503
3587
  canView: canViewCell,
3504
3588
  sticky: stickyEditor,
3505
- getScrollPosition,
3589
+ getScrollPosition: getEditorScrollPosition,
3506
3590
  hideOnBlur: formulaMode && canSelectCells ? false : true,
3507
3591
  isHiddenRow,
3508
3592
  isHiddenColumn,
@@ -3561,6 +3645,16 @@ function CanvasGridComponent(props, forwardedRef) {
3561
3645
  * number in ONE undo step; Ignore Error records the selection in the sheet's `ignoredErrors`
3562
3646
  * (xlsx `<ignoredErrors>`), so the flag stays off after a save and reopen.
3563
3647
  */
3648
+ /**
3649
+ * The editor's pane is remembered only while the edit lasts. Commit, cancel, a blur or the
3650
+ * grid going away all end it, and the next thing opened over the sheet — a comment popover,
3651
+ * the cell-expand box — belongs to the pane it is opened in, not to the pane last edited in.
3652
+ */
3653
+ useEffect(() => {
3654
+ if (!isEditInProgress) {
3655
+ editorPaneIdRef.current = undefined;
3656
+ }
3657
+ }, [isEditInProgress]);
3564
3658
  const formulaBarEditor = useAtomValue(formulaBarEditorInstanceAtom);
3565
3659
  const activeErrorCheck = !readonly
3566
3660
  ? getErrorCheck(sheetId, activeCell.rowIndex, activeCell.columnIndex)
@@ -3598,6 +3692,14 @@ function CanvasGridComponent(props, forwardedRef) {
3598
3692
  maxRow: getDataRowCount?.(sheetId) ?? Number.MAX_SAFE_INTEGER,
3599
3693
  maxColumn: getDataColumnCount?.(sheetId) ?? Number.MAX_SAFE_INTEGER,
3600
3694
  getIgnoredErrors,
3695
+ activeCell: {
3696
+ rowIndex: activeCell.rowIndex,
3697
+ columnIndex: activeCell.columnIndex,
3698
+ },
3699
+ isNumberAt: (rowIndex, columnIndex) => isNumberValueAt(sheetId, rowIndex, columnIndex),
3700
+ onChange: (targetSheetId, cell, value) => {
3701
+ onChange?.(targetSheetId, cell, value, undefined, getFormulaValue(targetSheetId, cell.rowIndex, cell.columnIndex));
3702
+ },
3601
3703
  onChangeBatch,
3602
3704
  batchHistory,
3603
3705
  onUpdateSheet,
@@ -4422,6 +4524,7 @@ function CanvasGridComponent(props, forwardedRef) {
4422
4524
  * 3. When the grid is readonly — a fill is a write
4423
4525
  */
4424
4526
  const showFillHandle = !readonly &&
4527
+ enableCellDragAndDrop &&
4425
4528
  !isSelectionInProgress &&
4426
4529
  !isEditInProgress &&
4427
4530
  !isResizingTable &&
@@ -4448,6 +4551,7 @@ function CanvasGridComponent(props, forwardedRef) {
4448
4551
  scale,
4449
4552
  isFillShrink: fillShrink !== undefined,
4450
4553
  onSelectionMouseDown: onSelectionElementMouseDown,
4554
+ enableCellDragAndDrop,
4451
4555
  onMouseDownResizeHandle: onMouseDownResizeHandle,
4452
4556
  onMouseDownChartSourceResizeHandle,
4453
4557
  onMouseDownMoveSelection: onMouseDownMoveSelection,
@@ -4920,6 +5024,10 @@ function CanvasGridComponent(props, forwardedRef) {
4920
5024
  popoverRange,
4921
5025
  cellExpandComponent,
4922
5026
  arrowComponents,
5027
+ // ONE notion of the editor's pane: the pane recorded when the edit started, which is what
5028
+ // the editor is positioned by. Without it the DOM would be placed by the pane last pointed
5029
+ // at, and the two can disagree (the independent review's finding 6).
5030
+ editorPaneId: editorPaneIdRef.current,
4923
5031
  });
4924
5032
  const sheetNameForLayout = pageLayout ? getSheetName?.(sheetId) ?? "" : "";
4925
5033
  const handleChangeHeaderFooter = useCallback((headerFooter) => onChangeHeaderFooter?.(sheetId, headerFooter), [onChangeHeaderFooter, sheetId]);
@@ -4974,7 +5082,11 @@ function CanvasGridComponent(props, forwardedRef) {
4974
5082
  * in formula mode. A readonly grid has nothing to move, so the
4975
5083
  * gesture does not start at all (no move cursor, no selection jump).
4976
5084
  */
4977
- const enableSelectionDrag = !readonly && !isSelectionInProgress && !isEditInProgress && !formulaMode;
5085
+ const enableSelectionDrag = enableCellDragAndDrop &&
5086
+ !readonly &&
5087
+ !isSelectionInProgress &&
5088
+ !isEditInProgress &&
5089
+ !formulaMode;
4978
5090
  // A chartsheet IS its chart: no grid, headers, editor or cell menus — only the chart and its
4979
5091
  // context menu (Excel).
4980
5092
  if (sheetType === "chartsheet") {
@@ -5006,7 +5118,10 @@ function CanvasGridComponent(props, forwardedRef) {
5006
5118
  width === 0 || height === 0 ? (React.createElement("div", { className: "flex border-solid border-rnc-border border border-t border-b flex-1 justify-center items-center" },
5007
5119
  React.createElement("div", { className: "space-y-2" },
5008
5120
  React.createElement(Skeleton, { className: "h-4 w-[250px]" }),
5009
- React.createElement(Skeleton, { className: "h-4 w-[250px]" })))) : (React.createElement(BaseGrid, { ref: gridRef, overscanCount: overscanCount, rowCount: sheetRowCount, columnCount: sheetColumnCount, rowHeight: rowHeight, columnWidth: columnWidth, itemRenderer: cellRenderer, headerRenderer: headerCellRenderer, selectionRenderer: selectionRenderer, gridLineColor: gridLineColor, gridLineWidth: gridLineWidth, borderStyles: gridBorderStyles, mergedCells: merges, scale: scale, width: width, height: height, frozenColumns: frozenColumns, frozenRows: frozenRows, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle, fillHandleSize: fillHandleSize, showGridLines: showGridLines, enableCellOverlay: true, enableCellBackground: true, enableSelectionDrag: enableSelectionDrag, showFrozenColumnShadow: showFrozenSeparator, showFrozenRowShadow: showFrozenSeparator, selectionBorderColor: selectionBorderColor, selectionBackgroundColor: selectionBackgroundColor, fillhandleBorderColor: cellBackgroundColor, isDraggingSelection: isDragging, fillSelection: fillShrinkOverlay ?? fillSelection, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onMouseDown: handleMouseDown, onDoubleClick: handleDoubleClick, onFillHandleMouseDown: onFillHandleMouseDown, onFillHandleDoubleClick: onFillHandleDoubleClick,
5121
+ React.createElement(Skeleton, { className: "h-4 w-[250px]" })))) : (React.createElement(BaseGrid, { ref: gridRef, overscanCount: overscanCount, rowCount: sheetRowCount, columnCount: sheetColumnCount, rowHeight: rowHeight, columnWidth: columnWidth, itemRenderer: cellRenderer, headerRenderer: headerCellRenderer, selectionRenderer: selectionRenderer, gridLineColor: gridLineColor, gridLineWidth: gridLineWidth, borderStyles: gridBorderStyles, mergedCells: merges, scale: scale, width: width, height: height, frozenColumns: frozenColumns, frozenRows: frozenRows, splitPane: splitPanePx, onSplitPaneChange: handleSplitPaneChange, onPaneScroll: handlePaneScroll,
5122
+ // Freeze Panes and Split are mutually exclusive: the grid is told the SHEET's frozen
5123
+ // counts, not the heading band added above.
5124
+ sheetFrozenRows: frozenRowCount ?? 0, sheetFrozenColumns: frozenColumnCount ?? 0, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle, fillHandleSize: fillHandleSize, showGridLines: showGridLines, enableCellOverlay: true, enableCellBackground: true, enableSelectionDrag: enableSelectionDrag, showFrozenColumnShadow: showFrozenSeparator, showFrozenRowShadow: showFrozenSeparator, selectionBorderColor: selectionBorderColor, selectionBackgroundColor: selectionBackgroundColor, fillhandleBorderColor: cellBackgroundColor, isDraggingSelection: isDragging, fillSelection: fillShrinkOverlay ?? fillSelection, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onMouseDown: handleMouseDown, onDoubleClick: handleDoubleClick, onFillHandleMouseDown: onFillHandleMouseDown, onFillHandleDoubleClick: onFillHandleDoubleClick,
5010
5125
  // Dimension of fill handle
5011
5126
  scrollToCellOffset: 4, scrollbarSize: scrollbarSize, isHiddenCell: isHiddenCell, isHiddenColumn: isHiddenColumn, isHiddenRow: isHiddenRow, visibleRowRanges: visibleRowRanges, rowSizeHint: rowSizeHint, columnSizeHint: columnSizeHint, isHiddenOverlay: isHiddenOverlay, isHiddenBackground: isHiddenBackground, overlayRenderer: cellOverlayRenderer, backgroundRenderer: cellBackgroundRenderer, backgroundsRenderer: cellBackgroundsRenderer, shadowSettings: shadowSettings, onScroll: handleScroll, onViewPortChange: handleViewPortChange, autoFocus: autoFocus, snap: scrollSnap, scrollThrottleTimeout: scrollThrottleTimeout, preventBrowserDefaultScroll: preventBrowserDefaultScroll, showHeaders: showHeaders, gridChildren: gridChildren, onTouchStart: onTouchStart, onDimensionsChange: onDimensionsChange, extendScrollSize: isTouchDevice || isFirefox, isTouchDevice: isTouchDevice, frozenShadowThickness: frozenShadowThickness, onAfterScrollToCell: onAfterScrollToCell, estimatedRowHeight: defaultRowHeight, estimatedColumnWidth: defaultColumnWidth, footerHeight: footerHeight, footerComponent: footerComponent, getOverflowBuffer: getOverflowBuffer, getFrozenColumnOverflowCells: getFrozenColumnOverflowCells, rightToLeft: rightToLeft, getRowGap: pageLayout?.getRowGap, getColumnGap: pageLayout?.getColumnGap })),
5012
5127
  React.createElement(RtlMirrorLayer, { rightToLeft: rightToLeft }, tooltipComponent),
@@ -8,6 +8,7 @@ import type { ElementType } from "react";
8
8
  import type React from "react";
9
9
  import type { CalculatedColumnFill } from "../../api/calculated-column-fill";
10
10
  import type { CfRangeStats } from "../../api/cf-overlays";
11
+ import type { ErrorCheckKind } from "../../api/error-checking";
11
12
  import type { TableAutoExpansion } from "../../api/table-auto-expansion";
12
13
  import type { ContextMenuWrapperProps } from "../../hooks/use-context-menu";
13
14
  import type { PasteSpecialOptions, PasteSpecialRequest } from "../../hooks/use-copy-paste-cut";
@@ -18,7 +19,7 @@ import type { useFlash } from "../../hooks/use-flash";
18
19
  import type { useNavigateToSheetRange } from "../../hooks/use-navigate-sheet-range";
19
20
  import type { UseSelectionOptions } from "../../hooks/use-selection";
20
21
  import type { GetCellDimensionsOptions as SizerGetCellDimensionsOptions, useSizer } from "../../hooks/use-sizer";
21
- import type { AdvancedFilterOptions, AdvancedFilterResult, AgentSuggestion, BandedDefinition, BandedRange, BooleanCondition, BorderStyle, CellFormat, Collaborator, Color, ColorFilterCriteria, ConditionType, ConditionValue, CreateTableOptions, DataValidationRule, DataValidationRuleRecord, EmbeddedObject, FilterConditionJoin, GoalSeekResult, GoalSeekTargetOptions, IconFilterCriteria, IgnoredError, Maybe, NamedRange, ParsedToken, PivotTable, ProtectedRange, AllowEditRange, RemoveDuplicatesOptions, Sheet, SheetCoordinate, SheetProtection, SheetRange, Slicer, SortOrder, SortSpecs, SplitTextOptions, SubtotalOptions, SubtotalResult, TableTheme, TableView } from "../../types";
22
+ import type { AdvancedFilterOptions, AdvancedFilterResult, AgentSuggestion, BandedDefinition, BandedRange, BooleanCondition, BorderStyle, CellFormat, Collaborator, Color, ColorFilterCriteria, ConditionType, ConditionValue, CreateTableOptions, DataValidationRule, DataValidationRuleRecord, EmbeddedObject, FilterConditionJoin, GoalSeekResult, GoalSeekTargetOptions, IconFilterCriteria, IgnoredError, Maybe, NamedRange, ParsedToken, PivotTable, ProtectedRange, AllowEditRange, RemoveDuplicatesOptions, Sheet, SheetCoordinate, SheetProtection, SheetRange, Slicer, SortOrder, SortSpecs, SplitPane, SplitTextOptions, SubtotalOptions, SubtotalResult, TableTheme, TableView } from "../../types";
22
23
  import type { AutoFillType, AXIS, CellData, ConditionalFormatRule, EmbeddedChart, FillOptions, FilterView, OverlayToAnchor, SheetType, PrintHeaderFooter, SheetPrintSettings } from "../../types";
23
24
  import type { SheetObject, ZOrderChange } from "../../utils/z-order";
24
25
  import type { CellProps } from "../cell/typings";
@@ -423,6 +424,42 @@ export type CanvasGridProps<T extends CellData = CellData<any, any>> = {
423
424
  * this sheet; the value itself is untouched.
424
425
  */
425
426
  showZeros?: Maybe<boolean>;
427
+ /**
428
+ * View ▸ Split: the sheet's stored split window (`<pane state="split">`). The body is drawn as
429
+ * panes that scroll on their own, and moving or removing the bar is reported through
430
+ * `onUpdateSheet(sheetId, { splitPane })`. Freeze Panes and Split are mutually exclusive, so a
431
+ * sheet with frozen rows or columns ignores this.
432
+ */
433
+ splitPane?: Maybe<SplitPane>;
434
+ /**
435
+ * Excel's "Enable fill handle and cell drag-and-drop" (Preferences ▸ Edit). `false` hides the
436
+ * fill handle and makes the selection border undraggable (no drag move / copy / insert).
437
+ * Default `true`.
438
+ */
439
+ enableCellDragAndDrop?: boolean;
440
+ /**
441
+ * Excel's "Alert before overwriting cells" (Preferences ▸ Edit). `false` lets a drag-and-drop
442
+ * move or copy replace non-empty cells without the "There's already data here" prompt.
443
+ * Default `true`.
444
+ */
445
+ alertBeforeOverwritingCells?: boolean;
446
+ /**
447
+ * Excel's "Enable automatic percent entry" (Preferences ▸ Edit): a plain number typed into a
448
+ * Percentage-formatted cell is read as a percent (`5` → 5%, stored 0.05); a number typed with
449
+ * its own `%`, or below 1 (`0.5`), is kept as it is. Default `false` (the number is stored as
450
+ * typed, so `5` shows 500%).
451
+ */
452
+ autoPercentEntry?: boolean;
453
+ /**
454
+ * Excel's Error Checking rules (Preferences ▸ Error Checking): the error-check kinds the grid
455
+ * flags with the green triangle — `evalError` ("Cells containing formulas that result in an
456
+ * error"), `numberStoredAsText`, `formulaRange` ("Formulas which omit cells in a region").
457
+ * A kind left out is not flagged and its cells offer no smart tag. Default: all of them.
458
+ * `[]` turns background error checking off.
459
+ * A person setting, like Excel's: nothing is written to the workbook (Ignore Error on one cell
460
+ * still records that cell in the sheet's `ignoredErrors`, as Excel saves it).
461
+ */
462
+ errorCheckingRules?: ReadonlyArray<ErrorCheckKind>;
426
463
  /**
427
464
  * The sheet displays right-to-left (`<sheetView rightToLeft="1">`, Page
428
465
  * Layout ▸ Sheet Right-to-Left): column A on the right, row headings on the