@rowsncolumns/spreadsheet 10.11.0 → 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/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 +265 -115
- package/dist/cjs/components/canvas-grid/typings.d.ts +25 -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 +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-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/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 +186 -51
- package/dist/esm/components/canvas-grid/typings.d.ts +25 -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 +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-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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, IconButton, } from "@rowsncolumns/ui";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
/** Excel's AutoCorrect Options lightning bolt. */
|
|
4
|
+
const LightningIcon = () => (React.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" },
|
|
5
|
+
React.createElement("path", { d: "M13 2 4 14h6l-1 8 9-12h-6l1-8z" })));
|
|
6
|
+
/**
|
|
7
|
+
* Excel's AutoCorrect Options smart tag beside the cell an edit grew a table from, or typed a
|
|
8
|
+
* table column's formula into — ONE button, carrying the entries of both when one edit did both
|
|
9
|
+
* (a formula typed in the column right of a table): "Undo Table AutoExpansion" / "Stop
|
|
10
|
+
* Automatically Expanding Tables", and "Undo Calculated Column" (or "Overwrite all cells in this
|
|
11
|
+
* column with this formula") / "Stop automatically creating calculated columns". An entry the
|
|
12
|
+
* host cannot carry out is not offered; with none left, no button.
|
|
13
|
+
*/
|
|
14
|
+
export const AutoCorrectOptionsSmartTag = ({ x, y, width, tableAutoExpansion, onChooseTableAutoExpansionOption, calculatedColumn, onChooseCalculatedColumnOption, }) => {
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
const tableEntries = tableAutoExpansion && onChooseTableAutoExpansionOption
|
|
17
|
+
? [
|
|
18
|
+
...(tableAutoExpansion.canUndo
|
|
19
|
+
? [
|
|
20
|
+
{
|
|
21
|
+
key: "table-undo",
|
|
22
|
+
label: "Undo Table AutoExpansion",
|
|
23
|
+
onSelect: () => onChooseTableAutoExpansionOption("undo"),
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
: []),
|
|
27
|
+
...(tableAutoExpansion.canStop
|
|
28
|
+
? [
|
|
29
|
+
{
|
|
30
|
+
key: "table-stop",
|
|
31
|
+
label: "Stop Automatically Expanding Tables",
|
|
32
|
+
onSelect: () => onChooseTableAutoExpansionOption("stop"),
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
]
|
|
37
|
+
: [];
|
|
38
|
+
const columnEntries = calculatedColumn && onChooseCalculatedColumnOption
|
|
39
|
+
? [
|
|
40
|
+
...(calculatedColumn.kind === "filled" && calculatedColumn.canUndo
|
|
41
|
+
? [
|
|
42
|
+
{
|
|
43
|
+
key: "column-undo",
|
|
44
|
+
label: "Undo Calculated Column",
|
|
45
|
+
onSelect: () => onChooseCalculatedColumnOption("undo"),
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
: []),
|
|
49
|
+
...(calculatedColumn.kind !== "filled" && calculatedColumn.canOverwrite
|
|
50
|
+
? [
|
|
51
|
+
{
|
|
52
|
+
key: "column-overwrite",
|
|
53
|
+
label: "Overwrite all cells in this column with this formula",
|
|
54
|
+
onSelect: () => onChooseCalculatedColumnOption("overwrite"),
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
: []),
|
|
58
|
+
...(calculatedColumn.canStop
|
|
59
|
+
? [
|
|
60
|
+
{
|
|
61
|
+
key: "column-stop",
|
|
62
|
+
label: "Stop automatically creating calculated columns",
|
|
63
|
+
onSelect: () => onChooseCalculatedColumnOption("stop"),
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
: []),
|
|
67
|
+
]
|
|
68
|
+
: [];
|
|
69
|
+
if (!tableEntries.length && !columnEntries.length) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const kinds = [
|
|
73
|
+
tableEntries.length ? "table-auto-expansion" : undefined,
|
|
74
|
+
columnEntries.length ? "calculated-column" : undefined,
|
|
75
|
+
].filter(Boolean);
|
|
76
|
+
return (React.createElement("div", { className: "absolute pointer-events-auto flex items-start justify-start", style: { left: x + width + 2, top: y }, onMouseDown: (e) => e.stopPropagation(), "data-testid": "autocorrect-options", "data-autocorrect": kinds.join(" ") },
|
|
77
|
+
React.createElement(DropdownMenu, { modal: false, open: open, onOpenChange: setOpen },
|
|
78
|
+
React.createElement(DropdownMenuTrigger, { asChild: true },
|
|
79
|
+
React.createElement(IconButton, { tooltip: "AutoCorrect Options", "aria-label": "AutoCorrect Options", className: "shadow-sm bg-rnc-background border-rnc-border border border-solid rounded-md" },
|
|
80
|
+
React.createElement(LightningIcon, null))),
|
|
81
|
+
React.createElement(DropdownMenuPortal, null,
|
|
82
|
+
React.createElement(DropdownMenuContent, { align: "start", onCloseAutoFocus: (event) => event.preventDefault() },
|
|
83
|
+
tableEntries.map((entry) => (React.createElement(DropdownMenuItem, { key: entry.key, onSelect: entry.onSelect }, entry.label))),
|
|
84
|
+
tableEntries.length && columnEntries.length ? (React.createElement(DropdownMenuSeparator, null)) : null,
|
|
85
|
+
columnEntries.map((entry) => (React.createElement(DropdownMenuItem, { key: entry.key, onSelect: entry.onSelect }, entry.label))))))));
|
|
86
|
+
};
|
|
87
|
+
AutoCorrectOptionsSmartTag.displayName = "AutoCorrectOptionsSmartTag";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAoEA,OAAO,KASN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/canvas-grid/index.tsx"],"names":[],"mappings":"AAoEA,OAAO,KASN,MAAM,OAAO,CAAC;AA4Qf,OAAO,KAAK,EAGV,QAAQ,EAYT,MAAM,aAAa,CAAC;AA4CrB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EAEhB,MAAM,WAAW,CAAC;AAw3OnB,eAAO,MAAM,UAAU,EAA4C,CACjE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,EAEvB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GACvB,wBAAwB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC"}
|
|
@@ -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, 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,
|
|
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
|
|
@@ -863,6 +864,18 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
863
864
|
!gridContainer.contains(activeElement)) {
|
|
864
865
|
return;
|
|
865
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
|
+
}
|
|
866
879
|
// An editor whose DOM is gone cannot be the one holding focus: a host that unmounted an
|
|
867
880
|
// input without a blur (Chromium fires none for a removed focused element) can leave a
|
|
868
881
|
// stale `activeEditor` behind, and honouring it would lock the grid out of keyboard input
|
|
@@ -872,7 +885,21 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
872
885
|
isDetachedEditor(activeEditor)) {
|
|
873
886
|
cellEditorInstance?.focus();
|
|
874
887
|
}
|
|
875
|
-
}, [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]);
|
|
876
903
|
/**
|
|
877
904
|
* Container and total size of the grid, as the grid measures them
|
|
878
905
|
*/
|
|
@@ -2484,6 +2511,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2484
2511
|
? release.selections
|
|
2485
2512
|
: [{ range: cellToArea(release.activeCell) }]),
|
|
2486
2513
|
mode: release.button === "right" ? "menu" : "smart-tag",
|
|
2514
|
+
open: release.button === "right",
|
|
2487
2515
|
// Excel offers Flash Fill for a drag along a column (the source rows are the examples).
|
|
2488
2516
|
canFlashFill: !!onFlashFill &&
|
|
2489
2517
|
!!release.selections[0]?.range &&
|
|
@@ -2510,6 +2538,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2510
2538
|
setFillOptions({ ...fillOptions, fillType, mode: "smart-tag" });
|
|
2511
2539
|
focusSheet();
|
|
2512
2540
|
}, [fillOptions, onFill, setFillOptions, focusSheet]);
|
|
2541
|
+
const handleFillOptionsOpenChange = useCallback((open) => setFillOptions((current) => current && current.open !== open ? { ...current, open } : current), [setFillOptions]);
|
|
2513
2542
|
const handleCloseFillOptions = useCallback(() => {
|
|
2514
2543
|
// Only the right-drag menu is "cancel on close"; the smart tag stays.
|
|
2515
2544
|
if (fillOptions?.mode === "menu")
|
|
@@ -2697,16 +2726,9 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2697
2726
|
if (!tableAutoExpansion)
|
|
2698
2727
|
return;
|
|
2699
2728
|
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
|
-
}
|
|
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);
|
|
2710
2732
|
}
|
|
2711
2733
|
else {
|
|
2712
2734
|
onChangeAutoExpandTables?.(false);
|
|
@@ -2715,28 +2737,27 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2715
2737
|
focusSheet();
|
|
2716
2738
|
}, [
|
|
2717
2739
|
tableAutoExpansion,
|
|
2718
|
-
tables,
|
|
2719
|
-
onResizeTable,
|
|
2720
2740
|
onUndoTableAutoExpansion,
|
|
2721
2741
|
onChangeAutoExpandTables,
|
|
2722
2742
|
setTableAutoExpansion,
|
|
2723
2743
|
focusSheet,
|
|
2724
2744
|
]);
|
|
2725
|
-
// The tag
|
|
2726
|
-
//
|
|
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).
|
|
2749
|
+
useEffect(() => {
|
|
2750
|
+
setTableAutoExpansion((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2751
|
+
}, [sheetId, setTableAutoExpansion]);
|
|
2727
2752
|
useEffect(() => {
|
|
2728
|
-
if (tableAutoExpansion
|
|
2729
|
-
|
|
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)) {
|
|
2730
2758
|
setTableAutoExpansion(null);
|
|
2731
2759
|
}
|
|
2732
|
-
}, [
|
|
2733
|
-
tableAutoExpansion,
|
|
2734
|
-
activeCell.rowIndex,
|
|
2735
|
-
activeCell.columnIndex,
|
|
2736
|
-
activeCell,
|
|
2737
|
-
sheetId,
|
|
2738
|
-
setTableAutoExpansion,
|
|
2739
|
-
]);
|
|
2760
|
+
}, [tableAutoExpansion, tables, setTableAutoExpansion]);
|
|
2740
2761
|
/**
|
|
2741
2762
|
* Excel's AutoCorrect smart tag after a formula typed into a table column.
|
|
2742
2763
|
* "Undo Calculated Column" reverts the fill alone (the typed cell keeps its
|
|
@@ -2766,21 +2787,24 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2766
2787
|
setCalculatedColumnFill,
|
|
2767
2788
|
focusSheet,
|
|
2768
2789
|
]);
|
|
2769
|
-
// The tag
|
|
2770
|
-
//
|
|
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).
|
|
2771
2794
|
useEffect(() => {
|
|
2772
|
-
|
|
2773
|
-
|
|
2795
|
+
setCalculatedColumnFill((current) => current && current.sheetId !== sheetId ? null : current);
|
|
2796
|
+
}, [sheetId, setCalculatedColumnFill]);
|
|
2797
|
+
useEffect(() => {
|
|
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) {
|
|
2774
2805
|
setCalculatedColumnFill(null);
|
|
2775
2806
|
}
|
|
2776
|
-
}, [
|
|
2777
|
-
calculatedColumnFill,
|
|
2778
|
-
activeCell.rowIndex,
|
|
2779
|
-
activeCell.columnIndex,
|
|
2780
|
-
activeCell,
|
|
2781
|
-
sheetId,
|
|
2782
|
-
setCalculatedColumnFill,
|
|
2783
|
-
]);
|
|
2807
|
+
}, [calculatedColumnFill, tables, setCalculatedColumnFill]);
|
|
2784
2808
|
/**
|
|
2785
2809
|
* Run Excel's Series dialog result: the target range's first row (Series
|
|
2786
2810
|
* in Columns) / first column (Rows) is the seed line; `stop` may shrink or
|
|
@@ -2972,6 +2996,20 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2972
2996
|
* the target of those events (see `EmbedDraggable`); a paste that lands in the
|
|
2973
2997
|
* cell editor while a chart is on the clipboard is claimed here first.
|
|
2974
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]);
|
|
2975
3013
|
const chartClipboard = useChartClipboard({
|
|
2976
3014
|
sheetId,
|
|
2977
3015
|
activeCell,
|
|
@@ -2981,7 +3019,16 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2981
3019
|
onDeleteChart,
|
|
2982
3020
|
onCopyChart,
|
|
2983
3021
|
onCutChart,
|
|
3022
|
+
embeds,
|
|
3023
|
+
onCreateEmbed,
|
|
3024
|
+
onDeleteEmbed,
|
|
2984
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,
|
|
2985
3032
|
});
|
|
2986
3033
|
const { copyChart, cutChart, pasteChart, duplicateChart, clearChartClipboard, } = chartClipboard;
|
|
2987
3034
|
const handleEditorCopy = useCallback((e) => {
|
|
@@ -2993,11 +3040,11 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
2993
3040
|
onInternalCut(e);
|
|
2994
3041
|
}, [clearChartClipboard, onInternalCut]);
|
|
2995
3042
|
const handleEditorPaste = useCallback((e) => {
|
|
2996
|
-
if (pasteChart(e)) {
|
|
3043
|
+
if (objectClipboard && pasteChart(e)) {
|
|
2997
3044
|
return;
|
|
2998
3045
|
}
|
|
2999
3046
|
onInternalPaste(e);
|
|
3000
|
-
}, [pasteChart, onInternalPaste]);
|
|
3047
|
+
}, [objectClipboard, pasteChart, onInternalPaste]);
|
|
3001
3048
|
/**
|
|
3002
3049
|
* Context menu "Insert Cut Cells" (Excel: Ctrl+X, right-click the destination). A cut of
|
|
3003
3050
|
* whole rows / columns dropped on a row / column header inserts them BEFORE the clicked
|
|
@@ -3496,6 +3543,44 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3496
3543
|
* Shortcut handlers for formatting
|
|
3497
3544
|
* TODO: Decide on the output
|
|
3498
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]);
|
|
3499
3584
|
const onKeyDownFormatting = useKeyboardHandler({
|
|
3500
3585
|
sheetId,
|
|
3501
3586
|
locale,
|
|
@@ -3532,12 +3617,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3532
3617
|
onInsertTime,
|
|
3533
3618
|
onInsertDate,
|
|
3534
3619
|
onInsertDateTime,
|
|
3535
|
-
onUndo,
|
|
3536
|
-
onRedo,
|
|
3620
|
+
onUndo: undoDroppingFillOptions,
|
|
3621
|
+
onRedo: redoDroppingFillOptions,
|
|
3537
3622
|
onCreateTable,
|
|
3538
3623
|
onRequestCreateTable,
|
|
3539
3624
|
onCreateBasicFilter,
|
|
3540
|
-
clearCopiedSelections,
|
|
3625
|
+
clearCopiedSelections: clearCopiedSelectionsAndFillOptions,
|
|
3541
3626
|
onRequestSearch,
|
|
3542
3627
|
onRequestReplace,
|
|
3543
3628
|
onRequestFormatCells,
|
|
@@ -3780,8 +3865,12 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3780
3865
|
const onRequestCloseTooltip = useCallback(() => {
|
|
3781
3866
|
setHoveredCell(undefined);
|
|
3782
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);
|
|
3783
3871
|
// Scroll subscriber
|
|
3784
3872
|
const handleScroll = useCallback((scrollPosition) => {
|
|
3873
|
+
sheetBackgroundRef.current?.setScrollPosition(scrollPosition);
|
|
3785
3874
|
// Pass it to rxjs subscriber
|
|
3786
3875
|
if (!isEditInProgress) {
|
|
3787
3876
|
scrollSubscriber.next(scrollPosition);
|
|
@@ -3893,6 +3982,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3893
3982
|
getCellData,
|
|
3894
3983
|
]);
|
|
3895
3984
|
const { chartComponents, embedComponents, slicerComponents, contextMenuComponent: embedContextMenuComponent, onMouseDown: onMouseDownCharts, requestChartContextMenu, selectAllObjects: selectAllObjectsUnstable, } = useEmbedsCharts({
|
|
3985
|
+
pageLayout,
|
|
3896
3986
|
getLinkedPictureSource,
|
|
3897
3987
|
getSheetName,
|
|
3898
3988
|
charts,
|
|
@@ -3912,7 +4002,7 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
3912
4002
|
selectedColor: chartSelectedColor,
|
|
3913
4003
|
onMoveChart,
|
|
3914
4004
|
onResizeChart,
|
|
3915
|
-
chartClipboard,
|
|
4005
|
+
chartClipboard: objectClipboard ? chartClipboard : undefined,
|
|
3916
4006
|
onMoveEmbed,
|
|
3917
4007
|
onResizeEmbed,
|
|
3918
4008
|
onDeleteEmbed,
|
|
@@ -4587,15 +4677,19 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4587
4677
|
onChooseFillType: handleChooseFillType,
|
|
4588
4678
|
onOpenFillSeriesDialog: handleOpenFillSeriesDialog,
|
|
4589
4679
|
onCloseFillOptions: handleCloseFillOptions,
|
|
4680
|
+
onFillOptionsOpenChange: handleFillOptionsOpenChange,
|
|
4590
4681
|
insertOptions,
|
|
4591
4682
|
onChooseInsertOption: handleChooseInsertOption,
|
|
4592
4683
|
tableAutoExpansion,
|
|
4593
4684
|
canStopAutoExpandingTables: !!onChangeAutoExpandTables,
|
|
4685
|
+
canUndoTableAutoExpansion: !!onUndoTableAutoExpansion,
|
|
4594
4686
|
onChooseTableAutoExpansionOption: handleChooseTableAutoExpansionOption,
|
|
4595
4687
|
flashFillOptions,
|
|
4596
4688
|
onChooseFlashFillOption: handleChooseFlashFillOption,
|
|
4597
4689
|
calculatedColumnFill,
|
|
4598
4690
|
canStopAutoCalculatedColumns: !!onChangeAutoCalculatedColumns,
|
|
4691
|
+
canUndoCalculatedColumn: !!onUndoCalculatedColumn,
|
|
4692
|
+
canOverwriteCalculatedColumn: !!onOverwriteCalculatedColumn,
|
|
4599
4693
|
onChooseCalculatedColumnOption: handleChooseCalculatedColumnOption,
|
|
4600
4694
|
errorCheck: activeErrorCheckTag,
|
|
4601
4695
|
errorCheckMenuOpen,
|
|
@@ -4642,13 +4736,50 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
4642
4736
|
const pageBreakBorderStyles = useMemo(() => pageBreakPreview
|
|
4643
4737
|
? getPageBreakPreviewStyles(pageBreakPreview, rowCount, columnCount)
|
|
4644
4738
|
: getPageBreakBorderStyles(pageLayout ? undefined : pageBreaks, rowCount, columnCount), [pageBreakPreview, pageBreaks, pageLayout, rowCount, columnCount]);
|
|
4645
|
-
|
|
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
|
|
4646
4771
|
? [
|
|
4647
4772
|
...pageBreakBorderStyles,
|
|
4648
4773
|
...finalBorderStyles,
|
|
4649
4774
|
...chartSourceBorderStyles,
|
|
4775
|
+
...autoCorrectAnchorStyles,
|
|
4650
4776
|
]
|
|
4651
|
-
: finalBorderStyles, [
|
|
4777
|
+
: finalBorderStyles, [
|
|
4778
|
+
finalBorderStyles,
|
|
4779
|
+
chartSourceBorderStyles,
|
|
4780
|
+
pageBreakBorderStyles,
|
|
4781
|
+
autoCorrectAnchorStyles,
|
|
4782
|
+
]);
|
|
4652
4783
|
// Hidden column markers
|
|
4653
4784
|
const [hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers,] = useHiddenDimensionMarkers({
|
|
4654
4785
|
sheetId,
|
|
@@ -5115,13 +5246,17 @@ function CanvasGridComponent(props, forwardedRef) {
|
|
|
5115
5246
|
: tableHitCursor
|
|
5116
5247
|
? { ...rest.style, cursor: tableHitCursor }
|
|
5117
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 }),
|
|
5118
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" },
|
|
5119
5251
|
React.createElement("div", { className: "space-y-2" },
|
|
5120
5252
|
React.createElement(Skeleton, { className: "h-4 w-[250px]" }),
|
|
5121
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,
|
|
5122
5254
|
// Freeze Panes and Split are mutually exclusive: the grid is told the SHEET's frozen
|
|
5123
5255
|
// counts, not the heading band added above.
|
|
5124
|
-
sheetFrozenRows: frozenRowCount ?? 0, sheetFrozenColumns: frozenColumnCount ?? 0, activeCell: activeCell, selections: formulaMode ? formulaSelections : selections, FillHandle: FillHandle, showFillHandle: showFillHandle,
|
|
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,
|
|
5125
5260
|
// Dimension of fill handle
|
|
5126
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 })),
|
|
5127
5262
|
React.createElement(RtlMirrorLayer, { rightToLeft: rightToLeft }, tooltipComponent),
|
|
@@ -13,6 +13,7 @@ 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";
|
|
@@ -418,6 +419,14 @@ 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
|
|
@@ -1319,6 +1328,22 @@ export type CanvasGridProps<T extends CellData = CellData<any, any>> = {
|
|
|
1319
1328
|
*/
|
|
1320
1329
|
onCutChart?(chartId: string | number): void;
|
|
1321
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">;
|
|
1322
1347
|
/**
|
|
1323
1348
|
* Fired when user moves a chart
|
|
1324
1349
|
* @param anchorCell
|