@rowsncolumns/spreadsheet 10.11.0 → 10.14.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 +1 -0
- package/dist/cjs/api/split-pane.d.ts.map +1 -1
- package/dist/cjs/api/split-pane.js +5 -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 +388 -123
- package/dist/cjs/components/canvas-grid/typings.d.ts +45 -0
- 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 +336 -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/pane-copy.d.ts +35 -0
- package/dist/cjs/components/embeds/pane-copy.d.ts.map +1 -0
- package/dist/cjs/components/embeds/pane-copy.js +29 -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 +4779 -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 +12 -1
- package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-embeds-charts.js +86 -17
- package/dist/cjs/hooks/use-grid-children.d.ts +4 -2
- package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/cjs/hooks/use-grid-children.js +74 -16
- 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/hooks/use-shown-notes.d.ts +11 -1
- package/dist/cjs/hooks/use-shown-notes.d.ts.map +1 -1
- package/dist/cjs/hooks/use-shown-notes.js +34 -12
- 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 +64 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/split-pane.d.ts +1 -0
- package/dist/esm/api/split-pane.d.ts.map +1 -1
- package/dist/esm/api/split-pane.js +5 -1
- 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 +307 -59
- package/dist/esm/components/canvas-grid/typings.d.ts +45 -0
- 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 +327 -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/pane-copy.d.ts +35 -0
- package/dist/esm/components/embeds/pane-copy.d.ts.map +1 -0
- package/dist/esm/components/embeds/pane-copy.js +22 -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 +4776 -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 +12 -1
- package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-embeds-charts.js +83 -16
- package/dist/esm/hooks/use-grid-children.d.ts +4 -2
- package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/esm/hooks/use-grid-children.js +59 -16
- 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/hooks/use-shown-notes.d.ts +11 -1
- package/dist/esm/hooks/use-shown-notes.d.ts.map +1 -1
- package/dist/esm/hooks/use-shown-notes.js +23 -12
- 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 +64 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
|
@@ -16,8 +16,6 @@ import { excelEditValueOfNumber } from "../../api/excel-edit-value";
|
|
|
16
16
|
import { getErrorCheckKind, isErrorIgnored, runErrorCheckOption, } from "../../api/error-checking";
|
|
17
17
|
import { formulaBarEditorInstanceAtom } from "../../atoms/formula-bar-editor-value.atom";
|
|
18
18
|
import { clearRangeForInsertedBand, formatsForInsertOption, insertedBandHasValues, } from "../../api/insert-options";
|
|
19
|
-
import { keepsCalculatedColumnTag, } from "../../api/calculated-column-fill";
|
|
20
|
-
import { keepsTableAutoExpansionTag, } from "../../api/table-auto-expansion";
|
|
21
19
|
import { isConditionalFormatNumberCell, isDarkCssColor, } from "../../api/cf-overlays";
|
|
22
20
|
import { CF_INITIAL_WINDOW, cfWindowForViewport, isSameCfWindow, } from "../../api/cf-window";
|
|
23
21
|
import { generateSelectionsFromFormula } from "../../api/selections";
|
|
@@ -31,7 +29,9 @@ import { useFormulaModeValue, useIsEvaluateFormulaDialogMounted, useIsGoToDialog
|
|
|
31
29
|
import { useActiveEditor } from "../../atoms/active-editor.atom";
|
|
32
30
|
import { useFlashFillSuggestion, } from "../../hooks/use-flash-fill-suggestion";
|
|
33
31
|
import { useAddWatch, useIsWatchWindowMounted, useSetWatchWindowContext, } from "../../atoms/watch-window.atom";
|
|
34
|
-
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";
|
|
35
35
|
import { useSetEnterKeyDirection } from "../../atoms/enter-key-direction.atom";
|
|
36
36
|
import { useCellEditorInstance, useSetFormulabarEditorValue, useSetFormulaBarTextFormatRuns, } from "../../atoms/formula-bar-editor-value.atom";
|
|
37
37
|
import { useFormulaCanSelectCells, useFormulaSelectionMode, useSetFormulaSelectionState, } from "../../atoms/formula-selection-state.atom";
|
|
@@ -94,7 +94,7 @@ import { useSelectionDragCopy } from "../../hooks/use-selection-drag-copy";
|
|
|
94
94
|
import { SelectionDropMenu } from "../selection-drop-menu";
|
|
95
95
|
import { useSelectionInterceptors } from "../../hooks/use-selection-interceptors";
|
|
96
96
|
import { useSelectionMove } from "../../hooks/use-selection-move";
|
|
97
|
-
import { useSelectionRenderer } from "../../hooks/use-selection-renderer";
|
|
97
|
+
import { AUTOCORRECT_ANCHOR_TYPE, useSelectionRenderer, } from "../../hooks/use-selection-renderer";
|
|
98
98
|
import { useSelectionResize } from "../../hooks/use-selection-resize";
|
|
99
99
|
import { useSheetChangeHandler } from "../../hooks/use-sheet-change-handler";
|
|
100
100
|
import { useSizer } from "../../hooks/use-sizer";
|
|
@@ -107,6 +107,7 @@ import { useTooltip } from "../../hooks/use-tooltip";
|
|
|
107
107
|
import { useTouch } from "../../hooks/use-touch";
|
|
108
108
|
import { multiInstanceStore } from "../../providers/spreadsheet-provider";
|
|
109
109
|
import { scrollSubscriber } from "../../signals/scroll-subscriber";
|
|
110
|
+
import { SheetBackground } from "../sheet-background";
|
|
110
111
|
import { getStringifiedColor } from "../../themes";
|
|
111
112
|
import { fillRangeForSeriesSpec, seedRangeForSeriesSpec, } from "../../api/fill-series";
|
|
112
113
|
import { Cell as DefaultCell } from "../cell";
|
|
@@ -158,7 +159,7 @@ function isDetachedEditor(editor) {
|
|
|
158
159
|
return element != null && !element.isConnected;
|
|
159
160
|
}
|
|
160
161
|
function CanvasGridComponent(props, forwardedRef) {
|
|
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,
|
|
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, staleCells, 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, onPaneScroll, 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,
|
|
162
163
|
// Host-driven filter props. `hostHiddenRowRanges`
|
|
163
164
|
// supplies compact [start, end] hidden-row tuples; `getFilterValues` supplies a
|
|
164
165
|
// column's distinct values. Both let a million-row filter render without scanning
|
|
@@ -823,6 +824,8 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
823
824
|
* @returns
|
|
824
825
|
*/
|
|
825
826
|
const getCellCoordsFromOffset = useCallback((x, y, includeFrozen) => gridRef.current?.getCellCoordsFromOffset(x, y, includeFrozen), [scale]);
|
|
827
|
+
/** The cell at a point in sheet coordinates, whatever is scrolled (`GridRef`). */
|
|
828
|
+
const getCellCoordsFromSheetOffset = useCallback((x, y) => gridRef.current?.getCellCoordsFromSheetOffset(x, y), [scale]);
|
|
826
829
|
/**
|
|
827
830
|
* Get cells coords
|
|
828
831
|
* caters to merged cells
|
|
@@ -863,6 +866,18 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
863
866
|
!gridContainer.contains(activeElement)) {
|
|
864
867
|
return;
|
|
865
868
|
}
|
|
869
|
+
// While an object is selected and no cell is being edited, the keyboard is the object's
|
|
870
|
+
// (Excel): a host or command returning focus to the sheet hands it to the object, so
|
|
871
|
+
// Delete removes the chart instead of clearing the active cell.
|
|
872
|
+
const selectedObject = store.get(selectedChartEmbedAtom);
|
|
873
|
+
if (selectedObject !== undefined && !store.get(editingCellAtom)) {
|
|
874
|
+
const target = store.get(objectFocusTargetsAtom).get(selectedObject);
|
|
875
|
+
if (target?.isConnected && gridContainer?.contains(target)) {
|
|
876
|
+
if (activeElement !== target)
|
|
877
|
+
target.focus({ preventScroll: true });
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
866
881
|
// An editor whose DOM is gone cannot be the one holding focus: a host that unmounted an
|
|
867
882
|
// input without a blur (Chromium fires none for a removed focused element) can leave a
|
|
868
883
|
// stale `activeEditor` behind, and honouring it would lock the grid out of keyboard input
|
|
@@ -872,7 +887,21 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
872
887
|
isDetachedEditor(activeEditor)) {
|
|
873
888
|
cellEditorInstance?.focus();
|
|
874
889
|
}
|
|
875
|
-
}, [activeEditor, cellEditorInstance]);
|
|
890
|
+
}, [activeEditor, cellEditorInstance, store]);
|
|
891
|
+
// The sheet's own keyboard target (its cell editor), for an object selected without a click
|
|
892
|
+
// to tell "focus came back to the sheet" from focus the person moved elsewhere.
|
|
893
|
+
useEffect(() => {
|
|
894
|
+
const container = gridContainerRef.current;
|
|
895
|
+
if (!container)
|
|
896
|
+
return;
|
|
897
|
+
const targets = store.get(sheetFocusTargetsAtom);
|
|
898
|
+
const target = () => cellEditorInstance?.el?.();
|
|
899
|
+
targets.set(container, target);
|
|
900
|
+
return () => {
|
|
901
|
+
if (targets.get(container) === target)
|
|
902
|
+
targets.delete(container);
|
|
903
|
+
};
|
|
904
|
+
}, [store, cellEditorInstance]);
|
|
876
905
|
/**
|
|
877
906
|
* Container and total size of the grid, as the grid measures them
|
|
878
907
|
*/
|
|
@@ -907,6 +936,8 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
907
936
|
* @returns ScrollCoords
|
|
908
937
|
*/
|
|
909
938
|
const getScrollPosition = useCallback(() => gridRef.current?.getScrollPosition() ?? DEFAULT_SCROLL_POSITION, []);
|
|
939
|
+
/** The pane the pointer is over on a split sheet (`handleMouseMove`); `undefined` otherwise. */
|
|
940
|
+
const hoveredPaneIdRef = useRef(undefined);
|
|
910
941
|
/** The pane the open editor belongs to; set when the edit starts (`handleBeforeEdit`). */
|
|
911
942
|
const editorPaneIdRef = useRef(undefined);
|
|
912
943
|
/**
|
|
@@ -914,9 +945,10 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
914
945
|
* counter is what makes the overlays drawn over the grid read their pane's offsets again.
|
|
915
946
|
*/
|
|
916
947
|
const [paneScrollTick, setPaneScrollTick] = useState(0);
|
|
917
|
-
const handlePaneScroll = useCallback(() => {
|
|
948
|
+
const handlePaneScroll = useCallback((pane) => {
|
|
918
949
|
setPaneScrollTick((tick) => tick + 1);
|
|
919
|
-
|
|
950
|
+
onPaneScroll?.(pane);
|
|
951
|
+
}, [onPaneScroll]);
|
|
920
952
|
/**
|
|
921
953
|
* What the cell editor is placed by. A sheet with no split answers exactly what
|
|
922
954
|
* `getScrollPosition` answers; a split sheet answers the editor's own pane, so the editor sits
|
|
@@ -928,13 +960,40 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
928
960
|
return DEFAULT_SCROLL_POSITION;
|
|
929
961
|
// `getActivePane()` is undefined on a sheet with no split and allocates nothing; asking for
|
|
930
962
|
// the pane list here would build an array every time the editor is placed.
|
|
931
|
-
|
|
963
|
+
const activePane = grid.getActivePane();
|
|
964
|
+
if (!activePane)
|
|
932
965
|
return grid.getScrollPosition();
|
|
933
|
-
|
|
966
|
+
// What the editor's pane draws its cells offset by (its scroll less the bar's shift on a
|
|
967
|
+
// pane right of or below a bar), not its scroll position.
|
|
968
|
+
const pane = (editorPaneIdRef.current &&
|
|
969
|
+
grid.getPanes().find((p) => p.id === editorPaneIdRef.current)) ||
|
|
970
|
+
activePane;
|
|
971
|
+
return { scrollLeft: pane.offsetLeft, scrollTop: pane.offsetTop };
|
|
934
972
|
// The tick is the dependency on purpose: a pane scrolling must give this callback a new
|
|
935
973
|
// identity, so the editor's position is computed again.
|
|
936
974
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
937
975
|
}, [paneScrollTick]);
|
|
976
|
+
/**
|
|
977
|
+
* What the heading resizer is placed by: the offset of the band the pointer is over, so a
|
|
978
|
+
* heading border is grabbed where that band draws it. A sheet with no split answers exactly what
|
|
979
|
+
* `getScrollPosition` answers.
|
|
980
|
+
*/
|
|
981
|
+
const getHeadingScrollPosition = useCallback(() => {
|
|
982
|
+
const grid = gridRef.current;
|
|
983
|
+
if (!grid)
|
|
984
|
+
return DEFAULT_SCROLL_POSITION;
|
|
985
|
+
if (!grid.getActivePane())
|
|
986
|
+
return grid.getScrollPosition();
|
|
987
|
+
const pane = grid
|
|
988
|
+
.getPanes()
|
|
989
|
+
.find((candidate) => candidate.id === hoveredPaneIdRef.current);
|
|
990
|
+
if (!pane)
|
|
991
|
+
return grid.getScrollPosition();
|
|
992
|
+
return { scrollLeft: pane.offsetLeft, scrollTop: pane.offsetTop };
|
|
993
|
+
// The tick and the hovered cell are the dependencies on purpose: a pane scrolling, or the
|
|
994
|
+
// pointer moving to another heading or band, must place the resizer again.
|
|
995
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
996
|
+
}, [paneScrollTick, hoveredCell]);
|
|
938
997
|
// Does the column contains a table
|
|
939
998
|
const columnContainsTable = useCallback((columnIndex) => {
|
|
940
999
|
const [_, tableColumnHeaderIds] = tableHeaderCells;
|
|
@@ -1330,8 +1389,16 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
1330
1389
|
const cfWindowRef = useRef(null);
|
|
1331
1390
|
// The cells whose shown notes are laid out (tile-quantized like the CF window).
|
|
1332
1391
|
const [noteWindow, setNoteWindow] = useState(NOTE_INITIAL_WINDOW);
|
|
1392
|
+
/**
|
|
1393
|
+
* Whether the grid is mounted and can place a cell — it reports its first viewport from its own
|
|
1394
|
+
* effect, once it is. What is laid out from cell positions in a memo (notes shown on the sheet,
|
|
1395
|
+
* pivot placeholders) is computed on the first render, before the grid exists, and would
|
|
1396
|
+
* otherwise keep that empty answer until something else changed.
|
|
1397
|
+
*/
|
|
1398
|
+
const [gridReady, setGridReady] = useState(false);
|
|
1333
1399
|
const handleViewPortChange = useCallback((viewport) => {
|
|
1334
1400
|
onViewPortChange?.(viewport);
|
|
1401
|
+
setGridReady(true);
|
|
1335
1402
|
const nextNoteWindow = noteWindowForViewport(viewport);
|
|
1336
1403
|
setNoteWindow((prev) => isSameNoteWindow(prev, nextNoteWindow) ? prev : nextNoteWindow);
|
|
1337
1404
|
if (!windowConditionalFormats)
|
|
@@ -1342,12 +1409,46 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
1342
1409
|
startTransition(() => setCfWindow(next));
|
|
1343
1410
|
}
|
|
1344
1411
|
}, [onViewPortChange, windowConditionalFormats]);
|
|
1412
|
+
/**
|
|
1413
|
+
* View ▸ Split: a pane right of or below a bar scrolls on its own, so its rows and columns are
|
|
1414
|
+
* not the window's — the notes of the cells it shows are read from its own window too. Read
|
|
1415
|
+
* after the grid has laid its panes out (an effect), and again when a pane scrolls.
|
|
1416
|
+
*/
|
|
1417
|
+
const [notePaneWindows, setNotePaneWindows] = useState();
|
|
1418
|
+
useEffect(() => {
|
|
1419
|
+
const grid = gridRef.current;
|
|
1420
|
+
const panes = showNotes && grid?.getActivePane() ? grid.getPanes() : [];
|
|
1421
|
+
const next = panes
|
|
1422
|
+
.filter((pane) => pane.rowBand === 1 || pane.columnBand === 1)
|
|
1423
|
+
.map((pane) => {
|
|
1424
|
+
const left = pane.offsetLeft + pane.rect.x;
|
|
1425
|
+
const top = pane.offsetTop + pane.rect.y;
|
|
1426
|
+
const from = grid?.getCellCoordsFromSheetOffset(left, top);
|
|
1427
|
+
const to = grid?.getCellCoordsFromSheetOffset(left + pane.rect.width - 1, top + pane.rect.height - 1) ?? grid?.getCellCoordsFromSheetOffset(left, top);
|
|
1428
|
+
return from && to
|
|
1429
|
+
? noteWindowForViewport({
|
|
1430
|
+
rowStartIndex: from.rowIndex,
|
|
1431
|
+
rowStopIndex: to.rowIndex,
|
|
1432
|
+
columnStartIndex: from.columnIndex,
|
|
1433
|
+
columnStopIndex: to.columnIndex,
|
|
1434
|
+
})
|
|
1435
|
+
: undefined;
|
|
1436
|
+
})
|
|
1437
|
+
.filter((area) => !!area);
|
|
1438
|
+
setNotePaneWindows((prev) => (prev?.length ?? 0) === next.length &&
|
|
1439
|
+
next.every((area, i) => prev && isSameNoteWindow(prev[i], area))
|
|
1440
|
+
? prev
|
|
1441
|
+
: next.length
|
|
1442
|
+
? next
|
|
1443
|
+
: undefined);
|
|
1444
|
+
}, [showNotes, splitPanePx, paneScrollTick, noteWindow, width, height]);
|
|
1345
1445
|
// Notes shown on the sheet (Show/Hide Note, Show All Notes): box + arrow drawn persistently.
|
|
1346
1446
|
const shownNoteComponents = useShownNotes({
|
|
1347
1447
|
sheetId,
|
|
1348
1448
|
showAllNotes,
|
|
1349
1449
|
enabled: showNotes,
|
|
1350
1450
|
window: noteWindow,
|
|
1451
|
+
paneWindows: notePaneWindows,
|
|
1351
1452
|
frozenRows,
|
|
1352
1453
|
frozenColumns,
|
|
1353
1454
|
readonly,
|
|
@@ -1357,6 +1458,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
1357
1458
|
onUpdateNote,
|
|
1358
1459
|
rowMetadata,
|
|
1359
1460
|
columnMetadata,
|
|
1461
|
+
layoutKey: gridReady,
|
|
1360
1462
|
});
|
|
1361
1463
|
/**
|
|
1362
1464
|
* Conditional Styles that should be applied to cell
|
|
@@ -2484,6 +2586,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2484
2586
|
? release.selections
|
|
2485
2587
|
: [{ range: cellToArea(release.activeCell) }]),
|
|
2486
2588
|
mode: release.button === "right" ? "menu" : "smart-tag",
|
|
2589
|
+
open: release.button === "right",
|
|
2487
2590
|
// Excel offers Flash Fill for a drag along a column (the source rows are the examples).
|
|
2488
2591
|
canFlashFill: !!onFlashFill &&
|
|
2489
2592
|
!!release.selections[0]?.range &&
|
|
@@ -2510,6 +2613,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2510
2613
|
setFillOptions({ ...fillOptions, fillType, mode: "smart-tag" });
|
|
2511
2614
|
focusSheet();
|
|
2512
2615
|
}, [fillOptions, onFill, setFillOptions, focusSheet]);
|
|
2616
|
+
const handleFillOptionsOpenChange = useCallback((open) => setFillOptions((current) => current && current.open !== open ? { ...current, open } : current), [setFillOptions]);
|
|
2513
2617
|
const handleCloseFillOptions = useCallback(() => {
|
|
2514
2618
|
// Only the right-drag menu is "cancel on close"; the smart tag stays.
|
|
2515
2619
|
if (fillOptions?.mode === "menu")
|
|
@@ -2697,16 +2801,9 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2697
2801
|
if (!tableAutoExpansion)
|
|
2698
2802
|
return;
|
|
2699
2803
|
if (option === "undo") {
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
else {
|
|
2704
|
-
const table = tables?.find((candidate) => candidate.id === tableAutoExpansion.tableId &&
|
|
2705
|
-
candidate.sheetId === tableAutoExpansion.sheetId);
|
|
2706
|
-
if (table) {
|
|
2707
|
-
onResizeTable?.(tableAutoExpansion.sheetId, table, tableAutoExpansion.previousRange);
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2804
|
+
// Only offered when the host can undo the growth with what it wrote
|
|
2805
|
+
// (a bare resize would leave the growth's writes in place).
|
|
2806
|
+
onUndoTableAutoExpansion?.(tableAutoExpansion);
|
|
2710
2807
|
}
|
|
2711
2808
|
else {
|
|
2712
2809
|
onChangeAutoExpandTables?.(false);
|
|
@@ -2715,28 +2812,27 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2715
2812
|
focusSheet();
|
|
2716
2813
|
}, [
|
|
2717
2814
|
tableAutoExpansion,
|
|
2718
|
-
tables,
|
|
2719
|
-
onResizeTable,
|
|
2720
2815
|
onUndoTableAutoExpansion,
|
|
2721
2816
|
onChangeAutoExpandTables,
|
|
2722
2817
|
setTableAutoExpansion,
|
|
2723
2818
|
focusSheet,
|
|
2724
2819
|
]);
|
|
2725
|
-
// The tag
|
|
2726
|
-
//
|
|
2820
|
+
// The tag belongs to the cell the growth was written from, not to the cursor:
|
|
2821
|
+
// it stays while the selection moves, and goes when the sheet changes or that
|
|
2822
|
+
// cell is no longer part of the table. The engine drops it on the next edit
|
|
2823
|
+
// (and every undo / redo).
|
|
2824
|
+
useEffect(() => {
|
|
2825
|
+
setTableAutoExpansion((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2826
|
+
}, [sheetId, setTableAutoExpansion]);
|
|
2727
2827
|
useEffect(() => {
|
|
2728
|
-
if (tableAutoExpansion
|
|
2729
|
-
|
|
2828
|
+
if (!tableAutoExpansion || !tables)
|
|
2829
|
+
return;
|
|
2830
|
+
const table = tables.find((candidate) => candidate.id === tableAutoExpansion.tableId &&
|
|
2831
|
+
candidate.sheetId === tableAutoExpansion.sheetId);
|
|
2832
|
+
if (!table || !isCellWithinBounds(tableAutoExpansion.anchor, table.range)) {
|
|
2730
2833
|
setTableAutoExpansion(null);
|
|
2731
2834
|
}
|
|
2732
|
-
}, [
|
|
2733
|
-
tableAutoExpansion,
|
|
2734
|
-
activeCell.rowIndex,
|
|
2735
|
-
activeCell.columnIndex,
|
|
2736
|
-
activeCell,
|
|
2737
|
-
sheetId,
|
|
2738
|
-
setTableAutoExpansion,
|
|
2739
|
-
]);
|
|
2835
|
+
}, [tableAutoExpansion, tables, setTableAutoExpansion]);
|
|
2740
2836
|
/**
|
|
2741
2837
|
* Excel's AutoCorrect smart tag after a formula typed into a table column.
|
|
2742
2838
|
* "Undo Calculated Column" reverts the fill alone (the typed cell keeps its
|
|
@@ -2766,21 +2862,24 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2766
2862
|
setCalculatedColumnFill,
|
|
2767
2863
|
focusSheet,
|
|
2768
2864
|
]);
|
|
2769
|
-
// The tag
|
|
2770
|
-
//
|
|
2865
|
+
// The tag belongs to the cell the formula was typed into, not to the cursor:
|
|
2866
|
+
// it stays while the selection moves, and goes when the sheet changes or that
|
|
2867
|
+
// cell is no longer in the table's column. The engine drops it on the next
|
|
2868
|
+
// edit (and every undo / redo).
|
|
2771
2869
|
useEffect(() => {
|
|
2772
|
-
|
|
2773
|
-
|
|
2870
|
+
setCalculatedColumnFill((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2871
|
+
}, [sheetId, setCalculatedColumnFill]);
|
|
2872
|
+
useEffect(() => {
|
|
2873
|
+
if (!calculatedColumnFill || !tables)
|
|
2874
|
+
return;
|
|
2875
|
+
const table = tables.find((candidate) => candidate.id === calculatedColumnFill.tableId &&
|
|
2876
|
+
candidate.sheetId === calculatedColumnFill.sheetId);
|
|
2877
|
+
if (!table ||
|
|
2878
|
+
!isCellWithinBounds(calculatedColumnFill.anchor, table.range) ||
|
|
2879
|
+
calculatedColumnFill.anchor.columnIndex !== calculatedColumnFill.columnIndex) {
|
|
2774
2880
|
setCalculatedColumnFill(null);
|
|
2775
2881
|
}
|
|
2776
|
-
}, [
|
|
2777
|
-
calculatedColumnFill,
|
|
2778
|
-
activeCell.rowIndex,
|
|
2779
|
-
activeCell.columnIndex,
|
|
2780
|
-
activeCell,
|
|
2781
|
-
sheetId,
|
|
2782
|
-
setCalculatedColumnFill,
|
|
2783
|
-
]);
|
|
2882
|
+
}, [calculatedColumnFill, tables, setCalculatedColumnFill]);
|
|
2784
2883
|
/**
|
|
2785
2884
|
* Run Excel's Series dialog result: the target range's first row (Series
|
|
2786
2885
|
* in Columns) / first column (Rows) is the seed line; `stop` may shrink or
|
|
@@ -2972,6 +3071,20 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2972
3071
|
* the target of those events (see `EmbedDraggable`); a paste that lands in the
|
|
2973
3072
|
* cell editor while a chart is on the clipboard is claimed here first.
|
|
2974
3073
|
*/
|
|
3074
|
+
// An object's size in cells is read the way print and Page Layout read it: a hidden row or
|
|
3075
|
+
// column has no size.
|
|
3076
|
+
const getAnchorColumnWidth = useCallback((columnIndex) => {
|
|
3077
|
+
const meta = columnMetadata?.[columnIndex];
|
|
3078
|
+
return meta?.hiddenByUser || meta?.hiddenByFilter || meta?.hiddenByGroup
|
|
3079
|
+
? 0
|
|
3080
|
+
: meta?.size ?? defaultColumnWidth;
|
|
3081
|
+
}, [columnMetadata, defaultColumnWidth]);
|
|
3082
|
+
const getAnchorRowHeight = useCallback((rowIndex) => {
|
|
3083
|
+
const meta = rowMetadata?.[rowIndex];
|
|
3084
|
+
return meta?.hiddenByUser || meta?.hiddenByFilter || meta?.hiddenByGroup
|
|
3085
|
+
? 0
|
|
3086
|
+
: meta?.size ?? defaultRowHeight;
|
|
3087
|
+
}, [rowMetadata, defaultRowHeight]);
|
|
2975
3088
|
const chartClipboard = useChartClipboard({
|
|
2976
3089
|
sheetId,
|
|
2977
3090
|
activeCell,
|
|
@@ -2981,7 +3094,16 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2981
3094
|
onDeleteChart,
|
|
2982
3095
|
onCopyChart,
|
|
2983
3096
|
onCutChart,
|
|
3097
|
+
embeds,
|
|
3098
|
+
onCreateEmbed,
|
|
3099
|
+
onDeleteEmbed,
|
|
2984
3100
|
focusSheet,
|
|
3101
|
+
rowCount: Math.min(MAX_ROW_COUNT, rowCount),
|
|
3102
|
+
columnCount: Math.min(MAX_COLUMN_COUNT, columnCount),
|
|
3103
|
+
getColumnWidth: getAnchorColumnWidth,
|
|
3104
|
+
getRowHeight: getAnchorRowHeight,
|
|
3105
|
+
objectClipboardPolicy,
|
|
3106
|
+
sheetExists: getSheetName ? (id) => Boolean(getSheetName(id)) : undefined,
|
|
2985
3107
|
});
|
|
2986
3108
|
const { copyChart, cutChart, pasteChart, duplicateChart, clearChartClipboard, } = chartClipboard;
|
|
2987
3109
|
const handleEditorCopy = useCallback((e) => {
|
|
@@ -2993,11 +3115,11 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2993
3115
|
onInternalCut(e);
|
|
2994
3116
|
}, [clearChartClipboard, onInternalCut]);
|
|
2995
3117
|
const handleEditorPaste = useCallback((e) => {
|
|
2996
|
-
if (pasteChart(e)) {
|
|
3118
|
+
if (objectClipboard && pasteChart(e)) {
|
|
2997
3119
|
return;
|
|
2998
3120
|
}
|
|
2999
3121
|
onInternalPaste(e);
|
|
3000
|
-
}, [pasteChart, onInternalPaste]);
|
|
3122
|
+
}, [objectClipboard, pasteChart, onInternalPaste]);
|
|
3001
3123
|
/**
|
|
3002
3124
|
* Context menu "Insert Cut Cells" (Excel: Ctrl+X, right-click the destination). A cut of
|
|
3003
3125
|
* whole rows / columns dropped on a row / column header inserts them BEFORE the clicked
|
|
@@ -3496,6 +3618,44 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3496
3618
|
* Shortcut handlers for formatting
|
|
3497
3619
|
* TODO: Decide on the output
|
|
3498
3620
|
*/
|
|
3621
|
+
/**
|
|
3622
|
+
* The Auto Fill Options button belongs to the fill it offers to redo: Escape dismisses it, and
|
|
3623
|
+
* an undo or redo from the keyboard takes it away, so a choice can never re-apply an undone fill.
|
|
3624
|
+
*/
|
|
3625
|
+
const clearCopiedSelectionsAndFillOptions = useCallback(() => {
|
|
3626
|
+
setFillOptions(null);
|
|
3627
|
+
clearCopiedSelections();
|
|
3628
|
+
}, [setFillOptions, clearCopiedSelections]);
|
|
3629
|
+
/**
|
|
3630
|
+
* Every smart tag offers to redo or adjust the edit it belongs to (Insert Options, AutoCorrect
|
|
3631
|
+
* Options, Flash Fill Options, the calculated-column tag, Auto Fill Options): an undo or redo
|
|
3632
|
+
* takes them all away, so a choice can never act on an edit that was undone.
|
|
3633
|
+
*/
|
|
3634
|
+
const dropSmartTags = useCallback(() => {
|
|
3635
|
+
setFillOptions(null);
|
|
3636
|
+
setInsertOptions(null);
|
|
3637
|
+
setTableAutoExpansion(null);
|
|
3638
|
+
setCalculatedColumnFill(null);
|
|
3639
|
+
setFlashFillOptions(null);
|
|
3640
|
+
}, [
|
|
3641
|
+
setFillOptions,
|
|
3642
|
+
setInsertOptions,
|
|
3643
|
+
setTableAutoExpansion,
|
|
3644
|
+
setCalculatedColumnFill,
|
|
3645
|
+
setFlashFillOptions,
|
|
3646
|
+
]);
|
|
3647
|
+
const undoDroppingFillOptions = useMemo(() => onUndo
|
|
3648
|
+
? () => {
|
|
3649
|
+
dropSmartTags();
|
|
3650
|
+
onUndo();
|
|
3651
|
+
}
|
|
3652
|
+
: undefined, [onUndo, dropSmartTags]);
|
|
3653
|
+
const redoDroppingFillOptions = useMemo(() => onRedo
|
|
3654
|
+
? () => {
|
|
3655
|
+
dropSmartTags();
|
|
3656
|
+
onRedo();
|
|
3657
|
+
}
|
|
3658
|
+
: undefined, [onRedo, dropSmartTags]);
|
|
3499
3659
|
const onKeyDownFormatting = useKeyboardHandler({
|
|
3500
3660
|
sheetId,
|
|
3501
3661
|
locale,
|
|
@@ -3532,12 +3692,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3532
3692
|
onInsertTime,
|
|
3533
3693
|
onInsertDate,
|
|
3534
3694
|
onInsertDateTime,
|
|
3535
|
-
onUndo,
|
|
3536
|
-
onRedo,
|
|
3695
|
+
onUndo: undoDroppingFillOptions,
|
|
3696
|
+
onRedo: redoDroppingFillOptions,
|
|
3537
3697
|
onCreateTable,
|
|
3538
3698
|
onRequestCreateTable,
|
|
3539
3699
|
onCreateBasicFilter,
|
|
3540
|
-
clearCopiedSelections,
|
|
3700
|
+
clearCopiedSelections: clearCopiedSelectionsAndFillOptions,
|
|
3541
3701
|
onRequestSearch,
|
|
3542
3702
|
onRequestReplace,
|
|
3543
3703
|
onRequestFormatCells,
|
|
@@ -3747,7 +3907,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3747
3907
|
*/
|
|
3748
3908
|
const { headerMenuComponent, isHeaderMenuInFrozenColumn, headerResizer, isDragging: isDraggingHeader, } = useHeaderActions({
|
|
3749
3909
|
activeCell: isSelectionInProgress || isFilling || isDragging ? null : hoveredCell,
|
|
3750
|
-
getScrollPosition,
|
|
3910
|
+
getScrollPosition: getHeadingScrollPosition,
|
|
3751
3911
|
getCellOffsetFromCoords,
|
|
3752
3912
|
getRelativePositionFromOffset,
|
|
3753
3913
|
showContextMenu,
|
|
@@ -3780,8 +3940,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3780
3940
|
const onRequestCloseTooltip = useCallback(() => {
|
|
3781
3941
|
setHoveredCell(undefined);
|
|
3782
3942
|
}, []);
|
|
3943
|
+
// Page Layout ▸ Background: this grid's own layer, moved from this grid's
|
|
3944
|
+
// scroll (never the page-wide subject). A no-op while the sheet has none.
|
|
3945
|
+
const sheetBackgroundRef = useRef(null);
|
|
3783
3946
|
// Scroll subscriber
|
|
3784
3947
|
const handleScroll = useCallback((scrollPosition) => {
|
|
3948
|
+
sheetBackgroundRef.current?.setScrollPosition(scrollPosition);
|
|
3785
3949
|
// Pass it to rxjs subscriber
|
|
3786
3950
|
if (!isEditInProgress) {
|
|
3787
3951
|
scrollSubscriber.next(scrollPosition);
|
|
@@ -3893,6 +4057,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3893
4057
|
getCellData,
|
|
3894
4058
|
]);
|
|
3895
4059
|
const { chartComponents, embedComponents, slicerComponents, contextMenuComponent: embedContextMenuComponent, onMouseDown: onMouseDownCharts, requestChartContextMenu, selectAllObjects: selectAllObjectsUnstable, } = useEmbedsCharts({
|
|
4060
|
+
pageLayout,
|
|
3896
4061
|
getLinkedPictureSource,
|
|
3897
4062
|
getSheetName,
|
|
3898
4063
|
charts,
|
|
@@ -3905,6 +4070,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3905
4070
|
getCellOffsetFromCoords,
|
|
3906
4071
|
getAbsolutePositionFromOffset,
|
|
3907
4072
|
getCellCoordsFromOffset,
|
|
4073
|
+
getCellCoordsFromSheetOffset,
|
|
3908
4074
|
getRelativePositionFromOffset,
|
|
3909
4075
|
getScrollPosition,
|
|
3910
4076
|
ContextMenuWrapper,
|
|
@@ -3912,7 +4078,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3912
4078
|
selectedColor: chartSelectedColor,
|
|
3913
4079
|
onMoveChart,
|
|
3914
4080
|
onResizeChart,
|
|
3915
|
-
chartClipboard,
|
|
4081
|
+
chartClipboard: objectClipboard ? chartClipboard : undefined,
|
|
3916
4082
|
onMoveEmbed,
|
|
3917
4083
|
onResizeEmbed,
|
|
3918
4084
|
onDeleteEmbed,
|
|
@@ -4072,9 +4238,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4072
4238
|
}
|
|
4073
4239
|
onMouseMoveTableHitZones(e);
|
|
4074
4240
|
const coords = getCellCoordsFromOffset(e.clientX, e.clientY);
|
|
4075
|
-
|
|
4241
|
+
// On a split sheet the same heading can show in two bands (a column in both column bands
|
|
4242
|
+
// once they scroll apart): which band the pointer is over decides where its border is.
|
|
4243
|
+
const paneId = gridRef.current?.getActivePane()
|
|
4244
|
+
? gridRef.current.getPaneFromOffset(e.clientX, e.clientY)?.id
|
|
4245
|
+
: undefined;
|
|
4246
|
+
if (!coords ||
|
|
4247
|
+
(isEqualCells(hoveredCellRef.current, coords) &&
|
|
4248
|
+
paneId === hoveredPaneIdRef.current)) {
|
|
4076
4249
|
return;
|
|
4077
4250
|
}
|
|
4251
|
+
hoveredPaneIdRef.current = paneId;
|
|
4078
4252
|
setHoveredCell(coords);
|
|
4079
4253
|
}, [
|
|
4080
4254
|
getCellCoordsFromOffset,
|
|
@@ -4378,6 +4552,26 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4378
4552
|
getColumnOffset,
|
|
4379
4553
|
getEffectiveCellFormat,
|
|
4380
4554
|
]);
|
|
4555
|
+
// Format Stale Values: a stale formula cell is drawn struck through — its drawn format only, never
|
|
4556
|
+
// the cell's own. With nothing stale the grid draws with `getEffectiveCellFormat` itself.
|
|
4557
|
+
const getDrawnCellFormat = useMemo(() => {
|
|
4558
|
+
if (!staleCells || staleCells.size === 0)
|
|
4559
|
+
return getEffectiveCellFormat;
|
|
4560
|
+
return (cellSheetId, rowIndex, columnIndex) => {
|
|
4561
|
+
const format = getEffectiveCellFormat(cellSheetId, rowIndex, columnIndex);
|
|
4562
|
+
if (cellSheetId !== sheetId ||
|
|
4563
|
+
!staleCells.has(rowIndex, columnIndex) ||
|
|
4564
|
+
(editingCellCoordinate?.sheetId === cellSheetId &&
|
|
4565
|
+
editingCellCoordinate.rowIndex === rowIndex &&
|
|
4566
|
+
editingCellCoordinate.columnIndex === columnIndex)) {
|
|
4567
|
+
return format;
|
|
4568
|
+
}
|
|
4569
|
+
return {
|
|
4570
|
+
...format,
|
|
4571
|
+
textFormat: { ...format?.textFormat, strikethrough: true },
|
|
4572
|
+
};
|
|
4573
|
+
};
|
|
4574
|
+
}, [getEffectiveCellFormat, staleCells, sheetId, editingCellCoordinate]);
|
|
4381
4575
|
/**
|
|
4382
4576
|
* Render Cells in the grid
|
|
4383
4577
|
*/
|
|
@@ -4429,7 +4623,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4429
4623
|
getSparklineGroup,
|
|
4430
4624
|
getFormattedValue: getDisplayFormattedValue,
|
|
4431
4625
|
getCellImageUrl,
|
|
4432
|
-
getEffectiveCellFormat,
|
|
4626
|
+
getEffectiveCellFormat: getDrawnCellFormat,
|
|
4433
4627
|
getCellBounds,
|
|
4434
4628
|
getCellMetaType,
|
|
4435
4629
|
getRowHeaderText,
|
|
@@ -4587,15 +4781,19 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4587
4781
|
onChooseFillType: handleChooseFillType,
|
|
4588
4782
|
onOpenFillSeriesDialog: handleOpenFillSeriesDialog,
|
|
4589
4783
|
onCloseFillOptions: handleCloseFillOptions,
|
|
4784
|
+
onFillOptionsOpenChange: handleFillOptionsOpenChange,
|
|
4590
4785
|
insertOptions,
|
|
4591
4786
|
onChooseInsertOption: handleChooseInsertOption,
|
|
4592
4787
|
tableAutoExpansion,
|
|
4593
4788
|
canStopAutoExpandingTables: !!onChangeAutoExpandTables,
|
|
4789
|
+
canUndoTableAutoExpansion: !!onUndoTableAutoExpansion,
|
|
4594
4790
|
onChooseTableAutoExpansionOption: handleChooseTableAutoExpansionOption,
|
|
4595
4791
|
flashFillOptions,
|
|
4596
4792
|
onChooseFlashFillOption: handleChooseFlashFillOption,
|
|
4597
4793
|
calculatedColumnFill,
|
|
4598
4794
|
canStopAutoCalculatedColumns: !!onChangeAutoCalculatedColumns,
|
|
4795
|
+
canUndoCalculatedColumn: !!onUndoCalculatedColumn,
|
|
4796
|
+
canOverwriteCalculatedColumn: !!onOverwriteCalculatedColumn,
|
|
4599
4797
|
onChooseCalculatedColumnOption: handleChooseCalculatedColumnOption,
|
|
4600
4798
|
errorCheck: activeErrorCheckTag,
|
|
4601
4799
|
errorCheckMenuOpen,
|
|
@@ -4642,13 +4840,50 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4642
4840
|
const pageBreakBorderStyles = useMemo(() => pageBreakPreview
|
|
4643
4841
|
? getPageBreakPreviewStyles(pageBreakPreview, rowCount, columnCount)
|
|
4644
4842
|
: getPageBreakBorderStyles(pageLayout ? undefined : pageBreaks, rowCount, columnCount), [pageBreakPreview, pageBreaks, pageLayout, rowCount, columnCount]);
|
|
4645
|
-
|
|
4843
|
+
/**
|
|
4844
|
+
* A pending AutoCorrect Options tag is drawn beside the cell its edit was made in: an invisible
|
|
4845
|
+
* border style on that cell carries it (one, with both kinds, when a single edit grew a table
|
|
4846
|
+
* and filled a calculated column from the same cell).
|
|
4847
|
+
*/
|
|
4848
|
+
const autoCorrectAnchorStyles = useMemo(() => {
|
|
4849
|
+
const anchorOf = (request) => request && request.sheetId === sheetId ? request.anchor : undefined;
|
|
4850
|
+
const tableAnchor = anchorOf(tableAutoExpansion);
|
|
4851
|
+
const columnAnchor = anchorOf(calculatedColumnFill);
|
|
4852
|
+
const styleAt = (cell, kinds) => ({
|
|
4853
|
+
range: {
|
|
4854
|
+
startRowIndex: cell.rowIndex,
|
|
4855
|
+
endRowIndex: cell.rowIndex,
|
|
4856
|
+
startColumnIndex: cell.columnIndex,
|
|
4857
|
+
endColumnIndex: cell.columnIndex,
|
|
4858
|
+
},
|
|
4859
|
+
type: AUTOCORRECT_ANCHOR_TYPE,
|
|
4860
|
+
index: `${AUTOCORRECT_ANCHOR_TYPE}:${kinds.join("+")}`,
|
|
4861
|
+
style: { stroke: "transparent", strokeWidth: 0 },
|
|
4862
|
+
metadata: { autoCorrect: kinds },
|
|
4863
|
+
});
|
|
4864
|
+
if (tableAnchor && columnAnchor && isEqualCells(tableAnchor, columnAnchor)) {
|
|
4865
|
+
return [styleAt(tableAnchor, ["table", "calculated"])];
|
|
4866
|
+
}
|
|
4867
|
+
return [
|
|
4868
|
+
...(tableAnchor ? [styleAt(tableAnchor, ["table"])] : []),
|
|
4869
|
+
...(columnAnchor ? [styleAt(columnAnchor, ["calculated"])] : []),
|
|
4870
|
+
];
|
|
4871
|
+
}, [tableAutoExpansion, calculatedColumnFill, sheetId]);
|
|
4872
|
+
const gridBorderStyles = useMemo(() => chartSourceBorderStyles.length ||
|
|
4873
|
+
pageBreakBorderStyles.length ||
|
|
4874
|
+
autoCorrectAnchorStyles.length
|
|
4646
4875
|
? [
|
|
4647
4876
|
...pageBreakBorderStyles,
|
|
4648
4877
|
...finalBorderStyles,
|
|
4649
4878
|
...chartSourceBorderStyles,
|
|
4879
|
+
...autoCorrectAnchorStyles,
|
|
4650
4880
|
]
|
|
4651
|
-
: finalBorderStyles, [
|
|
4881
|
+
: finalBorderStyles, [
|
|
4882
|
+
finalBorderStyles,
|
|
4883
|
+
chartSourceBorderStyles,
|
|
4884
|
+
pageBreakBorderStyles,
|
|
4885
|
+
autoCorrectAnchorStyles,
|
|
4886
|
+
]);
|
|
4652
4887
|
// Hidden column markers
|
|
4653
4888
|
const [hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers,] = useHiddenDimensionMarkers({
|
|
4654
4889
|
sheetId,
|
|
@@ -4860,7 +5095,15 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4860
5095
|
}
|
|
4861
5096
|
}
|
|
4862
5097
|
return placeholders;
|
|
4863
|
-
|
|
5098
|
+
// `gridReady`: the first render comes before the grid can place the target cell.
|
|
5099
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5100
|
+
}, [
|
|
5101
|
+
pivotTables,
|
|
5102
|
+
sheetId,
|
|
5103
|
+
onRequestEditPivotTable,
|
|
5104
|
+
getCellOffsetFromCoords,
|
|
5105
|
+
gridReady,
|
|
5106
|
+
]);
|
|
4864
5107
|
/**
|
|
4865
5108
|
* Helper function to reset grid cache if column or
|
|
4866
5109
|
* row dimension changes
|
|
@@ -5028,6 +5271,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
5028
5271
|
// the editor is positioned by. Without it the DOM would be placed by the pane last pointed
|
|
5029
5272
|
// at, and the two can disagree (the independent review's finding 6).
|
|
5030
5273
|
editorPaneId: editorPaneIdRef.current,
|
|
5274
|
+
getCellOffsetFromCoords,
|
|
5031
5275
|
});
|
|
5032
5276
|
const sheetNameForLayout = pageLayout ? getSheetName?.(sheetId) ?? "" : "";
|
|
5033
5277
|
const handleChangeHeaderFooter = useCallback((headerFooter) => onChangeHeaderFooter?.(sheetId, headerFooter), [onChangeHeaderFooter, sheetId]);
|
|
@@ -5115,13 +5359,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
5115
5359
|
: tableHitCursor
|
|
5116
5360
|
? { ...rest.style, cursor: tableHitCursor }
|
|
5117
5361
|
: rest.style },
|
|
5362
|
+
React.createElement(SheetBackground, { ref: sheetBackgroundRef, imageUrl: backgroundImageUrl, getScrollPosition: getScrollPosition, headerWidth: showHeaders ? rowHeaderWidth : 0, headerHeight: showHeaders ? columnHeaderHeight : 0, scale: scale, rightToLeft: rightToLeft }),
|
|
5118
5363
|
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" },
|
|
5119
5364
|
React.createElement("div", { className: "space-y-2" },
|
|
5120
5365
|
React.createElement(Skeleton, { className: "h-4 w-[250px]" }),
|
|
5121
5366
|
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
5367
|
// Freeze Panes and Split are mutually exclusive: the grid is told the SHEET's frozen
|
|
5123
5368
|
// counts, not the heading band added above.
|
|
5124
|
-
sheetFrozenRows: frozenRowCount ?? 0, sheetFrozenColumns: frozenColumnCount ?? 0, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle,
|
|
5369
|
+
sheetFrozenRows: frozenRowCount ?? 0, sheetFrozenColumns: frozenColumnCount ?? 0, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle,
|
|
5370
|
+
// The smart tags anchored to the active cell's corners (Flash Fill
|
|
5371
|
+
// Options, Insert Options on a lone active cell) need its copies per pane.
|
|
5372
|
+
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,
|
|
5125
5373
|
// Dimension of fill handle
|
|
5126
5374
|
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 })),
|
|
5127
5375
|
React.createElement(RtlMirrorLayer, { rightToLeft: rightToLeft }, tooltipComponent),
|