@rowsncolumns/spreadsheet 10.6.5 → 10.7.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/autocomplete.d.ts +42 -0
- package/dist/cjs/api/autocomplete.d.ts.map +1 -0
- package/dist/cjs/api/autocomplete.js +114 -0
- package/dist/cjs/api/banded-ranges.d.ts.map +1 -1
- package/dist/cjs/api/banded-ranges.js +51 -1
- package/dist/cjs/api/error-checking.d.ts +82 -0
- package/dist/cjs/api/error-checking.d.ts.map +1 -0
- package/dist/cjs/api/error-checking.js +207 -0
- package/dist/cjs/api/move-overwrite.d.ts +8 -2
- package/dist/cjs/api/move-overwrite.d.ts.map +1 -1
- package/dist/cjs/api/move-overwrite.js +19 -3
- package/dist/cjs/api/selections.d.ts +2 -2
- package/dist/cjs/api/validation.d.ts +39 -1
- package/dist/cjs/api/validation.d.ts.map +1 -1
- package/dist/cjs/api/validation.js +87 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/cjs/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/enter-key-direction.atom.js +13 -0
- package/dist/cjs/atoms/index.d.ts +1 -0
- package/dist/cjs/atoms/index.d.ts.map +1 -1
- package/dist/cjs/atoms/index.js +1 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/cjs/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/paste-menu.atom.js +13 -1
- package/dist/cjs/atoms/pick-list.atom.d.ts +15 -0
- package/dist/cjs/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/cjs/atoms/pick-list.atom.js +7 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +305 -70
- package/dist/cjs/components/canvas-grid/typings.d.ts +96 -11
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.d.ts.map +1 -1
- package/dist/cjs/components/cell/index.js +7 -8
- package/dist/cjs/components/cell/typings.d.ts +9 -0
- package/dist/cjs/components/cell/typings.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.d.ts +22 -2
- package/dist/cjs/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/helpers.js +32 -8
- package/dist/cjs/components/cell-editor/index.d.ts +7 -1
- package/dist/cjs/components/cell-editor/index.d.ts.map +1 -1
- package/dist/cjs/components/cell-editor/index.js +85 -13
- package/dist/cjs/components/cell-indicator/index.d.ts +41 -0
- package/dist/cjs/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/cjs/components/cell-indicator/index.js +90 -0
- package/dist/cjs/components/cell-input/cell-input.d.ts +10 -2
- package/dist/cjs/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/cell-input.js +5 -3
- package/dist/cjs/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/cjs/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/cjs/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline-math.js +48 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/cjs/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/cjs/components/cell-structured/sparkline.js +36 -92
- package/dist/cjs/components/cell-structured/types.d.ts +6 -0
- package/dist/cjs/components/cell-structured/types.d.ts.map +1 -1
- package/dist/cjs/components/data-table-dialog/index.d.ts +22 -0
- package/dist/cjs/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/data-table-dialog/index.js +93 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/cjs/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/cjs/components/error-check-smart-tag/index.js +39 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/forecast-sheet-dialog/index.js +92 -0
- package/dist/cjs/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/cjs/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/paste-special-dialog/index.js +61 -23
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +196 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/cjs/components/protect-sheet-dialog/constants.js +5 -0
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/cjs/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/protect-sheet-dialog/index.js +5 -3
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/cjs/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/scenario-manager-dialog/index.js +257 -0
- 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 +9 -4
- package/dist/cjs/components/selection/paste-menu.d.ts +14 -1
- package/dist/cjs/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/cjs/components/selection/paste-menu.js +78 -6
- package/dist/cjs/components/selection/paste-options.d.ts +28 -0
- package/dist/cjs/components/selection/paste-options.d.ts.map +1 -0
- package/dist/cjs/components/selection/paste-options.js +70 -0
- package/dist/cjs/components/selection/types.d.ts +12 -1
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- package/dist/cjs/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/cjs/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/cjs/components/selection-drop-menu/index.js +62 -0
- package/dist/cjs/components/solver-dialog/index.d.ts +57 -0
- package/dist/cjs/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/cjs/components/solver-dialog/index.js +204 -0
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/cjs/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/sparkline-actions.js +6 -2
- package/dist/cjs/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/cjs/components/toolbar/table-style-selector.js +33 -2
- package/dist/cjs/config.d.ts +5 -4
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +13 -9
- package/dist/cjs/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/cjs/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-cell-renderer.js +6 -3
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/cjs/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/cjs/hooks/use-copy-paste-cut.js +131 -5
- package/dist/cjs/hooks/use-editable.d.ts +6 -0
- package/dist/cjs/hooks/use-editable.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.d.ts +45 -3
- package/dist/cjs/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/cjs/hooks/use-editor-submit.js +91 -7
- package/dist/cjs/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/cjs/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/cjs/hooks/use-keyboard-handler.js +10 -1
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/cjs/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/cjs/hooks/use-selection-drag-copy.js +274 -0
- package/dist/cjs/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +7 -2
- package/dist/cjs/hooks/use-selection.d.ts +59 -1
- package/dist/cjs/hooks/use-selection.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection.js +270 -61
- package/dist/cjs/index.d.ts +6 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +50 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/autocomplete.d.ts +42 -0
- package/dist/esm/api/autocomplete.d.ts.map +1 -0
- package/dist/esm/api/autocomplete.js +91 -0
- package/dist/esm/api/banded-ranges.d.ts.map +1 -1
- package/dist/esm/api/banded-ranges.js +52 -2
- package/dist/esm/api/error-checking.d.ts +82 -0
- package/dist/esm/api/error-checking.d.ts.map +1 -0
- package/dist/esm/api/error-checking.js +156 -0
- package/dist/esm/api/move-overwrite.d.ts +8 -2
- package/dist/esm/api/move-overwrite.d.ts.map +1 -1
- package/dist/esm/api/move-overwrite.js +17 -2
- package/dist/esm/api/selections.d.ts +2 -2
- package/dist/esm/api/validation.d.ts +39 -1
- package/dist/esm/api/validation.d.ts.map +1 -1
- package/dist/esm/api/validation.js +70 -0
- package/dist/esm/atoms/cell-input-context.atom.d.ts +4 -1
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/enter-key-direction.atom.d.ts +11 -0
- package/dist/esm/atoms/enter-key-direction.atom.d.ts.map +1 -0
- package/dist/esm/atoms/enter-key-direction.atom.js +8 -0
- package/dist/esm/atoms/index.d.ts +1 -0
- package/dist/esm/atoms/index.d.ts.map +1 -1
- package/dist/esm/atoms/index.js +1 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts +22 -0
- package/dist/esm/atoms/paste-menu.atom.d.ts.map +1 -1
- package/dist/esm/atoms/paste-menu.atom.js +10 -1
- package/dist/esm/atoms/pick-list.atom.d.ts +15 -0
- package/dist/esm/atoms/pick-list.atom.d.ts.map +1 -0
- package/dist/esm/atoms/pick-list.atom.js +3 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +239 -13
- package/dist/esm/components/canvas-grid/typings.d.ts +96 -11
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/cell/index.d.ts.map +1 -1
- package/dist/esm/components/cell/index.js +8 -9
- package/dist/esm/components/cell/typings.d.ts +9 -0
- package/dist/esm/components/cell/typings.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.d.ts +22 -2
- package/dist/esm/components/cell-editor/helpers.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/helpers.js +25 -7
- package/dist/esm/components/cell-editor/index.d.ts +7 -1
- package/dist/esm/components/cell-editor/index.d.ts.map +1 -1
- package/dist/esm/components/cell-editor/index.js +80 -9
- package/dist/esm/components/cell-indicator/index.d.ts +41 -0
- package/dist/esm/components/cell-indicator/index.d.ts.map +1 -0
- package/dist/esm/components/cell-indicator/index.js +76 -0
- package/dist/esm/components/cell-input/cell-input.d.ts +10 -2
- package/dist/esm/components/cell-input/cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/cell-input.js +5 -3
- package/dist/esm/components/cell-input/formula-bar-cell-input.d.ts.map +1 -1
- package/dist/esm/components/cell-input/formula-bar-cell-input.js +9 -2
- package/dist/esm/components/cell-structured/sparkline-math.d.ts +27 -1
- package/dist/esm/components/cell-structured/sparkline-math.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline-math.js +35 -0
- package/dist/esm/components/cell-structured/sparkline.d.ts +1 -1
- package/dist/esm/components/cell-structured/sparkline.d.ts.map +1 -1
- package/dist/esm/components/cell-structured/sparkline.js +34 -88
- package/dist/esm/components/cell-structured/types.d.ts +6 -0
- package/dist/esm/components/cell-structured/types.d.ts.map +1 -1
- package/dist/esm/components/data-table-dialog/index.d.ts +22 -0
- package/dist/esm/components/data-table-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/data-table-dialog/index.js +75 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts +27 -0
- package/dist/esm/components/error-check-smart-tag/index.d.ts.map +1 -0
- package/dist/esm/components/error-check-smart-tag/index.js +33 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts +26 -0
- package/dist/esm/components/forecast-sheet-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/forecast-sheet-dialog/index.js +83 -0
- package/dist/esm/components/paste-special-dialog/index.d.ts +3 -3
- package/dist/esm/components/paste-special-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/paste-special-dialog/index.js +58 -23
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts +57 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/allow-edit-ranges-dialog.js +177 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts +3 -0
- package/dist/esm/components/protect-sheet-dialog/constants.d.ts.map +1 -0
- package/dist/esm/components/protect-sheet-dialog/constants.js +2 -0
- package/dist/esm/components/protect-sheet-dialog/index.d.ts +2 -2
- package/dist/esm/components/protect-sheet-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/protect-sheet-dialog/index.js +3 -2
- package/dist/esm/components/scenario-manager-dialog/index.d.ts +51 -0
- package/dist/esm/components/scenario-manager-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/scenario-manager-dialog/index.js +213 -0
- 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 +9 -4
- package/dist/esm/components/selection/paste-menu.d.ts +14 -1
- package/dist/esm/components/selection/paste-menu.d.ts.map +1 -1
- package/dist/esm/components/selection/paste-menu.js +76 -8
- package/dist/esm/components/selection/paste-options.d.ts +28 -0
- package/dist/esm/components/selection/paste-options.d.ts.map +1 -0
- package/dist/esm/components/selection/paste-options.js +62 -0
- package/dist/esm/components/selection/types.d.ts +12 -1
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- package/dist/esm/components/selection-drop-menu/index.d.ts +18 -0
- package/dist/esm/components/selection-drop-menu/index.d.ts.map +1 -0
- package/dist/esm/components/selection-drop-menu/index.js +56 -0
- package/dist/esm/components/solver-dialog/index.d.ts +57 -0
- package/dist/esm/components/solver-dialog/index.d.ts.map +1 -0
- package/dist/esm/components/solver-dialog/index.js +176 -0
- package/dist/esm/components/toolbar/sparkline-actions.d.ts +3 -2
- package/dist/esm/components/toolbar/sparkline-actions.d.ts.map +1 -1
- package/dist/esm/components/toolbar/sparkline-actions.js +6 -2
- package/dist/esm/components/toolbar/table-style-selector.d.ts.map +1 -1
- package/dist/esm/components/toolbar/table-style-selector.js +29 -3
- package/dist/esm/config.d.ts +5 -4
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +12 -8
- package/dist/esm/hooks/use-cell-renderer.d.ts +12 -1
- package/dist/esm/hooks/use-cell-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-cell-renderer.js +5 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts +36 -2
- package/dist/esm/hooks/use-copy-paste-cut.d.ts.map +1 -1
- package/dist/esm/hooks/use-copy-paste-cut.js +117 -6
- package/dist/esm/hooks/use-editable.d.ts +6 -0
- package/dist/esm/hooks/use-editable.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.d.ts +45 -3
- package/dist/esm/hooks/use-editor-submit.d.ts.map +1 -1
- package/dist/esm/hooks/use-editor-submit.js +81 -6
- package/dist/esm/hooks/use-keyboard-handler.d.ts +5 -1
- package/dist/esm/hooks/use-keyboard-handler.d.ts.map +1 -1
- package/dist/esm/hooks/use-keyboard-handler.js +10 -1
- package/dist/esm/hooks/use-selection-drag-copy.d.ts +55 -0
- package/dist/esm/hooks/use-selection-drag-copy.d.ts.map +1 -0
- package/dist/esm/hooks/use-selection-drag-copy.js +245 -0
- package/dist/esm/hooks/use-selection-renderer.d.ts +8 -1
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +7 -2
- package/dist/esm/hooks/use-selection.d.ts +59 -1
- package/dist/esm/hooks/use-selection.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection.js +245 -52
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +50 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +6 -5
- package/dist/cjs/components/cell-error/index.d.ts +0 -14
- package/dist/cjs/components/cell-error/index.d.ts.map +0 -1
- package/dist/cjs/components/cell-error/index.js +0 -24
- package/dist/esm/components/cell-error/index.d.ts +0 -14
- package/dist/esm/components/cell-error/index.d.ts.map +0 -1
- package/dist/esm/components/cell-error/index.js +0 -18
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CellInterface, SelectionArea } from "@rowsncolumns/grid";
|
|
2
2
|
import type { CanvasGridProps } from "../components/canvas-grid/typings";
|
|
3
|
+
import { type PasteOptionId } from "../components/selection/paste-options";
|
|
3
4
|
export type UseCopyPasteCutProps = {
|
|
4
5
|
/**
|
|
5
6
|
* Active sheet Id
|
|
@@ -33,6 +34,11 @@ export type UseCopyPasteCutProps = {
|
|
|
33
34
|
* Callback when user cuts a selection or cell
|
|
34
35
|
*/
|
|
35
36
|
onCut: CanvasGridProps["onCut"];
|
|
37
|
+
/**
|
|
38
|
+
* Re-apply the last paste in another mode (the Paste Options button). The
|
|
39
|
+
* Paste Options gallery is offered only when this is given.
|
|
40
|
+
*/
|
|
41
|
+
onReapplyPaste?: CanvasGridProps["onReapplyPaste"];
|
|
36
42
|
};
|
|
37
43
|
export type PasteSpecialType = "Transposed" | "Formatting" | "Value" | "Formula" | "Link";
|
|
38
44
|
/** Excel Paste Special → Operation: combine each pasted cell with the cell it lands on. */
|
|
@@ -47,14 +53,41 @@ export type PasteSpecialOperation = "add" | "subtract" | "multiply" | "divide";
|
|
|
47
53
|
* the same fields.
|
|
48
54
|
*/
|
|
49
55
|
export type PasteSpecialOptions = {
|
|
50
|
-
paste?:
|
|
56
|
+
paste?: PasteSpecialMode;
|
|
51
57
|
operation?: PasteSpecialOperation;
|
|
52
58
|
skipBlanks?: boolean;
|
|
53
59
|
transpose?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Paste Options ▸ Keep Source Column Widths: paste as `paste` says and give
|
|
62
|
+
* each destination column the width of the column it was copied from.
|
|
63
|
+
*/
|
|
64
|
+
keepSourceColumnWidths?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Paste Link: every destination cell becomes a relative reference to the
|
|
67
|
+
* copied cell it stands for (`=A1`, `=Sheet2!A1`, `='My Sheet'!A1`). Only
|
|
68
|
+
* after a copy — Excel greys it out after a cut.
|
|
69
|
+
*/
|
|
70
|
+
link?: boolean;
|
|
54
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* What a Paste Special pastes — Excel's Paste Special dialog's "Paste" group
|
|
74
|
+
* plus the Paste Options gallery's composites:
|
|
75
|
+
* - `all` / `formulas` / `values` / `formats`
|
|
76
|
+
* - `formulasAndNumberFormats` / `valuesAndNumberFormats`: formulas or values
|
|
77
|
+
* with only the source number formats
|
|
78
|
+
* - `valuesAndSourceFormatting`: values with every source format
|
|
79
|
+
* - `allExceptBorders`: everything but the source borders (the destination's
|
|
80
|
+
* borders stay)
|
|
81
|
+
* - `allUsingSourceTheme` / `allMergingConditionalFormats`: `all` (one theme
|
|
82
|
+
* per workbook; conditional formats are the destination's)
|
|
83
|
+
* - `columnWidths`: only the source column widths
|
|
84
|
+
* - `commentsAndNotes`: only the notes
|
|
85
|
+
* - `validation`: only the data validation rules
|
|
86
|
+
*/
|
|
87
|
+
export type PasteSpecialMode = "all" | "values" | "formulas" | "formats" | "formulasAndNumberFormats" | "valuesAndNumberFormats" | "valuesAndSourceFormatting" | "allExceptBorders" | "allUsingSourceTheme" | "allMergingConditionalFormats" | "columnWidths" | "commentsAndNotes" | "validation";
|
|
55
88
|
/** Argument accepted by `paste()` — a legacy single mode or the full dialog request. */
|
|
56
89
|
export type PasteSpecialRequest = PasteSpecialType | PasteSpecialOptions;
|
|
57
|
-
export declare const useCopyPasteCut: ({ selections, activeCell, sheetId, readonly, onPaste, onCopy, onCut, focusSheet, }: UseCopyPasteCutProps) => {
|
|
90
|
+
export declare const useCopyPasteCut: ({ selections, activeCell, sheetId, readonly, onPaste, onCopy, onCut, onReapplyPaste, focusSheet, }: UseCopyPasteCutProps) => {
|
|
58
91
|
selections: SelectionArea[];
|
|
59
92
|
copy: () => void;
|
|
60
93
|
cut: () => void;
|
|
@@ -69,5 +102,6 @@ export declare const useCopyPasteCut: ({ selections, activeCell, sheetId, readon
|
|
|
69
102
|
onInternalCopy: (e: ClipboardEvent, isCutOperation?: boolean) => boolean;
|
|
70
103
|
onInternalPaste: (e: ClipboardEvent) => void;
|
|
71
104
|
onInternalCut: (e: ClipboardEvent) => void;
|
|
105
|
+
choosePasteOption: (optionId: PasteOptionId) => Promise<void>;
|
|
72
106
|
};
|
|
73
107
|
//# sourceMappingURL=use-copy-paste-cut.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-copy-paste-cut.d.ts","sourceRoot":"","sources":["../../../hooks/use-copy-paste-cut.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-copy-paste-cut.d.ts","sourceRoot":"","sources":["../../../hooks/use-copy-paste-cut.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EA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GACL,QAAQ,GACR,UAAU,GACV,SAAS,GACT,0BAA0B,GAC1B,wBAAwB,GACxB,2BAA2B,GAC3B,kBAAkB,GAClB,qBAAqB,GACrB,8BAA8B,GAC9B,cAAc,GACd,kBAAkB,GAClB,YAAY,CAAC;AAEjB,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEzE,eAAO,MAAM,eAAe,GAAI,oGAU7B,oBAAoB;;;;2BA0YG,mBAAmB;;IA4DzC,wEAAwE;;IAExE,kDAAkD;;;;wBA1R9C,cAAc;yBA8Dd,cAAc;uBA3Bd,cAAc;kCA8HD,aAAa;CAkIjC,CAAC"}
|
|
@@ -3,11 +3,39 @@ import { getHotkeyKey } from "@rowsncolumns/utils";
|
|
|
3
3
|
import { useCallback, useRef, useState } from "react";
|
|
4
4
|
import { createSelectionFromCell } from "../api/copy-paste";
|
|
5
5
|
import { isSelectionACell } from "../api/selections";
|
|
6
|
-
import { useCellEditorInstance, useGetCellBounds,
|
|
6
|
+
import { useCellEditorInstance, useGetCellBounds, usePasteMenuState, useShowPasteMenu, } from "../atoms";
|
|
7
|
+
import { PASTE_OPTIONS, pasteOptionForRequest, } from "../components/selection/paste-options";
|
|
7
8
|
import { DEFAULT_ARRAY } from "../config";
|
|
8
9
|
import { useCallbackRef } from "./use-callback-ref";
|
|
9
10
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect";
|
|
10
|
-
|
|
11
|
+
/** The Paste Special request a paste event carries on its synthetic clipboard keys. */
|
|
12
|
+
const pasteRequestOf = (e) => {
|
|
13
|
+
const data = e.clipboardData;
|
|
14
|
+
if (!data)
|
|
15
|
+
return undefined;
|
|
16
|
+
const json = data.getData("pasteSpecialOptions");
|
|
17
|
+
if (json) {
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(json);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const legacy = data.getData("pasteSpecialType");
|
|
26
|
+
if (!legacy)
|
|
27
|
+
return undefined;
|
|
28
|
+
const LEGACY = {
|
|
29
|
+
Transposed: { transpose: true },
|
|
30
|
+
Formatting: { paste: "formats" },
|
|
31
|
+
Formula: { paste: "formulas" },
|
|
32
|
+
Value: { paste: "values" },
|
|
33
|
+
Link: { link: true },
|
|
34
|
+
};
|
|
35
|
+
return LEGACY[legacy];
|
|
36
|
+
};
|
|
37
|
+
const MODIFIER_KEYS = new Set(["Control", "Shift", "Alt", "Meta", "OS"]);
|
|
38
|
+
export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = false, onPaste, onCopy, onCut, onReapplyPaste, focusSheet, }) => {
|
|
11
39
|
const cellEditorInstance = useCellEditorInstance();
|
|
12
40
|
const getCellBounds = useGetCellBounds();
|
|
13
41
|
const [copiedSelections, setCopiedSelections] = useState(DEFAULT_ARRAY);
|
|
@@ -31,7 +59,13 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
31
59
|
const selectionsRef = useRef(undefined);
|
|
32
60
|
const lastPasteModifiersRef = useRef(null);
|
|
33
61
|
// Set paste menu
|
|
34
|
-
const setShowPasteMenu =
|
|
62
|
+
const [showPasteMenu, setShowPasteMenu] = useShowPasteMenu();
|
|
63
|
+
const [pasteMenuState, setPasteMenuState] = usePasteMenuState();
|
|
64
|
+
const onReapplyPasteRef = useCallbackRef(onReapplyPaste);
|
|
65
|
+
const hasReapplyPaste = Boolean(onReapplyPaste);
|
|
66
|
+
// Ctrl pressed and released with no other key in between (Excel opens the
|
|
67
|
+
// Paste Options gallery on Ctrl alone after a paste).
|
|
68
|
+
const ctrlAloneRef = useRef(false);
|
|
35
69
|
const getSelectionsFromCells = useCallback((activeCell, selections) => {
|
|
36
70
|
const lastSelection = selections[selections.length - 1];
|
|
37
71
|
if (!lastSelection) {
|
|
@@ -65,6 +99,13 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
65
99
|
// The cell editor lives in the grid's document, which may be a popout window
|
|
66
100
|
const ownerDocument = getOwnerDocument(cellEditorInstance?.el()) ?? document;
|
|
67
101
|
const handleKeyDown = (e) => {
|
|
102
|
+
if (e.key === "Control") {
|
|
103
|
+
ctrlAloneRef.current =
|
|
104
|
+
!e.repeat && !e.shiftKey && !e.altKey && !e.metaKey;
|
|
105
|
+
}
|
|
106
|
+
else if (!MODIFIER_KEYS.has(e.key)) {
|
|
107
|
+
ctrlAloneRef.current = false;
|
|
108
|
+
}
|
|
68
109
|
if (!e.key || getHotkeyKey(e) !== "v") {
|
|
69
110
|
return;
|
|
70
111
|
}
|
|
@@ -78,9 +119,48 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
78
119
|
time: Date.now(),
|
|
79
120
|
};
|
|
80
121
|
};
|
|
81
|
-
ownerDocument.addEventListener("keydown", handleKeyDown);
|
|
82
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown);
|
|
122
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, true);
|
|
123
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, true);
|
|
83
124
|
}, [cellEditorInstance]);
|
|
125
|
+
// While the Paste Options button shows: Ctrl alone opens its gallery, and
|
|
126
|
+
// any other key but navigation (typing, editing, another shortcut)
|
|
127
|
+
// dismisses the button, as Excel does once the paste is no longer the last
|
|
128
|
+
// action. A Ctrl+V shows it again for the new paste.
|
|
129
|
+
useIsomorphicLayoutEffect(() => {
|
|
130
|
+
if (!canUseDOM || !showPasteMenu || pasteMenuState.open) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const ownerDocument = getOwnerDocument(cellEditorInstance?.el()) ?? document;
|
|
134
|
+
const handleKeyUp = (e) => {
|
|
135
|
+
if (e.key !== "Control" || !ctrlAloneRef.current)
|
|
136
|
+
return;
|
|
137
|
+
ctrlAloneRef.current = false;
|
|
138
|
+
if (!hasReapplyPaste)
|
|
139
|
+
return;
|
|
140
|
+
setPasteMenuState((prev) => prev.canReapply ? { ...prev, open: true } : prev);
|
|
141
|
+
};
|
|
142
|
+
const handleKeyDown = (e) => {
|
|
143
|
+
if (MODIFIER_KEYS.has(e.key))
|
|
144
|
+
return;
|
|
145
|
+
if (/^(Arrow|Page|Home|End|Tab|Escape)/.test(e.key))
|
|
146
|
+
return;
|
|
147
|
+
setShowPasteMenu(false);
|
|
148
|
+
};
|
|
149
|
+
// Capture phase: the grid's own shortcuts stop propagation.
|
|
150
|
+
ownerDocument.addEventListener("keyup", handleKeyUp, true);
|
|
151
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, true);
|
|
152
|
+
return () => {
|
|
153
|
+
ownerDocument.removeEventListener("keyup", handleKeyUp, true);
|
|
154
|
+
ownerDocument.removeEventListener("keydown", handleKeyDown, true);
|
|
155
|
+
};
|
|
156
|
+
}, [
|
|
157
|
+
cellEditorInstance,
|
|
158
|
+
showPasteMenu,
|
|
159
|
+
pasteMenuState.open,
|
|
160
|
+
hasReapplyPaste,
|
|
161
|
+
setPasteMenuState,
|
|
162
|
+
setShowPasteMenu,
|
|
163
|
+
]);
|
|
84
164
|
// Clear selections in clipboard
|
|
85
165
|
const clearCopiedSelections = useCallback(() => {
|
|
86
166
|
// User has not copied any selections yet
|
|
@@ -179,7 +259,17 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
179
259
|
true;
|
|
180
260
|
}
|
|
181
261
|
onPasteRef?.(e, sourceSheetId, destinationSheetId, initialCopiedSelectionRef.current, activeCellRef.current, currentSelections, finalSelections, isCutOperation.current);
|
|
182
|
-
// Show paste menu
|
|
262
|
+
// Show paste menu. Its gallery re-applies a copied paste; a cut is a
|
|
263
|
+
// move (Excel offers no Paste Options after one), and pasted files
|
|
264
|
+
// can't be pasted again in another mode.
|
|
265
|
+
const isCut = isCutOperation.current;
|
|
266
|
+
const hasFiles = Boolean(e.clipboardData?.files?.length);
|
|
267
|
+
setPasteMenuState({
|
|
268
|
+
open: false,
|
|
269
|
+
active: pasteOptionForRequest(pasteRequestOf(e)),
|
|
270
|
+
canReapply: hasReapplyPaste && !isCut && !hasFiles,
|
|
271
|
+
canLink: !isCut && Boolean(initialCopiedSelectionRef.current?.length),
|
|
272
|
+
});
|
|
183
273
|
setShowPasteMenu(true);
|
|
184
274
|
/* Clear copied selections */
|
|
185
275
|
clearCopiedSelections();
|
|
@@ -199,7 +289,27 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
199
289
|
readonly,
|
|
200
290
|
sheetId,
|
|
201
291
|
setShowPasteMenu,
|
|
292
|
+
setPasteMenuState,
|
|
293
|
+
hasReapplyPaste,
|
|
202
294
|
]);
|
|
295
|
+
/**
|
|
296
|
+
* Paste Options gallery: re-apply the last paste as `option`, replacing
|
|
297
|
+
* what it pasted (the host undoes the previous paste and pastes again, so
|
|
298
|
+
* the paste stays one undo step).
|
|
299
|
+
*/
|
|
300
|
+
const choosePasteOption = useCallback(async (optionId) => {
|
|
301
|
+
const option = PASTE_OPTIONS.find((entry) => entry.id === optionId);
|
|
302
|
+
if (!option)
|
|
303
|
+
return;
|
|
304
|
+
setPasteMenuState((prev) => ({ ...prev, open: false }));
|
|
305
|
+
const applied = await onReapplyPasteRef?.(option.request);
|
|
306
|
+
if (applied === false) {
|
|
307
|
+
setShowPasteMenu(false);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
setPasteMenuState((prev) => ({ ...prev, active: optionId }));
|
|
311
|
+
focusSheet();
|
|
312
|
+
}, [onReapplyPasteRef, setPasteMenuState, setShowPasteMenu, focusSheet]);
|
|
203
313
|
// From contextmenu
|
|
204
314
|
const copy = useCallback(() => {
|
|
205
315
|
const editorEl = cellEditorInstance?.el?.();
|
|
@@ -296,5 +406,6 @@ export const useCopyPasteCut = ({ selections, activeCell, sheetId, readonly = fa
|
|
|
296
406
|
onInternalCopy: handleCopy,
|
|
297
407
|
onInternalPaste: handlePaste,
|
|
298
408
|
onInternalCut: handleCut,
|
|
409
|
+
choosePasteOption,
|
|
299
410
|
};
|
|
300
411
|
};
|
|
@@ -40,6 +40,12 @@ export type EditorSubmitOptions = {
|
|
|
40
40
|
* single cell this is a plain in-place commit (no move down).
|
|
41
41
|
*/
|
|
42
42
|
fillSelection?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Ctrl+Shift+Enter (Excel; Mac ⇧⌘Return / ⌃⇧Return): commit a formula as ONE legacy array
|
|
45
|
+
* over the selection holding the active cell (or the array being re-entered), keeping the
|
|
46
|
+
* active cell and the selection where they are.
|
|
47
|
+
*/
|
|
48
|
+
arrayFormula?: boolean;
|
|
43
49
|
};
|
|
44
50
|
export type UseEditableOptions<T extends CellData> = {
|
|
45
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-editable.d.ts","sourceRoot":"","sources":["../../../hooks/use-editable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAIzE,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;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;;4BArdZ,MAAM,QACT,aAAa,iBACJ,MAAM,YACX,mBAAmB;wBAi5BpB,MAAM,QACT,aAAa,iBACJ,MAAM,YACX,mBAAmB;+BApJnB,MAAM,kBACA,aAAa,EAAE,GAAG,SAAS,WAClC,MAAM,cACH,aAAa;;;6BAtKf,MAAM,kBACA,aAAa,EAAE,GAAG,SAAS,GAAG,IAAI,WACzC,MAAM,cACH,aAAa,kBACT,aAAa,GAAG,IAAI,GAAG,SAAS,uCAEtC,mBAAmB;uBA0D1B,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;uBA0B1B,mBAAmB,KAAG,OAAO;qBA0BrC,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC;mBA9ctE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC;CAorB1C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DataValidationRuleAlert } from "@rowsncolumns/common-types";
|
|
1
|
+
import type { CellFormat, DataValidationRuleAlert } from "@rowsncolumns/common-types";
|
|
2
2
|
import type { CellInterface, GridRange, SelectionArea } from "@rowsncolumns/grid";
|
|
3
3
|
import type { TextFormatRun } from "@rowsncolumns/ui";
|
|
4
|
-
import { type FormulaLocale } from "@rowsncolumns/utils";
|
|
4
|
+
import { type AutoCorrectOptions, type FormulaLocale } from "@rowsncolumns/utils";
|
|
5
5
|
import type { ValidationAlertRequest } from "../atoms/validation-alert.atom";
|
|
6
6
|
import type { CanvasGridProps, SelectionAttributes } from "../components/canvas-grid/typings";
|
|
7
7
|
import type { EditorSubmitOptions } from "./use-editable";
|
|
@@ -24,6 +24,24 @@ export declare const entryValueForCell: (value: EntryValue, activeCell: CellInte
|
|
|
24
24
|
* selected — a single-cell Ctrl+Enter is just an in-place commit.
|
|
25
25
|
*/
|
|
26
26
|
export declare const planEntryFill: (value: EntryValue, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[]) => EntryFillWrite[];
|
|
27
|
+
/**
|
|
28
|
+
* The range a Ctrl+Shift+Enter commit at `activeCell` enters its array over (Excel): the selection
|
|
29
|
+
* holding the active cell; with nothing but the active cell selected, the CSE array it already
|
|
30
|
+
* belongs to (`existing` — editing any cell of an array and pressing Ctrl+Shift+Enter re-enters
|
|
31
|
+
* the whole array), else the active cell alone.
|
|
32
|
+
*/
|
|
33
|
+
export declare const planArrayFormulaRange: (activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[], existing?: GridRange) => GridRange;
|
|
34
|
+
/**
|
|
35
|
+
* Whether committing `value` turns Wrap Text on (Excel: an entry typed with a line break, Alt+Enter /
|
|
36
|
+
* ⌥Return, shows every line — "Start a new line of text inside a cell", support.microsoft.com). A
|
|
37
|
+
* formula's text breaks are its own, an unchanged entry is not a new one, and a cell that wraps
|
|
38
|
+
* already keeps its format.
|
|
39
|
+
*/
|
|
40
|
+
export declare const entryTurnsOnWrap: ({ value, previousValue, format, }: {
|
|
41
|
+
value: EntryValue;
|
|
42
|
+
previousValue: EntryValue | undefined | null;
|
|
43
|
+
format: CellFormat | null | undefined;
|
|
44
|
+
}) => boolean;
|
|
27
45
|
/**
|
|
28
46
|
* Commit-time data-validation enforcement decision for a value about to be
|
|
29
47
|
* written. `block` rejects the value (Excel `errorStyle="stop"`); `confirm`
|
|
@@ -76,6 +94,15 @@ type UseEditorSubmitProps = {
|
|
|
76
94
|
* as its own command; without a batcher each is its own undo step.
|
|
77
95
|
*/
|
|
78
96
|
batchHistory?: CanvasGridProps["batchHistory"];
|
|
97
|
+
/**
|
|
98
|
+
* Ctrl+Shift+Enter: enter a formula as one legacy CSE array over a range
|
|
99
|
+
* (`options.arrayFormula`). Without it the key commits like Ctrl+Enter.
|
|
100
|
+
*/
|
|
101
|
+
onChangeArrayFormula?: CanvasGridProps["onChangeArrayFormula"];
|
|
102
|
+
/**
|
|
103
|
+
* The CSE array a cell already belongs to — the range a Ctrl+Shift+Enter from inside it re-enters.
|
|
104
|
+
*/
|
|
105
|
+
getArrayFormula?: CanvasGridProps["getArrayFormula"];
|
|
79
106
|
/**
|
|
80
107
|
* Resolve the data-validation enforcement decision for a value about to be
|
|
81
108
|
* committed at a cell. Returns `undefined` when there is nothing to enforce
|
|
@@ -89,6 +116,21 @@ type UseEditorSubmitProps = {
|
|
|
89
116
|
* the user chose to proceed (or acknowledged a `stop`), `false` to discard.
|
|
90
117
|
*/
|
|
91
118
|
showValidationAlert?: (request: ValidationAlertRequest) => Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* The cell's format as the grid paints it: whether Wrap Text is on already, before a line break
|
|
121
|
+
* typed with Alt+Enter turns it on.
|
|
122
|
+
*/
|
|
123
|
+
getEffectiveFormat?: CanvasGridProps["getEffectiveFormat"];
|
|
124
|
+
/**
|
|
125
|
+
* Turns Wrap Text on for an entry committed with a line break in it (Excel's Alt+Enter), in the
|
|
126
|
+
* same undo entry as the value when `batchHistory` is given.
|
|
127
|
+
*/
|
|
128
|
+
onChangeFormatting?: CanvasGridProps["onChangeFormatting"];
|
|
129
|
+
/**
|
|
130
|
+
* Excel's AutoCorrect on a typed text entry (`applyAutoCorrect`): the first letter of a sentence
|
|
131
|
+
* capitalised and the symbol replacements, each with its switch. Off when omitted.
|
|
132
|
+
*/
|
|
133
|
+
autoCorrect?: AutoCorrectOptions;
|
|
92
134
|
/**
|
|
93
135
|
* The formula locale the editor text is written in. Formulas and typed error values are
|
|
94
136
|
* canonicalized (`=СУММ(1,5;A1)` → `=SUM(1.5,A1)`) before validation, the Ctrl+Enter spread and
|
|
@@ -96,6 +138,6 @@ type UseEditorSubmitProps = {
|
|
|
96
138
|
*/
|
|
97
139
|
formulaLocale?: FormulaLocale;
|
|
98
140
|
};
|
|
99
|
-
export declare const useEditorSubmit: ({ sheetId, onChangeActiveSheet, setActiveCell, onChange, onComplete, getCommitValidation, showValidationAlert, selections, onChangeBatch, batchHistory, formulaLocale, }: UseEditorSubmitProps) => (value: string | boolean, textFormatRuns: TextFormatRun[] | undefined | null, previousValue: string | boolean | undefined | null, editingSheetId: number, activeCell: CellInterface, nextActiveCell?: CellInterface | null, isDirty?: boolean, options?: EditorSubmitOptions) => Promise<void>;
|
|
141
|
+
export declare const useEditorSubmit: ({ sheetId, onChangeActiveSheet, setActiveCell, onChange, onComplete, getCommitValidation, showValidationAlert, selections, onChangeBatch, batchHistory, formulaLocale, onChangeArrayFormula, getArrayFormula, getEffectiveFormat, onChangeFormatting, autoCorrect, }: UseEditorSubmitProps) => (value: string | boolean, textFormatRuns: TextFormatRun[] | undefined | null, previousValue: string | boolean | undefined | null, editingSheetId: number, activeCell: CellInterface, nextActiveCell?: CellInterface | null, isDirty?: boolean, options?: EditorSubmitOptions) => Promise<void>;
|
|
100
142
|
export {};
|
|
101
143
|
//# sourceMappingURL=use-editor-submit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-editor-submit.d.ts","sourceRoot":"","sources":["../../../hooks/use-editor-submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-editor-submit.d.ts","sourceRoot":"","sources":["../../../hooks/use-editor-submit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAEL,KAAK,kBAAkB,EAGvB,KAAK,aAAa,EAEnB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,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,SAAS,GAAG,IAAI,kBAClC,MAAM,cACV,aAAa,mBACR,aAAa,GAAG,IAAI,YAC3B,OAAO,YACP,mBAAmB,kBAuMlC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { balanceFormula, canonicalizeCellInput, formulaToRelativeReference, } from "@rowsncolumns/utils";
|
|
1
|
+
import { applyAutoCorrect, balanceFormula, canonicalizeCellInput, formulaToRelativeReference, } from "@rowsncolumns/utils";
|
|
2
2
|
import { useCallback, useRef } from "react";
|
|
3
3
|
import { useSetActiveEditor } from "../atoms";
|
|
4
4
|
import { useEditingCell } from "../atoms/editing-cell.atom";
|
|
@@ -71,7 +71,45 @@ export const planEntryFill = (value, activeCell, selections) => {
|
|
|
71
71
|
}
|
|
72
72
|
return writes;
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
const rangeContains = (range, cell) => cell.rowIndex >= range.startRowIndex &&
|
|
75
|
+
cell.rowIndex <= range.endRowIndex &&
|
|
76
|
+
cell.columnIndex >= range.startColumnIndex &&
|
|
77
|
+
cell.columnIndex <= range.endColumnIndex;
|
|
78
|
+
/**
|
|
79
|
+
* The range a Ctrl+Shift+Enter commit at `activeCell` enters its array over (Excel): the selection
|
|
80
|
+
* holding the active cell; with nothing but the active cell selected, the CSE array it already
|
|
81
|
+
* belongs to (`existing` — editing any cell of an array and pressing Ctrl+Shift+Enter re-enters
|
|
82
|
+
* the whole array), else the active cell alone.
|
|
83
|
+
*/
|
|
84
|
+
export const planArrayFormulaRange = (activeCell, selections, existing) => {
|
|
85
|
+
const selected = selections.find((s) => rangeContains(s.range, activeCell))?.range;
|
|
86
|
+
if (selected &&
|
|
87
|
+
(selected.startRowIndex !== selected.endRowIndex ||
|
|
88
|
+
selected.startColumnIndex !== selected.endColumnIndex)) {
|
|
89
|
+
return selected;
|
|
90
|
+
}
|
|
91
|
+
if (existing && rangeContains(existing, activeCell)) {
|
|
92
|
+
return existing;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
startRowIndex: activeCell.rowIndex,
|
|
96
|
+
endRowIndex: activeCell.rowIndex,
|
|
97
|
+
startColumnIndex: activeCell.columnIndex,
|
|
98
|
+
endColumnIndex: activeCell.columnIndex,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Whether committing `value` turns Wrap Text on (Excel: an entry typed with a line break, Alt+Enter /
|
|
103
|
+
* ⌥Return, shows every line — "Start a new line of text inside a cell", support.microsoft.com). A
|
|
104
|
+
* formula's text breaks are its own, an unchanged entry is not a new one, and a cell that wraps
|
|
105
|
+
* already keeps its format.
|
|
106
|
+
*/
|
|
107
|
+
export const entryTurnsOnWrap = ({ value, previousValue, format, }) => typeof value === "string" &&
|
|
108
|
+
!value.startsWith("=") &&
|
|
109
|
+
value.includes("\n") &&
|
|
110
|
+
value !== previousValue &&
|
|
111
|
+
format?.wrapStrategy !== "wrap";
|
|
112
|
+
export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, onChange, onComplete, getCommitValidation, showValidationAlert, selections, onChangeBatch, batchHistory, formulaLocale, onChangeArrayFormula, getArrayFormula, getEffectiveFormat, onChangeFormatting, autoCorrect, }) => {
|
|
75
113
|
const [formulaMode, setFormulaMode] = useFormulaMode();
|
|
76
114
|
const [_, setEditingCellCoordinate] = useEditingCell();
|
|
77
115
|
const setActiveEditor = useSetActiveEditor();
|
|
@@ -89,6 +127,17 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
89
127
|
if (typeof previousValue === "string") {
|
|
90
128
|
previousValue = canonicalizeCellInput(previousValue, formulaLocale);
|
|
91
129
|
}
|
|
130
|
+
/* AutoCorrect a new text entry; an entry whose runs index into it keeps its length */
|
|
131
|
+
if (autoCorrect &&
|
|
132
|
+
!formulaMode &&
|
|
133
|
+
typeof value === "string" &&
|
|
134
|
+
value !== previousValue) {
|
|
135
|
+
value = applyAutoCorrect({
|
|
136
|
+
text: value,
|
|
137
|
+
options: autoCorrect,
|
|
138
|
+
lengthPreserving: Boolean(textFormatRuns?.length),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
92
141
|
/* Reset editing-related state without writing / advancing */
|
|
93
142
|
const resetEditorState = () => {
|
|
94
143
|
setEditingCellCoordinate(undefined);
|
|
@@ -99,23 +148,44 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
99
148
|
/* Commit the value and advance to the next cell */
|
|
100
149
|
const commit = () => {
|
|
101
150
|
const writeActiveCell = () => onChange?.(editingSheetId, activeCell, value, textFormatRuns, previousValue, isDirty);
|
|
151
|
+
// Ctrl+Shift+Enter on a formula: ONE legacy array over the selection (or the array being
|
|
152
|
+
// re-entered) — the engine writes and fits every cell of it, so nothing else is written.
|
|
153
|
+
const arrayFormula = options?.arrayFormula && onChangeArrayFormula && isFormulaEntry(value);
|
|
102
154
|
// Ctrl+Enter: the same entry into every other selected cell (formulas shift per cell).
|
|
103
155
|
// Explicit per-cell values — never a read-back of the cell just written — so the spread
|
|
104
156
|
// is correct even when the engine applies `onChange` asynchronously (legacy setState),
|
|
105
|
-
// and so the writes can share one history batch (the rnc batcher defers them all).
|
|
106
|
-
|
|
157
|
+
// and so the writes can share one history batch (the rnc batcher defers them all). A
|
|
158
|
+
// Ctrl+Shift+Enter the host cannot enter as an array (a constant, or no array support)
|
|
159
|
+
// commits the same way.
|
|
160
|
+
const fillWrites = !arrayFormula &&
|
|
161
|
+
(options?.fillSelection || options?.arrayFormula) &&
|
|
162
|
+
onChangeBatch
|
|
107
163
|
? planEntryFill(value, activeCell, selectionsRef.current ?? [])
|
|
108
164
|
: [];
|
|
109
|
-
|
|
165
|
+
const wrapLineBreak = onChangeFormatting &&
|
|
166
|
+
entryTurnsOnWrap({
|
|
167
|
+
value,
|
|
168
|
+
previousValue,
|
|
169
|
+
format: getEffectiveFormat?.(editingSheetId, activeCell.rowIndex, activeCell.columnIndex),
|
|
170
|
+
});
|
|
171
|
+
if (arrayFormula) {
|
|
172
|
+
onChangeArrayFormula?.(editingSheetId, planArrayFormulaRange(activeCell, selectionsRef.current ?? [], getArrayFormula?.(editingSheetId, activeCell.rowIndex, activeCell.columnIndex)?.range), value);
|
|
173
|
+
}
|
|
174
|
+
else if (fillWrites.length === 0 && !wrapLineBreak) {
|
|
110
175
|
writeActiveCell();
|
|
111
176
|
}
|
|
112
177
|
else {
|
|
113
|
-
// One gesture, one undo entry: the active cell
|
|
178
|
+
// One gesture, one undo entry: the active cell, every rectangle and the wrap together.
|
|
114
179
|
const writeAll = () => {
|
|
115
180
|
writeActiveCell();
|
|
116
181
|
for (const write of fillWrites) {
|
|
117
182
|
onChangeBatch?.(editingSheetId, write.range, write.values);
|
|
118
183
|
}
|
|
184
|
+
if (wrapLineBreak) {
|
|
185
|
+
// Excel turns Wrap Text on for an entry with a line break, so every line shows and
|
|
186
|
+
// an auto-height row grows to them (the engines refit it on the format change).
|
|
187
|
+
onChangeFormatting?.(editingSheetId, activeCell, fillWrites.length ? selectionsRef.current ?? [] : [], "wrapStrategy", "wrap");
|
|
188
|
+
}
|
|
119
189
|
};
|
|
120
190
|
if (batchHistory) {
|
|
121
191
|
batchHistory(writeAll);
|
|
@@ -188,5 +258,10 @@ export const useEditorSubmit = ({ sheetId, onChangeActiveSheet, setActiveCell, o
|
|
|
188
258
|
onChangeBatch,
|
|
189
259
|
batchHistory,
|
|
190
260
|
formulaLocale,
|
|
261
|
+
onChangeArrayFormula,
|
|
262
|
+
getArrayFormula,
|
|
263
|
+
getEffectiveFormat,
|
|
264
|
+
onChangeFormatting,
|
|
265
|
+
autoCorrect,
|
|
191
266
|
]);
|
|
192
267
|
};
|
|
@@ -71,11 +71,15 @@ type FormattingKeyboardProps = {
|
|
|
71
71
|
* opened; the key is left alone otherwise.
|
|
72
72
|
*/
|
|
73
73
|
onShowCellList?(sheetId: number, cell: CellInterface): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Alt+Shift+F10: open the active cell's error-checking menu (Excel). Returns whether one opened.
|
|
76
|
+
*/
|
|
77
|
+
onShowErrorCheckMenu?(sheetId: number, cell: CellInterface): boolean;
|
|
74
78
|
/** Ctrl+' / Ctrl+Shift+" write the cell above into the active cell */
|
|
75
79
|
onChangeBatch?: CanvasGridProps["onChangeBatch"];
|
|
76
80
|
getUserEnteredValue?(sheetId: number, rowIndex: number, columnIndex: number): string | undefined | null;
|
|
77
81
|
getEffectiveValue?(sheetId: number, rowIndex: number, columnIndex: number): Maybe<ExtendedValue>;
|
|
78
82
|
};
|
|
79
|
-
export declare const useKeyboardHandler: ({ sheetId, locale, selectedRows, selectedColumns, selectedRowHeadersIds, selectedColumnHeadersIds, showFormulas, keymap, defaultFontSizePoint, onShowFormulas, onChangeFormatting, onRepeatFormatting, onClearFormatting, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onFillRange, disableFillRightShortcut, onInsertTime, onInsertDate, onInsertDateTime, onInsertNote, onInsertAutoSum, onRedo, onUndo, onRequestSearch, onRequestReplace, onRequestFormatCells, onRequestInsertComment, onRequestInsertLink, onCreateTable, onRequestCreateTable, onCreateBasicFilter, clearCopiedSelections, getCellFormat, onShowContextMenu, onHideColumn, onShowColumn, onGroupColumns, onUngroupColumns, onHideRow, onShowRow, onGroupRows, onUngroupRows, onDeleteRow, onInsertRow, onAddQuickEdit, onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowCellList, onChangeBatch, getUserEnteredValue, getEffectiveValue, canEditCell, isSheetFocused, activeCell, selections, }: FormattingKeyboardProps) => (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
83
|
+
export declare const useKeyboardHandler: ({ sheetId, locale, selectedRows, selectedColumns, selectedRowHeadersIds, selectedColumnHeadersIds, showFormulas, keymap, defaultFontSizePoint, onShowFormulas, onChangeFormatting, onRepeatFormatting, onClearFormatting, onSelectNextSheet, onSelectPreviousSheet, onCreateNewSheet, onFillRange, disableFillRightShortcut, onInsertTime, onInsertDate, onInsertDateTime, onInsertNote, onInsertAutoSum, onRedo, onUndo, onRequestSearch, onRequestReplace, onRequestFormatCells, onRequestInsertComment, onRequestInsertLink, onCreateTable, onRequestCreateTable, onCreateBasicFilter, clearCopiedSelections, getCellFormat, onShowContextMenu, onHideColumn, onShowColumn, onGroupColumns, onUngroupColumns, onHideRow, onShowRow, onGroupRows, onUngroupRows, onDeleteRow, onInsertRow, onAddQuickEdit, onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowCellList, onShowErrorCheckMenu, onChangeBatch, getUserEnteredValue, getEffectiveValue, canEditCell, isSheetFocused, activeCell, selections, }: FormattingKeyboardProps) => (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
80
84
|
export {};
|
|
81
85
|
//# sourceMappingURL=use-keyboard-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard-handler.d.ts","sourceRoot":"","sources":["../../../hooks/use-keyboard-handler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,EAEb,KAAK,EACL,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAuCzD,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnC,oBAAoB,EAAE,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC3E,WAAW,CAAC,OAAO,EAAE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7 +43,7 @@ onHideRow, onShowRow, onGroupRows, onUngroupRows, onDeleteRow, onInsertRow,
|
|
|
43
43
|
// Quick edit
|
|
44
44
|
onAddQuickEdit,
|
|
45
45
|
// Excel keymap
|
|
46
|
-
onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowCellList, onChangeBatch, getUserEnteredValue, getEffectiveValue, canEditCell, isSheetFocused, activeCell, selections, }) => {
|
|
46
|
+
onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowCellList, onShowErrorCheckMenu, onChangeBatch, getUserEnteredValue, getEffectiveValue, canEditCell, isSheetFocused, activeCell, selections, }) => {
|
|
47
47
|
return useCallbackRef(useCallback((e) => {
|
|
48
48
|
const isCtrl = e.ctrlKey; // Ctrl
|
|
49
49
|
// Under the Excel keymap on a Mac ⌃ is a modifier of its own, as in
|
|
@@ -218,6 +218,14 @@ onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowC
|
|
|
218
218
|
}
|
|
219
219
|
if (isAlt) {
|
|
220
220
|
switch (key) {
|
|
221
|
+
// Alt+Shift+F10 — "displays the menu or message for an Error Checking button" (Excel).
|
|
222
|
+
case "F10":
|
|
223
|
+
if (!isShift || isMeta || isCtrl)
|
|
224
|
+
break;
|
|
225
|
+
if (onShowErrorCheckMenu?.(sheetId, activeCell)) {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
221
229
|
// Option/Alt + ArrowUp — previous sheet (Sheets). Nothing in
|
|
222
230
|
// Excel, so the Excel keymap leaves the key alone.
|
|
223
231
|
case "ArrowUp":
|
|
@@ -674,6 +682,7 @@ onCalculateNow, onRequestGoTo, onRequestPasteSpecial, onRequestEditCell, onShowC
|
|
|
674
682
|
onRequestPasteSpecial,
|
|
675
683
|
onRequestEditCell,
|
|
676
684
|
onShowCellList,
|
|
685
|
+
onShowErrorCheckMenu,
|
|
677
686
|
onChangeBatch,
|
|
678
687
|
getUserEnteredValue,
|
|
679
688
|
getEffectiveValue,
|