@rowsncolumns/spreadsheet 10.10.5 → 10.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/split-pane.d.ts +10 -0
- package/dist/cjs/api/split-pane.d.ts.map +1 -1
- package/dist/cjs/api/split-pane.js +29 -1
- package/dist/cjs/atoms/calculated-column-fill.atom.d.ts +6 -2
- package/dist/cjs/atoms/calculated-column-fill.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/calculated-column-fill.atom.js +6 -2
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/fill-options.atom.d.ts +5 -0
- package/dist/cjs/atoms/fill-options.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/table-auto-expansion.atom.d.ts +5 -2
- package/dist/cjs/atoms/table-auto-expansion.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/table-auto-expansion.atom.js +5 -2
- package/dist/cjs/components/autocorrect-options-smart-tag/index.d.ts +37 -0
- package/dist/cjs/components/autocorrect-options-smart-tag/index.d.ts.map +1 -0
- package/dist/cjs/components/autocorrect-options-smart-tag/index.js +84 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +327 -115
- package/dist/cjs/components/canvas-grid/typings.d.ts +33 -1
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/embeds/chart-component.d.ts +9 -0
- package/dist/cjs/components/embeds/chart-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.d.ts +9 -0
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +13 -114
- package/dist/cjs/components/embeds/embed-draggable.d.ts +17 -2
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +323 -25
- package/dist/cjs/components/embeds/object-focus.d.ts +32 -0
- package/dist/cjs/components/embeds/object-focus.d.ts.map +1 -0
- package/dist/cjs/components/embeds/object-focus.js +140 -0
- package/dist/cjs/components/embeds/page-gaps.d.ts +67 -0
- package/dist/cjs/components/embeds/page-gaps.d.ts.map +1 -0
- package/dist/cjs/components/embeds/page-gaps.js +159 -0
- package/dist/cjs/components/embeds/slicer-component.d.ts +9 -0
- package/dist/cjs/components/embeds/slicer-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/text-box-view.d.ts +18 -0
- package/dist/cjs/components/embeds/text-box-view.d.ts.map +1 -0
- package/dist/cjs/components/embeds/text-box-view.js +130 -0
- package/dist/cjs/components/filter-box/filter-by-color.d.ts.map +1 -1
- package/dist/cjs/components/filter-box/filter-by-color.js +10 -3
- package/dist/cjs/components/filter-box/index.d.ts.map +1 -1
- package/dist/cjs/components/filter-box/index.js +5 -1
- package/dist/cjs/components/print-preview/page-block.d.ts +46 -0
- package/dist/cjs/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/page-block.js +111 -6
- package/dist/cjs/components/print-preview/print-cells.d.ts +5 -0
- package/dist/cjs/components/print-preview/print-cells.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/print-cells.js +1 -0
- package/dist/cjs/components/print-preview/print-preview-dialog.d.ts +16 -2
- package/dist/cjs/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/print-preview-dialog.js +246 -14
- package/dist/cjs/components/print-preview/settings.d.ts +8 -0
- package/dist/cjs/components/print-preview/settings.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/settings.js +4 -1
- package/dist/cjs/components/print-preview/sheet-page-setup.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/sheet-page-setup.js +14 -2
- package/dist/cjs/components/selection/fill-options-menu.d.ts +8 -1
- package/dist/cjs/components/selection/fill-options-menu.d.ts.map +1 -1
- package/dist/cjs/components/selection/fill-options-menu.js +5 -3
- package/dist/cjs/components/selection/index.d.ts +1 -1
- package/dist/cjs/components/selection/index.d.ts.map +1 -1
- package/dist/cjs/components/selection/index.js +5 -6
- package/dist/cjs/components/selection/types.d.ts +13 -8
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- package/dist/cjs/components/sheet-background/index.d.ts +26 -0
- package/dist/cjs/components/sheet-background/index.d.ts.map +1 -0
- package/dist/cjs/components/sheet-background/index.js +106 -0
- package/dist/cjs/components/sort-range-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/sort-range-dialog/index.js +6 -3
- package/dist/cjs/hooks/object-clipboard-payload.d.ts +58 -0
- package/dist/cjs/hooks/object-clipboard-payload.d.ts.map +1 -0
- package/dist/cjs/hooks/object-clipboard-payload.js +488 -0
- package/dist/cjs/hooks/object-spec-schema.generated.d.ts +24 -0
- package/dist/cjs/hooks/object-spec-schema.generated.d.ts.map +1 -0
- package/dist/cjs/hooks/object-spec-schema.generated.js +4767 -0
- package/dist/cjs/hooks/use-chart-clipboard.d.ts +55 -9
- package/dist/cjs/hooks/use-chart-clipboard.d.ts.map +1 -1
- package/dist/cjs/hooks/use-chart-clipboard.js +307 -55
- package/dist/cjs/hooks/use-embeds-charts.d.ts +7 -1
- package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-embeds-charts.js +74 -14
- package/dist/cjs/hooks/use-grid-children.d.ts +8 -2
- package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/cjs/hooks/use-grid-children.js +71 -4
- package/dist/cjs/hooks/use-selection-renderer.d.ts +16 -5
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +59 -32
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +58 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/split-pane.d.ts +10 -0
- package/dist/esm/api/split-pane.d.ts.map +1 -1
- package/dist/esm/api/split-pane.js +25 -0
- package/dist/esm/atoms/calculated-column-fill.atom.d.ts +6 -2
- package/dist/esm/atoms/calculated-column-fill.atom.d.ts.map +1 -1
- package/dist/esm/atoms/calculated-column-fill.atom.js +6 -2
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/fill-options.atom.d.ts +5 -0
- package/dist/esm/atoms/fill-options.atom.d.ts.map +1 -1
- package/dist/esm/atoms/table-auto-expansion.atom.d.ts +5 -2
- package/dist/esm/atoms/table-auto-expansion.atom.d.ts.map +1 -1
- package/dist/esm/atoms/table-auto-expansion.atom.js +5 -2
- package/dist/esm/components/autocorrect-options-smart-tag/index.d.ts +37 -0
- package/dist/esm/components/autocorrect-options-smart-tag/index.d.ts.map +1 -0
- package/dist/esm/components/autocorrect-options-smart-tag/index.js +87 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +248 -52
- package/dist/esm/components/canvas-grid/typings.d.ts +33 -1
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/embeds/chart-component.d.ts +9 -0
- package/dist/esm/components/embeds/chart-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.d.ts +9 -0
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +12 -113
- package/dist/esm/components/embeds/embed-draggable.d.ts +17 -2
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +314 -19
- package/dist/esm/components/embeds/object-focus.d.ts +32 -0
- package/dist/esm/components/embeds/object-focus.d.ts.map +1 -0
- package/dist/esm/components/embeds/object-focus.js +118 -0
- package/dist/esm/components/embeds/page-gaps.d.ts +67 -0
- package/dist/esm/components/embeds/page-gaps.d.ts.map +1 -0
- package/dist/esm/components/embeds/page-gaps.js +86 -0
- package/dist/esm/components/embeds/slicer-component.d.ts +9 -0
- package/dist/esm/components/embeds/slicer-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/text-box-view.d.ts +18 -0
- package/dist/esm/components/embeds/text-box-view.d.ts.map +1 -0
- package/dist/esm/components/embeds/text-box-view.js +118 -0
- package/dist/esm/components/filter-box/filter-by-color.d.ts.map +1 -1
- package/dist/esm/components/filter-box/filter-by-color.js +9 -2
- package/dist/esm/components/filter-box/index.d.ts.map +1 -1
- package/dist/esm/components/filter-box/index.js +5 -1
- package/dist/esm/components/print-preview/page-block.d.ts +46 -0
- package/dist/esm/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/esm/components/print-preview/page-block.js +122 -4
- package/dist/esm/components/print-preview/print-cells.d.ts +5 -0
- package/dist/esm/components/print-preview/print-cells.d.ts.map +1 -1
- package/dist/esm/components/print-preview/print-cells.js +1 -0
- package/dist/esm/components/print-preview/print-preview-dialog.d.ts +16 -2
- package/dist/esm/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/esm/components/print-preview/print-preview-dialog.js +195 -4
- package/dist/esm/components/print-preview/settings.d.ts +8 -0
- package/dist/esm/components/print-preview/settings.d.ts.map +1 -1
- package/dist/esm/components/print-preview/settings.js +4 -1
- package/dist/esm/components/print-preview/sheet-page-setup.d.ts.map +1 -1
- package/dist/esm/components/print-preview/sheet-page-setup.js +14 -0
- package/dist/esm/components/selection/fill-options-menu.d.ts +8 -1
- package/dist/esm/components/selection/fill-options-menu.d.ts.map +1 -1
- package/dist/esm/components/selection/fill-options-menu.js +5 -3
- package/dist/esm/components/selection/index.d.ts +1 -1
- package/dist/esm/components/selection/index.d.ts.map +1 -1
- package/dist/esm/components/selection/index.js +5 -6
- package/dist/esm/components/selection/types.d.ts +13 -8
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- package/dist/esm/components/sheet-background/index.d.ts +26 -0
- package/dist/esm/components/sheet-background/index.d.ts.map +1 -0
- package/dist/esm/components/sheet-background/index.js +93 -0
- package/dist/esm/components/sort-range-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/sort-range-dialog/index.js +5 -2
- package/dist/esm/hooks/object-clipboard-payload.d.ts +58 -0
- package/dist/esm/hooks/object-clipboard-payload.d.ts.map +1 -0
- package/dist/esm/hooks/object-clipboard-payload.js +404 -0
- package/dist/esm/hooks/object-spec-schema.generated.d.ts +24 -0
- package/dist/esm/hooks/object-spec-schema.generated.d.ts.map +1 -0
- package/dist/esm/hooks/object-spec-schema.generated.js +4764 -0
- package/dist/esm/hooks/use-chart-clipboard.d.ts +55 -9
- package/dist/esm/hooks/use-chart-clipboard.d.ts.map +1 -1
- package/dist/esm/hooks/use-chart-clipboard.js +298 -53
- package/dist/esm/hooks/use-embeds-charts.d.ts +7 -1
- package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-embeds-charts.js +72 -14
- package/dist/esm/hooks/use-grid-children.d.ts +8 -2
- package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/esm/hooks/use-grid-children.js +71 -4
- package/dist/esm/hooks/use-selection-renderer.d.ts +16 -5
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +54 -28
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +58 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
|
@@ -11,12 +11,11 @@ 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";
|
|
14
15
|
import { excelEditValueOfNumber } from "../../api/excel-edit-value";
|
|
15
16
|
import { getErrorCheckKind, isErrorIgnored, runErrorCheckOption, } from "../../api/error-checking";
|
|
16
17
|
import { formulaBarEditorInstanceAtom } from "../../atoms/formula-bar-editor-value.atom";
|
|
17
18
|
import { clearRangeForInsertedBand, formatsForInsertOption, insertedBandHasValues, } from "../../api/insert-options";
|
|
18
|
-
import { keepsCalculatedColumnTag, } from "../../api/calculated-column-fill";
|
|
19
|
-
import { keepsTableAutoExpansionTag, } from "../../api/table-auto-expansion";
|
|
20
19
|
import { isConditionalFormatNumberCell, isDarkCssColor, } from "../../api/cf-overlays";
|
|
21
20
|
import { CF_INITIAL_WINDOW, cfWindowForViewport, isSameCfWindow, } from "../../api/cf-window";
|
|
22
21
|
import { generateSelectionsFromFormula } from "../../api/selections";
|
|
@@ -30,7 +29,9 @@ import { useFormulaModeValue, useIsEvaluateFormulaDialogMounted, useIsGoToDialog
|
|
|
30
29
|
import { useActiveEditor } from "../../atoms/active-editor.atom";
|
|
31
30
|
import { useFlashFillSuggestion, } from "../../hooks/use-flash-fill-suggestion";
|
|
32
31
|
import { useAddWatch, useIsWatchWindowMounted, useSetWatchWindowContext, } from "../../atoms/watch-window.atom";
|
|
33
|
-
import { useEditingCell } from "../../atoms/editing-cell.atom";
|
|
32
|
+
import { editingCellAtom, useEditingCell } from "../../atoms/editing-cell.atom";
|
|
33
|
+
import { selectedChartEmbedAtom } from "../../atoms/selected-chart-embed.atom";
|
|
34
|
+
import { objectFocusTargetsAtom, sheetFocusTargetsAtom, } from "../embeds/object-focus";
|
|
34
35
|
import { useSetEnterKeyDirection } from "../../atoms/enter-key-direction.atom";
|
|
35
36
|
import { useCellEditorInstance, useSetFormulabarEditorValue, useSetFormulaBarTextFormatRuns, } from "../../atoms/formula-bar-editor-value.atom";
|
|
36
37
|
import { useFormulaCanSelectCells, useFormulaSelectionMode, useSetFormulaSelectionState, } from "../../atoms/formula-selection-state.atom";
|
|
@@ -93,7 +94,7 @@ import { useSelectionDragCopy } from "../../hooks/use-selection-drag-copy";
|
|
|
93
94
|
import { SelectionDropMenu } from "../selection-drop-menu";
|
|
94
95
|
import { useSelectionInterceptors } from "../../hooks/use-selection-interceptors";
|
|
95
96
|
import { useSelectionMove } from "../../hooks/use-selection-move";
|
|
96
|
-
import { useSelectionRenderer } from "../../hooks/use-selection-renderer";
|
|
97
|
+
import { AUTOCORRECT_ANCHOR_TYPE, useSelectionRenderer, } from "../../hooks/use-selection-renderer";
|
|
97
98
|
import { useSelectionResize } from "../../hooks/use-selection-resize";
|
|
98
99
|
import { useSheetChangeHandler } from "../../hooks/use-sheet-change-handler";
|
|
99
100
|
import { useSizer } from "../../hooks/use-sizer";
|
|
@@ -106,6 +107,7 @@ import { useTooltip } from "../../hooks/use-tooltip";
|
|
|
106
107
|
import { useTouch } from "../../hooks/use-touch";
|
|
107
108
|
import { multiInstanceStore } from "../../providers/spreadsheet-provider";
|
|
108
109
|
import { scrollSubscriber } from "../../signals/scroll-subscriber";
|
|
110
|
+
import { SheetBackground } from "../sheet-background";
|
|
109
111
|
import { getStringifiedColor } from "../../themes";
|
|
110
112
|
import { fillRangeForSeriesSpec, seedRangeForSeriesSpec, } from "../../api/fill-series";
|
|
111
113
|
import { Cell as DefaultCell } from "../cell";
|
|
@@ -157,7 +159,7 @@ function isDetachedEditor(editor) {
|
|
|
157
159
|
return element != null && !element.isConnected;
|
|
158
160
|
}
|
|
159
161
|
function CanvasGridComponent(props, forwardedRef) {
|
|
160
|
-
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, 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,
|
|
162
|
+
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, backgroundImageUrl, 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, objectClipboard = true, objectClipboardPolicy, 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
163
|
// Host-driven filter props. `hostHiddenRowRanges`
|
|
162
164
|
// supplies compact [start, end] hidden-row tuples; `getFilterValues` supplies a
|
|
163
165
|
// column's distinct values. Both let a million-row filter render without scanning
|
|
@@ -365,6 +367,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
365
367
|
const pageBreakPreview = pageLayout ? undefined : pageBreakPreviewProp;
|
|
366
368
|
const frozenRows = pageLayout ? 1 : (frozenRowCount ?? 0) + 1;
|
|
367
369
|
const frozenColumns = pageLayout ? 1 : (frozenColumnCount ?? 0) + 1;
|
|
370
|
+
/**
|
|
371
|
+
* View ▸ Split. The grid wants pixels from the first body cell; the sheet stores twentieths of a
|
|
372
|
+
* point. Page Layout view draws pages rather than a window, so it never splits.
|
|
373
|
+
*/
|
|
374
|
+
const splitPanePx = useMemo(() => (pageLayout ? undefined : splitPanePixels(splitPane)), [pageLayout, splitPane]);
|
|
375
|
+
/** Moving the bar, or taking the split away, is a change to the sheet. */
|
|
376
|
+
const handleSplitPaneChange = useCallback((next) => {
|
|
377
|
+
onUpdateSheet?.(sheetId, {
|
|
378
|
+
splitPane: next === null ? null : splitPaneFromPixels(next, splitPane),
|
|
379
|
+
});
|
|
380
|
+
}, [onUpdateSheet, sheetId, splitPane]);
|
|
368
381
|
const selectionTopBound = 1;
|
|
369
382
|
const selectionLeftBound = 1;
|
|
370
383
|
const fillHandleSize = 8;
|
|
@@ -851,6 +864,18 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
851
864
|
!gridContainer.contains(activeElement)) {
|
|
852
865
|
return;
|
|
853
866
|
}
|
|
867
|
+
// While an object is selected and no cell is being edited, the keyboard is the object's
|
|
868
|
+
// (Excel): a host or command returning focus to the sheet hands it to the object, so
|
|
869
|
+
// Delete removes the chart instead of clearing the active cell.
|
|
870
|
+
const selectedObject = store.get(selectedChartEmbedAtom);
|
|
871
|
+
if (selectedObject !== undefined && !store.get(editingCellAtom)) {
|
|
872
|
+
const target = store.get(objectFocusTargetsAtom).get(selectedObject);
|
|
873
|
+
if (target?.isConnected && gridContainer?.contains(target)) {
|
|
874
|
+
if (activeElement !== target)
|
|
875
|
+
target.focus({ preventScroll: true });
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
854
879
|
// An editor whose DOM is gone cannot be the one holding focus: a host that unmounted an
|
|
855
880
|
// input without a blur (Chromium fires none for a removed focused element) can leave a
|
|
856
881
|
// stale `activeEditor` behind, and honouring it would lock the grid out of keyboard input
|
|
@@ -860,7 +885,21 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
860
885
|
isDetachedEditor(activeEditor)) {
|
|
861
886
|
cellEditorInstance?.focus();
|
|
862
887
|
}
|
|
863
|
-
}, [activeEditor, cellEditorInstance]);
|
|
888
|
+
}, [activeEditor, cellEditorInstance, store]);
|
|
889
|
+
// The sheet's own keyboard target (its cell editor), for an object selected without a click
|
|
890
|
+
// to tell "focus came back to the sheet" from focus the person moved elsewhere.
|
|
891
|
+
useEffect(() => {
|
|
892
|
+
const container = gridContainerRef.current;
|
|
893
|
+
if (!container)
|
|
894
|
+
return;
|
|
895
|
+
const targets = store.get(sheetFocusTargetsAtom);
|
|
896
|
+
const target = () => cellEditorInstance?.el?.();
|
|
897
|
+
targets.set(container, target);
|
|
898
|
+
return () => {
|
|
899
|
+
if (targets.get(container) === target)
|
|
900
|
+
targets.delete(container);
|
|
901
|
+
};
|
|
902
|
+
}, [store, cellEditorInstance]);
|
|
864
903
|
/**
|
|
865
904
|
* Container and total size of the grid, as the grid measures them
|
|
866
905
|
*/
|
|
@@ -895,6 +934,34 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
895
934
|
* @returns ScrollCoords
|
|
896
935
|
*/
|
|
897
936
|
const getScrollPosition = useCallback(() => gridRef.current?.getScrollPosition() ?? DEFAULT_SCROLL_POSITION, []);
|
|
937
|
+
/** The pane the open editor belongs to; set when the edit starts (`handleBeforeEdit`). */
|
|
938
|
+
const editorPaneIdRef = useRef(undefined);
|
|
939
|
+
/**
|
|
940
|
+
* A pane scrolling on its own does not move the sheet, so nothing else would re-render: this
|
|
941
|
+
* counter is what makes the overlays drawn over the grid read their pane's offsets again.
|
|
942
|
+
*/
|
|
943
|
+
const [paneScrollTick, setPaneScrollTick] = useState(0);
|
|
944
|
+
const handlePaneScroll = useCallback(() => {
|
|
945
|
+
setPaneScrollTick((tick) => tick + 1);
|
|
946
|
+
}, []);
|
|
947
|
+
/**
|
|
948
|
+
* What the cell editor is placed by. A sheet with no split answers exactly what
|
|
949
|
+
* `getScrollPosition` answers; a split sheet answers the editor's own pane, so the editor sits
|
|
950
|
+
* over its cell while that pane scrolls and does not move when the other pane does.
|
|
951
|
+
*/
|
|
952
|
+
const getEditorScrollPosition = useCallback(() => {
|
|
953
|
+
const grid = gridRef.current;
|
|
954
|
+
if (!grid)
|
|
955
|
+
return DEFAULT_SCROLL_POSITION;
|
|
956
|
+
// `getActivePane()` is undefined on a sheet with no split and allocates nothing; asking for
|
|
957
|
+
// the pane list here would build an array every time the editor is placed.
|
|
958
|
+
if (!grid.getActivePane())
|
|
959
|
+
return grid.getScrollPosition();
|
|
960
|
+
return grid.getPaneScrollPosition(editorPaneIdRef.current);
|
|
961
|
+
// The tick is the dependency on purpose: a pane scrolling must give this callback a new
|
|
962
|
+
// identity, so the editor's position is computed again.
|
|
963
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
964
|
+
}, [paneScrollTick]);
|
|
898
965
|
// Does the column contains a table
|
|
899
966
|
const columnContainsTable = useCallback((columnIndex) => {
|
|
900
967
|
const [_, tableColumnHeaderIds] = tableHeaderCells;
|
|
@@ -2444,6 +2511,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2444
2511
|
? release.selections
|
|
2445
2512
|
: [{ range: cellToArea(release.activeCell) }]),
|
|
2446
2513
|
mode: release.button === "right" ? "menu" : "smart-tag",
|
|
2514
|
+
open: release.button === "right",
|
|
2447
2515
|
// Excel offers Flash Fill for a drag along a column (the source rows are the examples).
|
|
2448
2516
|
canFlashFill: !!onFlashFill &&
|
|
2449
2517
|
!!release.selections[0]?.range &&
|
|
@@ -2470,6 +2538,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2470
2538
|
setFillOptions({ ...fillOptions, fillType, mode: "smart-tag" });
|
|
2471
2539
|
focusSheet();
|
|
2472
2540
|
}, [fillOptions, onFill, setFillOptions, focusSheet]);
|
|
2541
|
+
const handleFillOptionsOpenChange = useCallback((open) => setFillOptions((current) => current && current.open !== open ? { ...current, open } : current), [setFillOptions]);
|
|
2473
2542
|
const handleCloseFillOptions = useCallback(() => {
|
|
2474
2543
|
// Only the right-drag menu is "cancel on close"; the smart tag stays.
|
|
2475
2544
|
if (fillOptions?.mode === "menu")
|
|
@@ -2657,16 +2726,9 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2657
2726
|
if (!tableAutoExpansion)
|
|
2658
2727
|
return;
|
|
2659
2728
|
if (option === "undo") {
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
else {
|
|
2664
|
-
const table = tables?.find((candidate) => candidate.id === tableAutoExpansion.tableId &&
|
|
2665
|
-
candidate.sheetId === tableAutoExpansion.sheetId);
|
|
2666
|
-
if (table) {
|
|
2667
|
-
onResizeTable?.(tableAutoExpansion.sheetId, table, tableAutoExpansion.previousRange);
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2729
|
+
// Only offered when the host can undo the growth with what it wrote
|
|
2730
|
+
// (a bare resize would leave the growth's writes in place).
|
|
2731
|
+
onUndoTableAutoExpansion?.(tableAutoExpansion);
|
|
2670
2732
|
}
|
|
2671
2733
|
else {
|
|
2672
2734
|
onChangeAutoExpandTables?.(false);
|
|
@@ -2675,28 +2737,27 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2675
2737
|
focusSheet();
|
|
2676
2738
|
}, [
|
|
2677
2739
|
tableAutoExpansion,
|
|
2678
|
-
tables,
|
|
2679
|
-
onResizeTable,
|
|
2680
2740
|
onUndoTableAutoExpansion,
|
|
2681
2741
|
onChangeAutoExpandTables,
|
|
2682
2742
|
setTableAutoExpansion,
|
|
2683
2743
|
focusSheet,
|
|
2684
2744
|
]);
|
|
2685
|
-
// The tag
|
|
2686
|
-
//
|
|
2745
|
+
// The tag belongs to the cell the growth was written from, not to the cursor:
|
|
2746
|
+
// it stays while the selection moves, and goes when the sheet changes or that
|
|
2747
|
+
// cell is no longer part of the table. The engine drops it on the next edit
|
|
2748
|
+
// (and every undo / redo).
|
|
2687
2749
|
useEffect(() => {
|
|
2688
|
-
|
|
2689
|
-
|
|
2750
|
+
setTableAutoExpansion((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2751
|
+
}, [sheetId, setTableAutoExpansion]);
|
|
2752
|
+
useEffect(() => {
|
|
2753
|
+
if (!tableAutoExpansion || !tables)
|
|
2754
|
+
return;
|
|
2755
|
+
const table = tables.find((candidate) => candidate.id === tableAutoExpansion.tableId &&
|
|
2756
|
+
candidate.sheetId === tableAutoExpansion.sheetId);
|
|
2757
|
+
if (!table || !isCellWithinBounds(tableAutoExpansion.anchor, table.range)) {
|
|
2690
2758
|
setTableAutoExpansion(null);
|
|
2691
2759
|
}
|
|
2692
|
-
}, [
|
|
2693
|
-
tableAutoExpansion,
|
|
2694
|
-
activeCell.rowIndex,
|
|
2695
|
-
activeCell.columnIndex,
|
|
2696
|
-
activeCell,
|
|
2697
|
-
sheetId,
|
|
2698
|
-
setTableAutoExpansion,
|
|
2699
|
-
]);
|
|
2760
|
+
}, [tableAutoExpansion, tables, setTableAutoExpansion]);
|
|
2700
2761
|
/**
|
|
2701
2762
|
* Excel's AutoCorrect smart tag after a formula typed into a table column.
|
|
2702
2763
|
* "Undo Calculated Column" reverts the fill alone (the typed cell keeps its
|
|
@@ -2726,21 +2787,24 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2726
2787
|
setCalculatedColumnFill,
|
|
2727
2788
|
focusSheet,
|
|
2728
2789
|
]);
|
|
2729
|
-
// The tag
|
|
2730
|
-
//
|
|
2790
|
+
// The tag belongs to the cell the formula was typed into, not to the cursor:
|
|
2791
|
+
// it stays while the selection moves, and goes when the sheet changes or that
|
|
2792
|
+
// cell is no longer in the table's column. The engine drops it on the next
|
|
2793
|
+
// edit (and every undo / redo).
|
|
2794
|
+
useEffect(() => {
|
|
2795
|
+
setCalculatedColumnFill((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2796
|
+
}, [sheetId, setCalculatedColumnFill]);
|
|
2731
2797
|
useEffect(() => {
|
|
2732
|
-
if (calculatedColumnFill
|
|
2733
|
-
|
|
2798
|
+
if (!calculatedColumnFill || !tables)
|
|
2799
|
+
return;
|
|
2800
|
+
const table = tables.find((candidate) => candidate.id === calculatedColumnFill.tableId &&
|
|
2801
|
+
candidate.sheetId === calculatedColumnFill.sheetId);
|
|
2802
|
+
if (!table ||
|
|
2803
|
+
!isCellWithinBounds(calculatedColumnFill.anchor, table.range) ||
|
|
2804
|
+
calculatedColumnFill.anchor.columnIndex !== calculatedColumnFill.columnIndex) {
|
|
2734
2805
|
setCalculatedColumnFill(null);
|
|
2735
2806
|
}
|
|
2736
|
-
}, [
|
|
2737
|
-
calculatedColumnFill,
|
|
2738
|
-
activeCell.rowIndex,
|
|
2739
|
-
activeCell.columnIndex,
|
|
2740
|
-
activeCell,
|
|
2741
|
-
sheetId,
|
|
2742
|
-
setCalculatedColumnFill,
|
|
2743
|
-
]);
|
|
2807
|
+
}, [calculatedColumnFill, tables, setCalculatedColumnFill]);
|
|
2744
2808
|
/**
|
|
2745
2809
|
* Run Excel's Series dialog result: the target range's first row (Series
|
|
2746
2810
|
* in Columns) / first column (Rows) is the seed line; `stop` may shrink or
|
|
@@ -2932,6 +2996,20 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2932
2996
|
* the target of those events (see `EmbedDraggable`); a paste that lands in the
|
|
2933
2997
|
* cell editor while a chart is on the clipboard is claimed here first.
|
|
2934
2998
|
*/
|
|
2999
|
+
// An object's size in cells is read the way print and Page Layout read it: a hidden row or
|
|
3000
|
+
// column has no size.
|
|
3001
|
+
const getAnchorColumnWidth = useCallback((columnIndex) => {
|
|
3002
|
+
const meta = columnMetadata?.[columnIndex];
|
|
3003
|
+
return meta?.hiddenByUser || meta?.hiddenByFilter || meta?.hiddenByGroup
|
|
3004
|
+
? 0
|
|
3005
|
+
: meta?.size ?? defaultColumnWidth;
|
|
3006
|
+
}, [columnMetadata, defaultColumnWidth]);
|
|
3007
|
+
const getAnchorRowHeight = useCallback((rowIndex) => {
|
|
3008
|
+
const meta = rowMetadata?.[rowIndex];
|
|
3009
|
+
return meta?.hiddenByUser || meta?.hiddenByFilter || meta?.hiddenByGroup
|
|
3010
|
+
? 0
|
|
3011
|
+
: meta?.size ?? defaultRowHeight;
|
|
3012
|
+
}, [rowMetadata, defaultRowHeight]);
|
|
2935
3013
|
const chartClipboard = useChartClipboard({
|
|
2936
3014
|
sheetId,
|
|
2937
3015
|
activeCell,
|
|
@@ -2941,7 +3019,16 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2941
3019
|
onDeleteChart,
|
|
2942
3020
|
onCopyChart,
|
|
2943
3021
|
onCutChart,
|
|
3022
|
+
embeds,
|
|
3023
|
+
onCreateEmbed,
|
|
3024
|
+
onDeleteEmbed,
|
|
2944
3025
|
focusSheet,
|
|
3026
|
+
rowCount: Math.min(MAX_ROW_COUNT, rowCount),
|
|
3027
|
+
columnCount: Math.min(MAX_COLUMN_COUNT, columnCount),
|
|
3028
|
+
getColumnWidth: getAnchorColumnWidth,
|
|
3029
|
+
getRowHeight: getAnchorRowHeight,
|
|
3030
|
+
objectClipboardPolicy,
|
|
3031
|
+
sheetExists: getSheetName ? (id) => Boolean(getSheetName(id)) : undefined,
|
|
2945
3032
|
});
|
|
2946
3033
|
const { copyChart, cutChart, pasteChart, duplicateChart, clearChartClipboard, } = chartClipboard;
|
|
2947
3034
|
const handleEditorCopy = useCallback((e) => {
|
|
@@ -2953,11 +3040,11 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2953
3040
|
onInternalCut(e);
|
|
2954
3041
|
}, [clearChartClipboard, onInternalCut]);
|
|
2955
3042
|
const handleEditorPaste = useCallback((e) => {
|
|
2956
|
-
if (pasteChart(e)) {
|
|
3043
|
+
if (objectClipboard && pasteChart(e)) {
|
|
2957
3044
|
return;
|
|
2958
3045
|
}
|
|
2959
3046
|
onInternalPaste(e);
|
|
2960
|
-
}, [pasteChart, onInternalPaste]);
|
|
3047
|
+
}, [objectClipboard, pasteChart, onInternalPaste]);
|
|
2961
3048
|
/**
|
|
2962
3049
|
* Context menu "Insert Cut Cells" (Excel: Ctrl+X, right-click the destination). A cut of
|
|
2963
3050
|
* whole rows / columns dropped on a row / column header inserts them BEFORE the clicked
|
|
@@ -3207,6 +3294,10 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3207
3294
|
* Use before edit to store editing cell reference
|
|
3208
3295
|
*/
|
|
3209
3296
|
const handleBeforeEdit = useCallback((sheetId, cell) => {
|
|
3297
|
+
// Excel's View ▸ Split: the editor opens in the pane that was clicked — the pane the grid
|
|
3298
|
+
// is working in — and stays there while that pane scrolls, even when the same cell is
|
|
3299
|
+
// visible in the other one too. A keyboard edit opens in that same pane.
|
|
3300
|
+
editorPaneIdRef.current = gridRef.current?.getActivePane()?.id;
|
|
3210
3301
|
setEditingCellCoordinate({
|
|
3211
3302
|
...cell,
|
|
3212
3303
|
sheetId,
|
|
@@ -3452,6 +3543,44 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3452
3543
|
* Shortcut handlers for formatting
|
|
3453
3544
|
* TODO: Decide on the output
|
|
3454
3545
|
*/
|
|
3546
|
+
/**
|
|
3547
|
+
* The Auto Fill Options button belongs to the fill it offers to redo: Escape dismisses it, and
|
|
3548
|
+
* an undo or redo from the keyboard takes it away, so a choice can never re-apply an undone fill.
|
|
3549
|
+
*/
|
|
3550
|
+
const clearCopiedSelectionsAndFillOptions = useCallback(() => {
|
|
3551
|
+
setFillOptions(null);
|
|
3552
|
+
clearCopiedSelections();
|
|
3553
|
+
}, [setFillOptions, clearCopiedSelections]);
|
|
3554
|
+
/**
|
|
3555
|
+
* Every smart tag offers to redo or adjust the edit it belongs to (Insert Options, AutoCorrect
|
|
3556
|
+
* Options, Flash Fill Options, the calculated-column tag, Auto Fill Options): an undo or redo
|
|
3557
|
+
* takes them all away, so a choice can never act on an edit that was undone.
|
|
3558
|
+
*/
|
|
3559
|
+
const dropSmartTags = useCallback(() => {
|
|
3560
|
+
setFillOptions(null);
|
|
3561
|
+
setInsertOptions(null);
|
|
3562
|
+
setTableAutoExpansion(null);
|
|
3563
|
+
setCalculatedColumnFill(null);
|
|
3564
|
+
setFlashFillOptions(null);
|
|
3565
|
+
}, [
|
|
3566
|
+
setFillOptions,
|
|
3567
|
+
setInsertOptions,
|
|
3568
|
+
setTableAutoExpansion,
|
|
3569
|
+
setCalculatedColumnFill,
|
|
3570
|
+
setFlashFillOptions,
|
|
3571
|
+
]);
|
|
3572
|
+
const undoDroppingFillOptions = useMemo(() => onUndo
|
|
3573
|
+
? () => {
|
|
3574
|
+
dropSmartTags();
|
|
3575
|
+
onUndo();
|
|
3576
|
+
}
|
|
3577
|
+
: undefined, [onUndo, dropSmartTags]);
|
|
3578
|
+
const redoDroppingFillOptions = useMemo(() => onRedo
|
|
3579
|
+
? () => {
|
|
3580
|
+
dropSmartTags();
|
|
3581
|
+
onRedo();
|
|
3582
|
+
}
|
|
3583
|
+
: undefined, [onRedo, dropSmartTags]);
|
|
3455
3584
|
const onKeyDownFormatting = useKeyboardHandler({
|
|
3456
3585
|
sheetId,
|
|
3457
3586
|
locale,
|
|
@@ -3488,12 +3617,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3488
3617
|
onInsertTime,
|
|
3489
3618
|
onInsertDate,
|
|
3490
3619
|
onInsertDateTime,
|
|
3491
|
-
onUndo,
|
|
3492
|
-
onRedo,
|
|
3620
|
+
onUndo: undoDroppingFillOptions,
|
|
3621
|
+
onRedo: redoDroppingFillOptions,
|
|
3493
3622
|
onCreateTable,
|
|
3494
3623
|
onRequestCreateTable,
|
|
3495
3624
|
onCreateBasicFilter,
|
|
3496
|
-
clearCopiedSelections,
|
|
3625
|
+
clearCopiedSelections: clearCopiedSelectionsAndFillOptions,
|
|
3497
3626
|
onRequestSearch,
|
|
3498
3627
|
onRequestReplace,
|
|
3499
3628
|
onRequestFormatCells,
|
|
@@ -3542,7 +3671,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3542
3671
|
canEdit: canEditCell,
|
|
3543
3672
|
canView: canViewCell,
|
|
3544
3673
|
sticky: stickyEditor,
|
|
3545
|
-
getScrollPosition,
|
|
3674
|
+
getScrollPosition: getEditorScrollPosition,
|
|
3546
3675
|
hideOnBlur: formulaMode && canSelectCells ? false : true,
|
|
3547
3676
|
isHiddenRow,
|
|
3548
3677
|
isHiddenColumn,
|
|
@@ -3601,6 +3730,16 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3601
3730
|
* number in ONE undo step; Ignore Error records the selection in the sheet's `ignoredErrors`
|
|
3602
3731
|
* (xlsx `<ignoredErrors>`), so the flag stays off after a save and reopen.
|
|
3603
3732
|
*/
|
|
3733
|
+
/**
|
|
3734
|
+
* The editor's pane is remembered only while the edit lasts. Commit, cancel, a blur or the
|
|
3735
|
+
* grid going away all end it, and the next thing opened over the sheet — a comment popover,
|
|
3736
|
+
* the cell-expand box — belongs to the pane it is opened in, not to the pane last edited in.
|
|
3737
|
+
*/
|
|
3738
|
+
useEffect(() => {
|
|
3739
|
+
if (!isEditInProgress) {
|
|
3740
|
+
editorPaneIdRef.current = undefined;
|
|
3741
|
+
}
|
|
3742
|
+
}, [isEditInProgress]);
|
|
3604
3743
|
const formulaBarEditor = useAtomValue(formulaBarEditorInstanceAtom);
|
|
3605
3744
|
const activeErrorCheck = !readonly
|
|
3606
3745
|
? getErrorCheck(sheetId, activeCell.rowIndex, activeCell.columnIndex)
|
|
@@ -3726,8 +3865,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3726
3865
|
const onRequestCloseTooltip = useCallback(() => {
|
|
3727
3866
|
setHoveredCell(undefined);
|
|
3728
3867
|
}, []);
|
|
3868
|
+
// Page Layout ▸ Background: this grid's own layer, moved from this grid's
|
|
3869
|
+
// scroll (never the page-wide subject). A no-op while the sheet has none.
|
|
3870
|
+
const sheetBackgroundRef = useRef(null);
|
|
3729
3871
|
// Scroll subscriber
|
|
3730
3872
|
const handleScroll = useCallback((scrollPosition) => {
|
|
3873
|
+
sheetBackgroundRef.current?.setScrollPosition(scrollPosition);
|
|
3731
3874
|
// Pass it to rxjs subscriber
|
|
3732
3875
|
if (!isEditInProgress) {
|
|
3733
3876
|
scrollSubscriber.next(scrollPosition);
|
|
@@ -3839,6 +3982,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3839
3982
|
getCellData,
|
|
3840
3983
|
]);
|
|
3841
3984
|
const { chartComponents, embedComponents, slicerComponents, contextMenuComponent: embedContextMenuComponent, onMouseDown: onMouseDownCharts, requestChartContextMenu, selectAllObjects: selectAllObjectsUnstable, } = useEmbedsCharts({
|
|
3985
|
+
pageLayout,
|
|
3842
3986
|
getLinkedPictureSource,
|
|
3843
3987
|
getSheetName,
|
|
3844
3988
|
charts,
|
|
@@ -3858,7 +4002,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3858
4002
|
selectedColor: chartSelectedColor,
|
|
3859
4003
|
onMoveChart,
|
|
3860
4004
|
onResizeChart,
|
|
3861
|
-
chartClipboard,
|
|
4005
|
+
chartClipboard: objectClipboard ? chartClipboard : undefined,
|
|
3862
4006
|
onMoveEmbed,
|
|
3863
4007
|
onResizeEmbed,
|
|
3864
4008
|
onDeleteEmbed,
|
|
@@ -4533,15 +4677,19 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4533
4677
|
onChooseFillType: handleChooseFillType,
|
|
4534
4678
|
onOpenFillSeriesDialog: handleOpenFillSeriesDialog,
|
|
4535
4679
|
onCloseFillOptions: handleCloseFillOptions,
|
|
4680
|
+
onFillOptionsOpenChange: handleFillOptionsOpenChange,
|
|
4536
4681
|
insertOptions,
|
|
4537
4682
|
onChooseInsertOption: handleChooseInsertOption,
|
|
4538
4683
|
tableAutoExpansion,
|
|
4539
4684
|
canStopAutoExpandingTables: !!onChangeAutoExpandTables,
|
|
4685
|
+
canUndoTableAutoExpansion: !!onUndoTableAutoExpansion,
|
|
4540
4686
|
onChooseTableAutoExpansionOption: handleChooseTableAutoExpansionOption,
|
|
4541
4687
|
flashFillOptions,
|
|
4542
4688
|
onChooseFlashFillOption: handleChooseFlashFillOption,
|
|
4543
4689
|
calculatedColumnFill,
|
|
4544
4690
|
canStopAutoCalculatedColumns: !!onChangeAutoCalculatedColumns,
|
|
4691
|
+
canUndoCalculatedColumn: !!onUndoCalculatedColumn,
|
|
4692
|
+
canOverwriteCalculatedColumn: !!onOverwriteCalculatedColumn,
|
|
4545
4693
|
onChooseCalculatedColumnOption: handleChooseCalculatedColumnOption,
|
|
4546
4694
|
errorCheck: activeErrorCheckTag,
|
|
4547
4695
|
errorCheckMenuOpen,
|
|
@@ -4588,13 +4736,50 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4588
4736
|
const pageBreakBorderStyles = useMemo(() => pageBreakPreview
|
|
4589
4737
|
? getPageBreakPreviewStyles(pageBreakPreview, rowCount, columnCount)
|
|
4590
4738
|
: getPageBreakBorderStyles(pageLayout ? undefined : pageBreaks, rowCount, columnCount), [pageBreakPreview, pageBreaks, pageLayout, rowCount, columnCount]);
|
|
4591
|
-
|
|
4739
|
+
/**
|
|
4740
|
+
* A pending AutoCorrect Options tag is drawn beside the cell its edit was made in: an invisible
|
|
4741
|
+
* border style on that cell carries it (one, with both kinds, when a single edit grew a table
|
|
4742
|
+
* and filled a calculated column from the same cell).
|
|
4743
|
+
*/
|
|
4744
|
+
const autoCorrectAnchorStyles = useMemo(() => {
|
|
4745
|
+
const anchorOf = (request) => request && request.sheetId === sheetId ? request.anchor : undefined;
|
|
4746
|
+
const tableAnchor = anchorOf(tableAutoExpansion);
|
|
4747
|
+
const columnAnchor = anchorOf(calculatedColumnFill);
|
|
4748
|
+
const styleAt = (cell, kinds) => ({
|
|
4749
|
+
range: {
|
|
4750
|
+
startRowIndex: cell.rowIndex,
|
|
4751
|
+
endRowIndex: cell.rowIndex,
|
|
4752
|
+
startColumnIndex: cell.columnIndex,
|
|
4753
|
+
endColumnIndex: cell.columnIndex,
|
|
4754
|
+
},
|
|
4755
|
+
type: AUTOCORRECT_ANCHOR_TYPE,
|
|
4756
|
+
index: `${AUTOCORRECT_ANCHOR_TYPE}:${kinds.join("+")}`,
|
|
4757
|
+
style: { stroke: "transparent", strokeWidth: 0 },
|
|
4758
|
+
metadata: { autoCorrect: kinds },
|
|
4759
|
+
});
|
|
4760
|
+
if (tableAnchor && columnAnchor && isEqualCells(tableAnchor, columnAnchor)) {
|
|
4761
|
+
return [styleAt(tableAnchor, ["table", "calculated"])];
|
|
4762
|
+
}
|
|
4763
|
+
return [
|
|
4764
|
+
...(tableAnchor ? [styleAt(tableAnchor, ["table"])] : []),
|
|
4765
|
+
...(columnAnchor ? [styleAt(columnAnchor, ["calculated"])] : []),
|
|
4766
|
+
];
|
|
4767
|
+
}, [tableAutoExpansion, calculatedColumnFill, sheetId]);
|
|
4768
|
+
const gridBorderStyles = useMemo(() => chartSourceBorderStyles.length ||
|
|
4769
|
+
pageBreakBorderStyles.length ||
|
|
4770
|
+
autoCorrectAnchorStyles.length
|
|
4592
4771
|
? [
|
|
4593
4772
|
...pageBreakBorderStyles,
|
|
4594
4773
|
...finalBorderStyles,
|
|
4595
4774
|
...chartSourceBorderStyles,
|
|
4775
|
+
...autoCorrectAnchorStyles,
|
|
4596
4776
|
]
|
|
4597
|
-
: finalBorderStyles, [
|
|
4777
|
+
: finalBorderStyles, [
|
|
4778
|
+
finalBorderStyles,
|
|
4779
|
+
chartSourceBorderStyles,
|
|
4780
|
+
pageBreakBorderStyles,
|
|
4781
|
+
autoCorrectAnchorStyles,
|
|
4782
|
+
]);
|
|
4598
4783
|
// Hidden column markers
|
|
4599
4784
|
const [hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers,] = useHiddenDimensionMarkers({
|
|
4600
4785
|
sheetId,
|
|
@@ -4970,6 +5155,10 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4970
5155
|
popoverRange,
|
|
4971
5156
|
cellExpandComponent,
|
|
4972
5157
|
arrowComponents,
|
|
5158
|
+
// ONE notion of the editor's pane: the pane recorded when the edit started, which is what
|
|
5159
|
+
// the editor is positioned by. Without it the DOM would be placed by the pane last pointed
|
|
5160
|
+
// at, and the two can disagree (the independent review's finding 6).
|
|
5161
|
+
editorPaneId: editorPaneIdRef.current,
|
|
4973
5162
|
});
|
|
4974
5163
|
const sheetNameForLayout = pageLayout ? getSheetName?.(sheetId) ?? "" : "";
|
|
4975
5164
|
const handleChangeHeaderFooter = useCallback((headerFooter) => onChangeHeaderFooter?.(sheetId, headerFooter), [onChangeHeaderFooter, sheetId]);
|
|
@@ -5057,10 +5246,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
5057
5246
|
: tableHitCursor
|
|
5058
5247
|
? { ...rest.style, cursor: tableHitCursor }
|
|
5059
5248
|
: rest.style },
|
|
5249
|
+
React.createElement(SheetBackground, { ref: sheetBackgroundRef, imageUrl: backgroundImageUrl, getScrollPosition: getScrollPosition, headerWidth: showHeaders ? rowHeaderWidth : 0, headerHeight: showHeaders ? columnHeaderHeight : 0, scale: scale, rightToLeft: rightToLeft }),
|
|
5060
5250
|
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" },
|
|
5061
5251
|
React.createElement("div", { className: "space-y-2" },
|
|
5062
5252
|
React.createElement(Skeleton, { className: "h-4 w-[250px]" }),
|
|
5063
|
-
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,
|
|
5253
|
+
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,
|
|
5254
|
+
// Freeze Panes and Split are mutually exclusive: the grid is told the SHEET's frozen
|
|
5255
|
+
// counts, not the heading band added above.
|
|
5256
|
+
sheetFrozenRows: frozenRowCount ?? 0, sheetFrozenColumns: frozenColumnCount ?? 0, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle,
|
|
5257
|
+
// The smart tags anchored to the active cell's corners (Flash Fill
|
|
5258
|
+
// Options, Insert Options on a lone active cell) need its copies per pane.
|
|
5259
|
+
activeCellCorners: Boolean(flashFillOptions || (insertOptions && !selections?.length)), 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,
|
|
5064
5260
|
// Dimension of fill handle
|
|
5065
5261
|
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 })),
|
|
5066
5262
|
React.createElement(RtlMirrorLayer, { rightToLeft: rightToLeft }, tooltipComponent),
|
|
@@ -13,13 +13,14 @@ import type { TableAutoExpansion } from "../../api/table-auto-expansion";
|
|
|
13
13
|
import type { ContextMenuWrapperProps } from "../../hooks/use-context-menu";
|
|
14
14
|
import type { PasteSpecialOptions, PasteSpecialRequest } from "../../hooks/use-copy-paste-cut";
|
|
15
15
|
import type { MakeEditableOptions } from "../../hooks/use-editable";
|
|
16
|
+
import type { ObjectClipboardPolicy } from "../../hooks/object-clipboard-payload";
|
|
16
17
|
import type { EnterKeyDirection } from "../cell-editor/helpers";
|
|
17
18
|
import type { ExportRangeOutput } from "../../hooks/use-export-range";
|
|
18
19
|
import type { useFlash } from "../../hooks/use-flash";
|
|
19
20
|
import type { useNavigateToSheetRange } from "../../hooks/use-navigate-sheet-range";
|
|
20
21
|
import type { UseSelectionOptions } from "../../hooks/use-selection";
|
|
21
22
|
import type { GetCellDimensionsOptions as SizerGetCellDimensionsOptions, useSizer } from "../../hooks/use-sizer";
|
|
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, SplitTextOptions, SubtotalOptions, SubtotalResult, TableTheme, TableView } from "../../types";
|
|
23
|
+
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";
|
|
23
24
|
import type { AutoFillType, AXIS, CellData, ConditionalFormatRule, EmbeddedChart, FillOptions, FilterView, OverlayToAnchor, SheetType, PrintHeaderFooter, SheetPrintSettings } from "../../types";
|
|
24
25
|
import type { SheetObject, ZOrderChange } from "../../utils/z-order";
|
|
25
26
|
import type { CellProps } from "../cell/typings";
|
|
@@ -418,12 +419,27 @@ export type CanvasGridProps<T extends CellData = CellData<any, any>> = {
|
|
|
418
419
|
* Show grid lines
|
|
419
420
|
*/
|
|
420
421
|
showGridLines?: Maybe<boolean>;
|
|
422
|
+
/**
|
|
423
|
+
* Page Layout ▸ Background — the picture tiled behind this sheet's cells
|
|
424
|
+
* (`Sheet.backgroundImageUrl`, a `data:` URL on an imported workbook). It
|
|
425
|
+
* repeats from the sheet's origin, scrolls with the cells and never covers
|
|
426
|
+
* the headings; Excel does not print it, so the print preview ignores it.
|
|
427
|
+
* Omitted / empty = no background.
|
|
428
|
+
*/
|
|
429
|
+
backgroundImageUrl?: Maybe<string>;
|
|
421
430
|
/**
|
|
422
431
|
* The sheet's "Show a zero in cells that have zero value" setting
|
|
423
432
|
* (`<sheetView showZeros="0"/>`). `false` paints numeric zeros blank on
|
|
424
433
|
* this sheet; the value itself is untouched.
|
|
425
434
|
*/
|
|
426
435
|
showZeros?: Maybe<boolean>;
|
|
436
|
+
/**
|
|
437
|
+
* View ▸ Split: the sheet's stored split window (`<pane state="split">`). The body is drawn as
|
|
438
|
+
* panes that scroll on their own, and moving or removing the bar is reported through
|
|
439
|
+
* `onUpdateSheet(sheetId, { splitPane })`. Freeze Panes and Split are mutually exclusive, so a
|
|
440
|
+
* sheet with frozen rows or columns ignores this.
|
|
441
|
+
*/
|
|
442
|
+
splitPane?: Maybe<SplitPane>;
|
|
427
443
|
/**
|
|
428
444
|
* Excel's "Enable fill handle and cell drag-and-drop" (Preferences ▸ Edit). `false` hides the
|
|
429
445
|
* fill handle and makes the selection border undraggable (no drag move / copy / insert).
|
|
@@ -1312,6 +1328,22 @@ export type CanvasGridProps<T extends CellData = CellData<any, any>> = {
|
|
|
1312
1328
|
*/
|
|
1313
1329
|
onCutChart?(chartId: string | number): void;
|
|
1314
1330
|
onCopyChart?(chartId: string | number): void;
|
|
1331
|
+
/**
|
|
1332
|
+
* The grid's object clipboard: Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D (and the right-click menu's
|
|
1333
|
+
* Cut / Copy / Paste) on a selected chart, picture, shape, text box or form control. Default
|
|
1334
|
+
* `true`. `false` turns it off entirely, for a host that routes those keys itself: the grid then
|
|
1335
|
+
* neither handles nor prevents those events on an object, a cell paste never builds an object,
|
|
1336
|
+
* and the object menus offer no Cut / Copy / Paste. The `SpreadsheetApi` methods (`copyChart`,
|
|
1337
|
+
* `pasteChart`, …) still work when called.
|
|
1338
|
+
*/
|
|
1339
|
+
objectClipboard?: boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* What a paste may build from an object copied in another tab: which `https:` URLs a picture or
|
|
1342
|
+
* a text link may keep (`isUrlAllowed`; default none: only `data:image/…` pictures and this
|
|
1343
|
+
* page's `blob:` URLs) and whether a host-defined embed kind such as `asset` may be pasted or
|
|
1344
|
+
* duplicated (`acceptHostEmbed`, which returns the object to create; default never).
|
|
1345
|
+
*/
|
|
1346
|
+
objectClipboardPolicy?: Omit<ObjectClipboardPolicy, "origin">;
|
|
1315
1347
|
/**
|
|
1316
1348
|
* Fired when user moves a chart
|
|
1317
1349
|
* @param anchorCell
|