@rowsncolumns/spreadsheet 10.11.0 → 10.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/split-pane.d.ts +1 -0
- package/dist/cjs/api/split-pane.d.ts.map +1 -1
- package/dist/cjs/api/split-pane.js +5 -1
- package/dist/cjs/atoms/calculated-column-fill.atom.d.ts +6 -2
- package/dist/cjs/atoms/calculated-column-fill.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/calculated-column-fill.atom.js +6 -2
- package/dist/cjs/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/fill-options.atom.d.ts +5 -0
- package/dist/cjs/atoms/fill-options.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/table-auto-expansion.atom.d.ts +5 -2
- package/dist/cjs/atoms/table-auto-expansion.atom.d.ts.map +1 -1
- package/dist/cjs/atoms/table-auto-expansion.atom.js +5 -2
- package/dist/cjs/components/autocorrect-options-smart-tag/index.d.ts +37 -0
- package/dist/cjs/components/autocorrect-options-smart-tag/index.d.ts.map +1 -0
- package/dist/cjs/components/autocorrect-options-smart-tag/index.js +84 -0
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +388 -123
- package/dist/cjs/components/canvas-grid/typings.d.ts +45 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/embeds/chart-component.d.ts +9 -0
- package/dist/cjs/components/embeds/chart-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.d.ts +9 -0
- package/dist/cjs/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-component.js +13 -114
- package/dist/cjs/components/embeds/embed-draggable.d.ts +17 -2
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +336 -25
- package/dist/cjs/components/embeds/object-focus.d.ts +32 -0
- package/dist/cjs/components/embeds/object-focus.d.ts.map +1 -0
- package/dist/cjs/components/embeds/object-focus.js +140 -0
- package/dist/cjs/components/embeds/page-gaps.d.ts +67 -0
- package/dist/cjs/components/embeds/page-gaps.d.ts.map +1 -0
- package/dist/cjs/components/embeds/page-gaps.js +159 -0
- package/dist/cjs/components/embeds/pane-copy.d.ts +35 -0
- package/dist/cjs/components/embeds/pane-copy.d.ts.map +1 -0
- package/dist/cjs/components/embeds/pane-copy.js +29 -0
- package/dist/cjs/components/embeds/slicer-component.d.ts +9 -0
- package/dist/cjs/components/embeds/slicer-component.d.ts.map +1 -1
- package/dist/cjs/components/embeds/text-box-view.d.ts +18 -0
- package/dist/cjs/components/embeds/text-box-view.d.ts.map +1 -0
- package/dist/cjs/components/embeds/text-box-view.js +130 -0
- package/dist/cjs/components/filter-box/filter-by-color.d.ts.map +1 -1
- package/dist/cjs/components/filter-box/filter-by-color.js +10 -3
- package/dist/cjs/components/filter-box/index.d.ts.map +1 -1
- package/dist/cjs/components/filter-box/index.js +5 -1
- package/dist/cjs/components/print-preview/page-block.d.ts +46 -0
- package/dist/cjs/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/page-block.js +111 -6
- package/dist/cjs/components/print-preview/print-cells.d.ts +5 -0
- package/dist/cjs/components/print-preview/print-cells.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/print-cells.js +1 -0
- package/dist/cjs/components/print-preview/print-preview-dialog.d.ts +16 -2
- package/dist/cjs/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/print-preview-dialog.js +246 -14
- package/dist/cjs/components/print-preview/settings.d.ts +8 -0
- package/dist/cjs/components/print-preview/settings.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/settings.js +4 -1
- package/dist/cjs/components/print-preview/sheet-page-setup.d.ts.map +1 -1
- package/dist/cjs/components/print-preview/sheet-page-setup.js +14 -2
- package/dist/cjs/components/selection/fill-options-menu.d.ts +8 -1
- package/dist/cjs/components/selection/fill-options-menu.d.ts.map +1 -1
- package/dist/cjs/components/selection/fill-options-menu.js +5 -3
- package/dist/cjs/components/selection/index.d.ts +1 -1
- package/dist/cjs/components/selection/index.d.ts.map +1 -1
- package/dist/cjs/components/selection/index.js +5 -6
- package/dist/cjs/components/selection/types.d.ts +13 -8
- package/dist/cjs/components/selection/types.d.ts.map +1 -1
- package/dist/cjs/components/sheet-background/index.d.ts +26 -0
- package/dist/cjs/components/sheet-background/index.d.ts.map +1 -0
- package/dist/cjs/components/sheet-background/index.js +106 -0
- package/dist/cjs/components/sort-range-dialog/index.d.ts.map +1 -1
- package/dist/cjs/components/sort-range-dialog/index.js +6 -3
- package/dist/cjs/hooks/object-clipboard-payload.d.ts +58 -0
- package/dist/cjs/hooks/object-clipboard-payload.d.ts.map +1 -0
- package/dist/cjs/hooks/object-clipboard-payload.js +488 -0
- package/dist/cjs/hooks/object-spec-schema.generated.d.ts +24 -0
- package/dist/cjs/hooks/object-spec-schema.generated.d.ts.map +1 -0
- package/dist/cjs/hooks/object-spec-schema.generated.js +4779 -0
- package/dist/cjs/hooks/use-chart-clipboard.d.ts +55 -9
- package/dist/cjs/hooks/use-chart-clipboard.d.ts.map +1 -1
- package/dist/cjs/hooks/use-chart-clipboard.js +307 -55
- package/dist/cjs/hooks/use-embeds-charts.d.ts +12 -1
- package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-embeds-charts.js +86 -17
- package/dist/cjs/hooks/use-grid-children.d.ts +4 -2
- package/dist/cjs/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/cjs/hooks/use-grid-children.js +74 -16
- package/dist/cjs/hooks/use-selection-renderer.d.ts +16 -5
- package/dist/cjs/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/cjs/hooks/use-selection-renderer.js +59 -32
- package/dist/cjs/hooks/use-shown-notes.d.ts +11 -1
- package/dist/cjs/hooks/use-shown-notes.d.ts.map +1 -1
- package/dist/cjs/hooks/use-shown-notes.js +34 -12
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +64 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/api/split-pane.d.ts +1 -0
- package/dist/esm/api/split-pane.d.ts.map +1 -1
- package/dist/esm/api/split-pane.js +5 -1
- package/dist/esm/atoms/calculated-column-fill.atom.d.ts +6 -2
- package/dist/esm/atoms/calculated-column-fill.atom.d.ts.map +1 -1
- package/dist/esm/atoms/calculated-column-fill.atom.js +6 -2
- package/dist/esm/atoms/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/atoms/fill-options.atom.d.ts +5 -0
- package/dist/esm/atoms/fill-options.atom.d.ts.map +1 -1
- package/dist/esm/atoms/table-auto-expansion.atom.d.ts +5 -2
- package/dist/esm/atoms/table-auto-expansion.atom.d.ts.map +1 -1
- package/dist/esm/atoms/table-auto-expansion.atom.js +5 -2
- package/dist/esm/components/autocorrect-options-smart-tag/index.d.ts +37 -0
- package/dist/esm/components/autocorrect-options-smart-tag/index.d.ts.map +1 -0
- package/dist/esm/components/autocorrect-options-smart-tag/index.js +87 -0
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +307 -59
- package/dist/esm/components/canvas-grid/typings.d.ts +45 -0
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/embeds/chart-component.d.ts +9 -0
- package/dist/esm/components/embeds/chart-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.d.ts +9 -0
- package/dist/esm/components/embeds/embed-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-component.js +12 -113
- package/dist/esm/components/embeds/embed-draggable.d.ts +17 -2
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +327 -19
- package/dist/esm/components/embeds/object-focus.d.ts +32 -0
- package/dist/esm/components/embeds/object-focus.d.ts.map +1 -0
- package/dist/esm/components/embeds/object-focus.js +118 -0
- package/dist/esm/components/embeds/page-gaps.d.ts +67 -0
- package/dist/esm/components/embeds/page-gaps.d.ts.map +1 -0
- package/dist/esm/components/embeds/page-gaps.js +86 -0
- package/dist/esm/components/embeds/pane-copy.d.ts +35 -0
- package/dist/esm/components/embeds/pane-copy.d.ts.map +1 -0
- package/dist/esm/components/embeds/pane-copy.js +22 -0
- package/dist/esm/components/embeds/slicer-component.d.ts +9 -0
- package/dist/esm/components/embeds/slicer-component.d.ts.map +1 -1
- package/dist/esm/components/embeds/text-box-view.d.ts +18 -0
- package/dist/esm/components/embeds/text-box-view.d.ts.map +1 -0
- package/dist/esm/components/embeds/text-box-view.js +118 -0
- package/dist/esm/components/filter-box/filter-by-color.d.ts.map +1 -1
- package/dist/esm/components/filter-box/filter-by-color.js +9 -2
- package/dist/esm/components/filter-box/index.d.ts.map +1 -1
- package/dist/esm/components/filter-box/index.js +5 -1
- package/dist/esm/components/print-preview/page-block.d.ts +46 -0
- package/dist/esm/components/print-preview/page-block.d.ts.map +1 -1
- package/dist/esm/components/print-preview/page-block.js +122 -4
- package/dist/esm/components/print-preview/print-cells.d.ts +5 -0
- package/dist/esm/components/print-preview/print-cells.d.ts.map +1 -1
- package/dist/esm/components/print-preview/print-cells.js +1 -0
- package/dist/esm/components/print-preview/print-preview-dialog.d.ts +16 -2
- package/dist/esm/components/print-preview/print-preview-dialog.d.ts.map +1 -1
- package/dist/esm/components/print-preview/print-preview-dialog.js +195 -4
- package/dist/esm/components/print-preview/settings.d.ts +8 -0
- package/dist/esm/components/print-preview/settings.d.ts.map +1 -1
- package/dist/esm/components/print-preview/settings.js +4 -1
- package/dist/esm/components/print-preview/sheet-page-setup.d.ts.map +1 -1
- package/dist/esm/components/print-preview/sheet-page-setup.js +14 -0
- package/dist/esm/components/selection/fill-options-menu.d.ts +8 -1
- package/dist/esm/components/selection/fill-options-menu.d.ts.map +1 -1
- package/dist/esm/components/selection/fill-options-menu.js +5 -3
- package/dist/esm/components/selection/index.d.ts +1 -1
- package/dist/esm/components/selection/index.d.ts.map +1 -1
- package/dist/esm/components/selection/index.js +5 -6
- package/dist/esm/components/selection/types.d.ts +13 -8
- package/dist/esm/components/selection/types.d.ts.map +1 -1
- package/dist/esm/components/sheet-background/index.d.ts +26 -0
- package/dist/esm/components/sheet-background/index.d.ts.map +1 -0
- package/dist/esm/components/sheet-background/index.js +93 -0
- package/dist/esm/components/sort-range-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/sort-range-dialog/index.js +5 -2
- package/dist/esm/hooks/object-clipboard-payload.d.ts +58 -0
- package/dist/esm/hooks/object-clipboard-payload.d.ts.map +1 -0
- package/dist/esm/hooks/object-clipboard-payload.js +404 -0
- package/dist/esm/hooks/object-spec-schema.generated.d.ts +24 -0
- package/dist/esm/hooks/object-spec-schema.generated.d.ts.map +1 -0
- package/dist/esm/hooks/object-spec-schema.generated.js +4776 -0
- package/dist/esm/hooks/use-chart-clipboard.d.ts +55 -9
- package/dist/esm/hooks/use-chart-clipboard.d.ts.map +1 -1
- package/dist/esm/hooks/use-chart-clipboard.js +298 -53
- package/dist/esm/hooks/use-embeds-charts.d.ts +12 -1
- package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-embeds-charts.js +83 -16
- package/dist/esm/hooks/use-grid-children.d.ts +4 -2
- package/dist/esm/hooks/use-grid-children.d.ts.map +1 -1
- package/dist/esm/hooks/use-grid-children.js +59 -16
- package/dist/esm/hooks/use-selection-renderer.d.ts +16 -5
- package/dist/esm/hooks/use-selection-renderer.d.ts.map +1 -1
- package/dist/esm/hooks/use-selection-renderer.js +54 -28
- package/dist/esm/hooks/use-shown-notes.d.ts +11 -1
- package/dist/esm/hooks/use-shown-notes.d.ts.map +1 -1
- package/dist/esm/hooks/use-shown-notes.js +23 -12
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +64 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/spreadsheet.min.css +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { CellInterface } from "@rowsncolumns/grid";
|
|
2
2
|
import type { CanvasGridProps } from "../components/canvas-grid/typings";
|
|
3
|
-
import type { EmbeddedChart } from "../types";
|
|
3
|
+
import type { EmbeddedChart, EmbeddedObject } from "../types";
|
|
4
|
+
import { type ObjectClipboardPolicy } from "./object-clipboard-payload";
|
|
4
5
|
/**
|
|
5
6
|
* Clipboard type the copied chart rides on, so a paste in another tab of the
|
|
6
7
|
* same browser rebuilds it. Browsers keep custom types only for their own
|
|
7
8
|
* paste events, hence the in-memory entry below is the primary source.
|
|
8
9
|
*/
|
|
9
10
|
export declare const CHART_CLIPBOARD_MIME = "application/x-rowsncolumns-chart";
|
|
11
|
+
/** Clipboard type a copied picture, shape or text box rides on (as `CHART_CLIPBOARD_MIME`). */
|
|
12
|
+
export declare const EMBED_CLIPBOARD_MIME = "application/x-rowsncolumns-embed";
|
|
10
13
|
/**
|
|
11
14
|
* Excel nudges a pasted or duplicated object this far down-right of the
|
|
12
15
|
* original when the destination is the object's own spot.
|
|
@@ -21,35 +24,78 @@ export type UseChartClipboardProps = {
|
|
|
21
24
|
readonly?: boolean;
|
|
22
25
|
onCreateChart: CanvasGridProps["onCreateChart"];
|
|
23
26
|
onDeleteChart: CanvasGridProps["onDeleteChart"];
|
|
27
|
+
/** Pictures, shapes and text boxes: copied, cut, pasted and duplicated the way charts are. */
|
|
28
|
+
embeds?: CanvasGridProps["embeds"];
|
|
29
|
+
onCreateEmbed?: CanvasGridProps["onCreateEmbed"];
|
|
30
|
+
onDeleteEmbed?: CanvasGridProps["onDeleteEmbed"];
|
|
24
31
|
/** Host hooks notified after the grid's clipboard copied / cut a chart. */
|
|
25
32
|
onCopyChart?: CanvasGridProps["onCopyChart"];
|
|
26
33
|
onCutChart?: CanvasGridProps["onCutChart"];
|
|
27
34
|
/** Return keyboard focus to the grid once a cut removed the focused chart. */
|
|
28
35
|
focusSheet(): void;
|
|
36
|
+
/**
|
|
37
|
+
* The destination sheet's size and its column widths / row heights: a pasted object is kept on
|
|
38
|
+
* the sheet (shifted back from its far edge) and its far anchor stored on a cell that exists,
|
|
39
|
+
* never with a negative offset.
|
|
40
|
+
*/
|
|
41
|
+
rowCount?: number;
|
|
42
|
+
columnCount?: number;
|
|
43
|
+
getColumnWidth?: (columnIndex: number) => number;
|
|
44
|
+
getRowHeight?: (rowIndex: number) => number;
|
|
45
|
+
/**
|
|
46
|
+
* What a paste may build from an object copied in another tab (see `ObjectClipboardPolicy`):
|
|
47
|
+
* which `https:` URLs a picture or link may keep, and whether a host-defined embed kind (an
|
|
48
|
+
* `asset` embed, …) may be pasted or duplicated at all. Default: neither.
|
|
49
|
+
*/
|
|
50
|
+
objectClipboardPolicy?: Omit<ObjectClipboardPolicy, "origin">;
|
|
51
|
+
/**
|
|
52
|
+
* Whether this workbook has the sheet: a chart pasted from elsewhere drops a range on a sheet
|
|
53
|
+
* that does not exist here. Without it every range is kept.
|
|
54
|
+
*/
|
|
55
|
+
sheetExists?: (sheetId: number) => boolean;
|
|
29
56
|
};
|
|
30
57
|
/** The chart clipboard as `useEmbedsCharts` consumes it (keyboard + right-click menu). */
|
|
31
|
-
export type ChartClipboard = Pick<ReturnType<typeof useChartClipboard>, "copyChart" | "cutChart" | "pasteChart" | "duplicateChart" | "hasChartOnClipboard">;
|
|
58
|
+
export type ChartClipboard = Pick<ReturnType<typeof useChartClipboard>, "copyChart" | "cutChart" | "pasteChart" | "duplicateChart" | "hasChartOnClipboard" | "copyEmbed" | "cutEmbed" | "duplicateEmbed">;
|
|
32
59
|
/**
|
|
33
60
|
* A chart pasted onto another sheet must keep reading its original data:
|
|
34
61
|
* every range in the spec that relied on the implicit "own sheet" gets that
|
|
35
62
|
* sheet written in.
|
|
36
63
|
*/
|
|
37
64
|
export declare const pinSpecRangesToSheet: <T>(value: T, sheetId: number) => T;
|
|
65
|
+
type Axis = {
|
|
66
|
+
anchor: number;
|
|
67
|
+
anchorOffset: number;
|
|
68
|
+
to: number;
|
|
69
|
+
toOffset: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* One axis (columns or rows) of a pasted object's two anchors, stored the way a move stores them:
|
|
73
|
+
* an offset past its cell's size moves on to the next cell and a negative far offset back to the
|
|
74
|
+
* previous one (never a negative offset); a far anchor past the sheet's last row / column shifts
|
|
75
|
+
* the whole object back onto the sheet, and when it is larger than the sheet the corner stays on
|
|
76
|
+
* the last cell's last pixel. `size` is a column's width or a row's height.
|
|
77
|
+
*/
|
|
78
|
+
export declare const placeAnchorAxis: (axis: Axis, last: number, size: (index: number) => number) => Axis;
|
|
38
79
|
/**
|
|
39
|
-
* Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D on a selected chart (Excel object
|
|
40
|
-
* clipboard). The copied
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
80
|
+
* Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D on a selected chart, picture, shape or text box (Excel's object
|
|
81
|
+
* clipboard). The copied object lives in memory (plus a custom clipboard type for same-browser
|
|
82
|
+
* tabs); a paste creates an object with a fresh id — a chart bound to the SAME source data (pasting
|
|
83
|
+
* onto another sheet keeps the references pointing at the original sheet) — and selects it. A cut
|
|
84
|
+
* removes the object immediately (Excel removes cut objects on Ctrl+X, unlike cut cells which wait
|
|
85
|
+
* for the paste). Every paste, cut and duplicate goes through the host's create / delete handlers,
|
|
86
|
+
* one undo step each.
|
|
45
87
|
*/
|
|
46
|
-
export declare const useChartClipboard: ({ sheetId, activeCell, charts, readonly, onCreateChart, onDeleteChart, onCopyChart, onCutChart, focusSheet, }: UseChartClipboardProps) => {
|
|
88
|
+
export declare const useChartClipboard: ({ sheetId, activeCell, charts, readonly, onCreateChart, onDeleteChart, onCopyChart, onCutChart, embeds, onCreateEmbed, onDeleteEmbed, focusSheet, rowCount, columnCount, getColumnWidth, getRowHeight, objectClipboardPolicy, sheetExists, }: UseChartClipboardProps) => {
|
|
47
89
|
copyChart: (chartId: EmbeddedChart["chartId"], e?: ClipboardEvent) => boolean;
|
|
48
90
|
cutChart: (chartId: EmbeddedChart["chartId"], e?: ClipboardEvent) => boolean;
|
|
49
91
|
pasteChart: (e?: ClipboardEvent) => boolean;
|
|
50
92
|
duplicateChart: (chartId: EmbeddedChart["chartId"]) => EmbeddedChart | undefined;
|
|
93
|
+
copyEmbed: (embedId: EmbeddedObject["embedId"], e?: ClipboardEvent) => boolean;
|
|
94
|
+
cutEmbed: (embedId: EmbeddedObject["embedId"], e?: ClipboardEvent) => boolean;
|
|
95
|
+
duplicateEmbed: (embedId: EmbeddedObject["embedId"]) => EmbeddedObject | undefined;
|
|
51
96
|
clearChartClipboard: () => void;
|
|
52
97
|
hasChartOnClipboard: () => boolean;
|
|
53
98
|
getSelectedChart: () => EmbeddedChart | undefined;
|
|
54
99
|
};
|
|
100
|
+
export {};
|
|
55
101
|
//# sourceMappingURL=use-chart-clipboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chart-clipboard.d.ts","sourceRoot":"","sources":["../../../hooks/use-chart-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-chart-clipboard.d.ts","sourceRoot":"","sources":["../../../hooks/use-chart-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAo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/utils";
|
|
2
2
|
import { useCallback, useRef } from "react";
|
|
3
3
|
import { useSelectedChartEmbed } from "../atoms";
|
|
4
|
+
import { getStackingOrder } from "../utils/z-order";
|
|
5
|
+
import { parseChartPayload, parseEmbedPayload, } from "./object-clipboard-payload";
|
|
4
6
|
import { useCallbackRef } from "./use-callback-ref";
|
|
5
7
|
/**
|
|
6
8
|
* Clipboard type the copied chart rides on, so a paste in another tab of the
|
|
@@ -8,11 +10,18 @@ import { useCallbackRef } from "./use-callback-ref";
|
|
|
8
10
|
* paste events, hence the in-memory entry below is the primary source.
|
|
9
11
|
*/
|
|
10
12
|
export const CHART_CLIPBOARD_MIME = "application/x-rowsncolumns-chart";
|
|
13
|
+
/** Clipboard type a copied picture, shape or text box rides on (as `CHART_CLIPBOARD_MIME`). */
|
|
14
|
+
export const EMBED_CLIPBOARD_MIME = "application/x-rowsncolumns-embed";
|
|
11
15
|
/**
|
|
12
16
|
* Excel nudges a pasted or duplicated object this far down-right of the
|
|
13
17
|
* original when the destination is the object's own spot.
|
|
14
18
|
*/
|
|
15
19
|
export const CHART_PASTE_OFFSET_PIXELS = 10;
|
|
20
|
+
const MAX_ROW_INDEX = 1048576;
|
|
21
|
+
const MAX_COLUMN_INDEX = 16384;
|
|
22
|
+
/** Cell sizes assumed when the grid gives none (a host calling the hook without geometry). */
|
|
23
|
+
const DEFAULT_ANCHOR_CELL_WIDTH = 100;
|
|
24
|
+
const DEFAULT_ANCHOR_CELL_HEIGHT = 21;
|
|
16
25
|
const isRange = (value) => typeof value.startRowIndex === "number" &&
|
|
17
26
|
typeof value.startColumnIndex === "number";
|
|
18
27
|
/**
|
|
@@ -38,21 +47,88 @@ export const pinSpecRangesToSheet = (value, sheetId) => {
|
|
|
38
47
|
return next;
|
|
39
48
|
};
|
|
40
49
|
const cloneChart = (chart) => JSON.parse(JSON.stringify(chart));
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
const cloneEmbed = (embed) => JSON.parse(JSON.stringify(embed));
|
|
51
|
+
/** The embed kinds the object clipboard copies, pastes and duplicates itself. */
|
|
52
|
+
const CLIPBOARD_EMBED_TYPES = new Set(["image", "shape", "textbox", "formControl"]);
|
|
53
|
+
/** Excel's default name of each form control kind ("Check Box 1"). */
|
|
54
|
+
const FORM_CONTROL_NAMES = {
|
|
55
|
+
Button: "Button",
|
|
56
|
+
CheckBox: "Check Box",
|
|
57
|
+
Drop: "Drop Down",
|
|
58
|
+
EditBox: "Edit Box",
|
|
59
|
+
GBox: "Group Box",
|
|
60
|
+
Label: "Label",
|
|
61
|
+
List: "List Box",
|
|
62
|
+
Radio: "Option Button",
|
|
63
|
+
Scroll: "Scroll Bar",
|
|
64
|
+
Spin: "Spinner",
|
|
65
|
+
Dialog: "Dialog",
|
|
66
|
+
};
|
|
67
|
+
const NUMBERED_NAME = /^(.*?)\s*(\d+)$/;
|
|
68
|
+
/**
|
|
69
|
+
* A pasted or duplicated form control is a new control, as in Excel: it takes the next free
|
|
70
|
+
* number of its name ("Check Box 1" → "Check Box 2", counting every form control in `embeds`)
|
|
71
|
+
* and no `shapeId` (the exporters give it its own).
|
|
72
|
+
*/
|
|
73
|
+
const renameFormControl = (embed, embeds) => {
|
|
74
|
+
if (embed.spec.type !== "formControl")
|
|
75
|
+
return embed;
|
|
76
|
+
const spec = embed.spec;
|
|
77
|
+
const base = (spec.name ? NUMBERED_NAME.exec(spec.name)?.[1] ?? spec.name : undefined) ??
|
|
78
|
+
FORM_CONTROL_NAMES[spec.objectType] ??
|
|
79
|
+
spec.objectType;
|
|
80
|
+
let highest = 0;
|
|
81
|
+
for (const other of embeds ?? []) {
|
|
82
|
+
if (other.spec.type !== "formControl")
|
|
83
|
+
continue;
|
|
84
|
+
const match = NUMBERED_NAME.exec(other.spec.name ?? "");
|
|
85
|
+
if (match && match[1] === base)
|
|
86
|
+
highest = Math.max(highest, Number(match[2]));
|
|
87
|
+
}
|
|
88
|
+
const { shapeId: _shapeId, ...rest } = spec;
|
|
89
|
+
return { ...embed, spec: { ...rest, name: `${base} ${highest + 1}` } };
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* One axis (columns or rows) of a pasted object's two anchors, stored the way a move stores them:
|
|
93
|
+
* an offset past its cell's size moves on to the next cell and a negative far offset back to the
|
|
94
|
+
* previous one (never a negative offset); a far anchor past the sheet's last row / column shifts
|
|
95
|
+
* the whole object back onto the sheet, and when it is larger than the sheet the corner stays on
|
|
96
|
+
* the last cell's last pixel. `size` is a column's width or a row's height.
|
|
97
|
+
*/
|
|
98
|
+
export const placeAnchorAxis = (axis, last, size) => {
|
|
99
|
+
let { anchor, anchorOffset, to, toOffset } = axis;
|
|
100
|
+
const lastPixel = (index) => Math.max(0, size(index) - 1);
|
|
101
|
+
for (let guard = 0; toOffset < 0 && to > anchor && guard < 100000; guard++) {
|
|
102
|
+
to -= 1;
|
|
103
|
+
toOffset += size(to);
|
|
104
|
+
}
|
|
105
|
+
toOffset = Math.max(0, toOffset);
|
|
106
|
+
anchorOffset = Math.max(0, anchorOffset);
|
|
107
|
+
for (let guard = 0; anchor < last && size(anchor) > 0 && anchorOffset > size(anchor) && guard < 100000; guard++) {
|
|
108
|
+
anchorOffset -= size(anchor);
|
|
109
|
+
anchor += 1;
|
|
110
|
+
to = Math.max(to, anchor);
|
|
45
111
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
? parsed
|
|
50
|
-
: undefined;
|
|
112
|
+
for (let guard = 0; to < last && size(to) > 0 && toOffset > size(to) && guard < 100000; guard++) {
|
|
113
|
+
toOffset -= size(to);
|
|
114
|
+
to += 1;
|
|
51
115
|
}
|
|
52
|
-
|
|
53
|
-
|
|
116
|
+
if (to > last) {
|
|
117
|
+
const shift = Math.min(to - last, anchor - 1);
|
|
118
|
+
anchor -= shift;
|
|
119
|
+
to -= shift;
|
|
120
|
+
if (to > last) {
|
|
121
|
+
to = last;
|
|
122
|
+
toOffset = lastPixel(last);
|
|
123
|
+
}
|
|
54
124
|
}
|
|
125
|
+
if (to === last)
|
|
126
|
+
toOffset = Math.min(toOffset, lastPixel(last));
|
|
127
|
+
if (anchor === last)
|
|
128
|
+
anchorOffset = Math.min(anchorOffset, lastPixel(last));
|
|
129
|
+
return { anchor, anchorOffset, to, toOffset };
|
|
55
130
|
};
|
|
131
|
+
const positionOf = (entry) => entry.kind === "chart" ? entry.chart.position : entry.embed.position;
|
|
56
132
|
/**
|
|
57
133
|
* Cell copies write text + html; anything else on the clipboard (external
|
|
58
134
|
* text, a file) is not ours either. An empty clipboard is what our own chart
|
|
@@ -63,18 +139,23 @@ const carriesForeignContent = (data) => Boolean(data &&
|
|
|
63
139
|
data.getData("text/html") ||
|
|
64
140
|
data.files?.length));
|
|
65
141
|
/**
|
|
66
|
-
* Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D on a selected chart (Excel object
|
|
67
|
-
* clipboard). The copied
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
142
|
+
* Ctrl+C / Ctrl+X / Ctrl+V / Ctrl+D on a selected chart, picture, shape or text box (Excel's object
|
|
143
|
+
* clipboard). The copied object lives in memory (plus a custom clipboard type for same-browser
|
|
144
|
+
* tabs); a paste creates an object with a fresh id — a chart bound to the SAME source data (pasting
|
|
145
|
+
* onto another sheet keeps the references pointing at the original sheet) — and selects it. A cut
|
|
146
|
+
* removes the object immediately (Excel removes cut objects on Ctrl+X, unlike cut cells which wait
|
|
147
|
+
* for the paste). Every paste, cut and duplicate goes through the host's create / delete handlers,
|
|
148
|
+
* one undo step each.
|
|
72
149
|
*/
|
|
73
|
-
export const useChartClipboard = ({ sheetId, activeCell, charts, readonly, onCreateChart, onDeleteChart, onCopyChart, onCutChart, focusSheet, }) => {
|
|
150
|
+
export const useChartClipboard = ({ sheetId, activeCell, charts, readonly, onCreateChart, onDeleteChart, onCopyChart, onCutChart, embeds, onCreateEmbed, onDeleteEmbed, focusSheet, rowCount, columnCount, getColumnWidth, getRowHeight, objectClipboardPolicy, sheetExists, }) => {
|
|
74
151
|
const [selectedChartId, setSelectedChartId] = useSelectedChartEmbed();
|
|
75
152
|
const entryRef = useRef(undefined);
|
|
153
|
+
/** The custom-type payload this grid last wrote: a paste that reads it back is its own copy. */
|
|
154
|
+
const writtenRef = useRef(undefined);
|
|
76
155
|
const onCreateChartRef = useCallbackRef(onCreateChart);
|
|
77
156
|
const onDeleteChartRef = useCallbackRef(onDeleteChart);
|
|
157
|
+
const onCreateEmbedRef = useCallbackRef(onCreateEmbed);
|
|
158
|
+
const onDeleteEmbedRef = useCallbackRef(onDeleteEmbed);
|
|
78
159
|
const onCopyChartRef = useCallbackRef(onCopyChart);
|
|
79
160
|
const onCutChartRef = useCallbackRef(onCutChart);
|
|
80
161
|
const focusSheetRef = useCallbackRef(focusSheet);
|
|
@@ -82,70 +163,146 @@ export const useChartClipboard = ({ sheetId, activeCell, charts, readonly, onCre
|
|
|
82
163
|
sheetId,
|
|
83
164
|
activeCell,
|
|
84
165
|
charts,
|
|
166
|
+
embeds,
|
|
85
167
|
readonly,
|
|
86
168
|
selectedChartId,
|
|
169
|
+
canCreateEmbed: Boolean(onCreateEmbed),
|
|
170
|
+
lastRow: Math.max(1, rowCount ?? MAX_ROW_INDEX),
|
|
171
|
+
lastColumn: Math.max(1, columnCount ?? MAX_COLUMN_INDEX),
|
|
172
|
+
getColumnWidth: getColumnWidth ?? (() => DEFAULT_ANCHOR_CELL_WIDTH),
|
|
173
|
+
getRowHeight: getRowHeight ?? (() => DEFAULT_ANCHOR_CELL_HEIGHT),
|
|
174
|
+
policy: objectClipboardPolicy,
|
|
175
|
+
sheetExists,
|
|
87
176
|
}));
|
|
177
|
+
/** Whether the clipboard handles `embed` itself, or the host accepted its kind. */
|
|
178
|
+
const acceptEmbed = useCallback((embed) => {
|
|
179
|
+
if (CLIPBOARD_EMBED_TYPES.has(embed.spec.type))
|
|
180
|
+
return embed;
|
|
181
|
+
const accepted = getContext().policy?.acceptHostEmbed?.(cloneEmbed(embed));
|
|
182
|
+
return accepted ? cloneEmbed(accepted) : undefined;
|
|
183
|
+
}, [getContext]);
|
|
88
184
|
const findChart = useCallback((chartId) => chartId === undefined
|
|
89
185
|
? undefined
|
|
90
186
|
: getContext().charts?.find((chart) => chart.chartId === chartId), [getContext]);
|
|
187
|
+
const findEmbed = useCallback((embedId) => embedId === undefined
|
|
188
|
+
? undefined
|
|
189
|
+
: getContext().embeds?.find((embed) => embed.embedId === embedId), [getContext]);
|
|
91
190
|
/** The chart the grid's copy / cut / duplicate shortcuts act on. */
|
|
92
191
|
const getSelectedChart = useCallback(() => findChart(getContext().selectedChartId), [findChart, getContext]);
|
|
93
192
|
/**
|
|
94
|
-
* Where a pasted
|
|
95
|
-
*
|
|
193
|
+
* Where a pasted object lands: the active cell, or — when an object is still selected on the
|
|
194
|
+
* source sheet (nothing moved) — offset from the source. An object anchored to two cells keeps
|
|
195
|
+
* its size: its second anchor moves with the first.
|
|
96
196
|
*/
|
|
97
|
-
const
|
|
98
|
-
const { sheetId, activeCell } = getContext();
|
|
99
|
-
const overlayPosition = source.
|
|
100
|
-
|
|
197
|
+
const placeObject = useCallback((source, nearSource) => {
|
|
198
|
+
const { sheetId, activeCell, lastRow, lastColumn, getColumnWidth, getRowHeight } = getContext();
|
|
199
|
+
const overlayPosition = source.overlayPosition;
|
|
200
|
+
const sourceAnchor = overlayPosition.anchorCell;
|
|
201
|
+
const offsetX = overlayPosition.offsetXPixels ?? 0;
|
|
202
|
+
const offsetY = overlayPosition.offsetYPixels ?? 0;
|
|
203
|
+
const nudge = nearSource ? CHART_PASTE_OFFSET_PIXELS : 0;
|
|
204
|
+
const anchor = nearSource ? sourceAnchor : activeCell;
|
|
205
|
+
const toCell = overlayPosition.toCell;
|
|
206
|
+
if (!toCell) {
|
|
101
207
|
return {
|
|
102
208
|
sheetId,
|
|
103
209
|
overlayPosition: {
|
|
104
210
|
...overlayPosition,
|
|
105
|
-
|
|
106
|
-
|
|
211
|
+
anchorCell: anchor,
|
|
212
|
+
offsetXPixels: nearSource ? offsetX + nudge : 0,
|
|
213
|
+
offsetYPixels: nearSource ? offsetY + nudge : 0,
|
|
107
214
|
},
|
|
108
215
|
};
|
|
109
216
|
}
|
|
217
|
+
// Both corners move together: the far anchor keeps its distance from the near one.
|
|
218
|
+
const toOffsetX = overlayPosition.toOffsetXPixels ?? 0;
|
|
219
|
+
const toOffsetY = overlayPosition.toOffsetYPixels ?? 0;
|
|
220
|
+
const columns = placeAnchorAxis({
|
|
221
|
+
anchor: anchor.columnIndex,
|
|
222
|
+
anchorOffset: nearSource ? offsetX + nudge : 0,
|
|
223
|
+
to: anchor.columnIndex + (toCell.columnIndex - sourceAnchor.columnIndex),
|
|
224
|
+
toOffset: nearSource ? toOffsetX + nudge : toOffsetX - offsetX,
|
|
225
|
+
}, lastColumn, getColumnWidth);
|
|
226
|
+
const rows = placeAnchorAxis({
|
|
227
|
+
anchor: anchor.rowIndex,
|
|
228
|
+
anchorOffset: nearSource ? offsetY + nudge : 0,
|
|
229
|
+
to: anchor.rowIndex + (toCell.rowIndex - sourceAnchor.rowIndex),
|
|
230
|
+
toOffset: nearSource ? toOffsetY + nudge : toOffsetY - offsetY,
|
|
231
|
+
}, lastRow, getRowHeight);
|
|
110
232
|
return {
|
|
111
233
|
sheetId,
|
|
112
234
|
overlayPosition: {
|
|
113
235
|
...overlayPosition,
|
|
114
|
-
anchorCell:
|
|
115
|
-
offsetXPixels:
|
|
116
|
-
offsetYPixels:
|
|
236
|
+
anchorCell: { rowIndex: rows.anchor, columnIndex: columns.anchor },
|
|
237
|
+
offsetXPixels: columns.anchorOffset,
|
|
238
|
+
offsetYPixels: rows.anchorOffset,
|
|
239
|
+
toCell: { rowIndex: rows.to, columnIndex: columns.to },
|
|
240
|
+
toOffsetXPixels: columns.toOffset,
|
|
241
|
+
toOffsetYPixels: rows.toOffset,
|
|
117
242
|
},
|
|
118
243
|
};
|
|
119
244
|
}, [getContext]);
|
|
120
245
|
const createChartAt = useCallback((source, position) => {
|
|
121
|
-
const { activeCell } = getContext();
|
|
246
|
+
const { activeCell, charts, embeds } = getContext();
|
|
247
|
+
// The pasted chart goes on top of the sheet's objects, as Excel's paste does.
|
|
248
|
+
const stack = getStackingOrder(charts, embeds, position.sheetId);
|
|
249
|
+
const top = stack.length ? stack[stack.length - 1].zOrder + 1 : undefined;
|
|
122
250
|
const chart = {
|
|
123
251
|
...cloneChart(source),
|
|
124
252
|
chartId: uuid(),
|
|
125
|
-
position,
|
|
253
|
+
position: { ...position, zOrder: top },
|
|
126
254
|
spec: pinSpecRangesToSheet(source.spec, source.position.sheetId),
|
|
127
255
|
};
|
|
128
256
|
onCreateChartRef(position.sheetId, activeCell, [], chart);
|
|
129
257
|
setSelectedChartId(chart.chartId);
|
|
130
258
|
return chart;
|
|
131
259
|
}, [getContext, onCreateChartRef, setSelectedChartId]);
|
|
260
|
+
const createEmbedAt = useCallback((source, position) => {
|
|
261
|
+
const { charts, embeds } = getContext();
|
|
262
|
+
// The pasted object goes on top of the sheet's objects, as Excel's paste does.
|
|
263
|
+
const stack = getStackingOrder(charts, embeds, position.sheetId);
|
|
264
|
+
const top = stack.length ? stack[stack.length - 1].zOrder + 1 : undefined;
|
|
265
|
+
const embed = {
|
|
266
|
+
...renameFormControl(cloneEmbed(source), embeds),
|
|
267
|
+
embedId: uuid(),
|
|
268
|
+
position: { ...position, zOrder: top },
|
|
269
|
+
};
|
|
270
|
+
onCreateEmbedRef(embed);
|
|
271
|
+
setSelectedChartId(embed.embedId);
|
|
272
|
+
return embed;
|
|
273
|
+
}, [getContext, onCreateEmbedRef, setSelectedChartId]);
|
|
274
|
+
const writeEntry = (entry, e) => {
|
|
275
|
+
entryRef.current = entry;
|
|
276
|
+
writtenRef.current = undefined;
|
|
277
|
+
if (e) {
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
// Overwrite whatever cells were copied before, so the object is what the next paste sees
|
|
280
|
+
// even where the custom type is dropped.
|
|
281
|
+
const payload = JSON.stringify(entry.kind === "chart" ? entry.chart : entry.embed);
|
|
282
|
+
e.clipboardData?.setData("text/plain", "");
|
|
283
|
+
e.clipboardData?.setData(entry.kind === "chart" ? CHART_CLIPBOARD_MIME : EMBED_CLIPBOARD_MIME, payload);
|
|
284
|
+
writtenRef.current = payload;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
132
287
|
/** Ctrl+C on a chart. Returns false when `chartId` is not a chart on this grid. */
|
|
133
288
|
const copyChart = useCallback((chartId, e) => {
|
|
134
289
|
const chart = findChart(chartId);
|
|
135
290
|
if (!chart) {
|
|
136
291
|
return false;
|
|
137
292
|
}
|
|
138
|
-
|
|
139
|
-
if (e) {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
// Overwrite whatever cells were copied before, so the chart is what
|
|
142
|
-
// the next paste sees even where the custom type is dropped.
|
|
143
|
-
e.clipboardData?.setData("text/plain", "");
|
|
144
|
-
e.clipboardData?.setData(CHART_CLIPBOARD_MIME, JSON.stringify(entryRef.current));
|
|
145
|
-
}
|
|
293
|
+
writeEntry({ kind: "chart", chart: cloneChart(chart) }, e);
|
|
146
294
|
onCopyChartRef(chartId);
|
|
147
295
|
return true;
|
|
148
296
|
}, [findChart, onCopyChartRef]);
|
|
297
|
+
/** Ctrl+C on a picture, shape or text box. Returns false when `embedId` is not one on this grid. */
|
|
298
|
+
const copyEmbed = useCallback((embedId, e) => {
|
|
299
|
+
const embed = findEmbed(embedId);
|
|
300
|
+
if (!embed || !acceptEmbed(embed)) {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
writeEntry({ kind: "embed", embed: cloneEmbed(embed) }, e);
|
|
304
|
+
return true;
|
|
305
|
+
}, [findEmbed, acceptEmbed]);
|
|
149
306
|
/** Ctrl+X on a chart: copy, then remove it (one history step). */
|
|
150
307
|
const cutChart = useCallback((chartId, e) => {
|
|
151
308
|
if (getContext().readonly || !copyChart(chartId, e)) {
|
|
@@ -166,46 +323,134 @@ export const useChartClipboard = ({ sheetId, activeCell, charts, readonly, onCre
|
|
|
166
323
|
focusSheetRef,
|
|
167
324
|
onCutChartRef,
|
|
168
325
|
]);
|
|
169
|
-
/**
|
|
326
|
+
/** Ctrl+X on a picture, shape or text box: copy, then remove it (one history step). */
|
|
327
|
+
const cutEmbed = useCallback((embedId, e) => {
|
|
328
|
+
if (getContext().readonly || !onDeleteEmbed || !copyEmbed(embedId, e)) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
onDeleteEmbedRef(embedId);
|
|
332
|
+
if (getContext().selectedChartId === embedId) {
|
|
333
|
+
setSelectedChartId(undefined);
|
|
334
|
+
}
|
|
335
|
+
focusSheetRef();
|
|
336
|
+
return true;
|
|
337
|
+
}, [getContext, onDeleteEmbed, copyEmbed, onDeleteEmbedRef, setSelectedChartId, focusSheetRef]);
|
|
338
|
+
/** A cell copy supersedes the object on the clipboard. */
|
|
170
339
|
const clearChartClipboard = useCallback(() => {
|
|
171
340
|
entryRef.current = undefined;
|
|
341
|
+
writtenRef.current = undefined;
|
|
172
342
|
}, []);
|
|
173
|
-
/** Whether a paste would create
|
|
174
|
-
const hasChartOnClipboard = useCallback(() =>
|
|
343
|
+
/** Whether a paste would create an object (drives the menu's Paste item). */
|
|
344
|
+
const hasChartOnClipboard = useCallback(() => {
|
|
345
|
+
const { readonly, canCreateEmbed } = getContext();
|
|
346
|
+
const entry = entryRef.current;
|
|
347
|
+
return Boolean(entry) && !readonly && (entry?.kind === "chart" || canCreateEmbed);
|
|
348
|
+
}, [getContext]);
|
|
175
349
|
/**
|
|
176
|
-
* Ctrl+V. Returns true when the clipboard held
|
|
177
|
-
*
|
|
350
|
+
* Ctrl+V. Returns true when the clipboard held an object and it was pasted (the caller must
|
|
351
|
+
* then skip the cell paste), false to fall through.
|
|
178
352
|
*/
|
|
179
353
|
const pasteChart = useCallback((e) => {
|
|
180
|
-
const { sheetId, readonly, selectedChartId } = getContext();
|
|
354
|
+
const { sheetId, readonly, selectedChartId, canCreateEmbed, policy, sheetExists } = getContext();
|
|
181
355
|
if (readonly) {
|
|
182
356
|
return false;
|
|
183
357
|
}
|
|
184
358
|
const data = e?.clipboardData;
|
|
185
|
-
|
|
186
|
-
|
|
359
|
+
// Text, HTML or files on the clipboard are a copy from elsewhere: they paste as cells,
|
|
360
|
+
// whatever custom type rides along.
|
|
361
|
+
if (carriesForeignContent(data)) {
|
|
187
362
|
clearChartClipboard();
|
|
188
363
|
return false;
|
|
189
364
|
}
|
|
365
|
+
const chartPayload = data?.getData(CHART_CLIPBOARD_MIME) || undefined;
|
|
366
|
+
const embedPayload = data?.getData(EMBED_CLIPBOARD_MIME) || undefined;
|
|
367
|
+
const payload = chartPayload ?? embedPayload;
|
|
368
|
+
let source;
|
|
369
|
+
// A payload from elsewhere is accepted (host kinds included) while it is parsed.
|
|
370
|
+
let parsed = false;
|
|
371
|
+
if (payload && payload === writtenRef.current && entryRef.current) {
|
|
372
|
+
// This grid's own copy, read back.
|
|
373
|
+
source = entryRef.current;
|
|
374
|
+
}
|
|
375
|
+
else if (chartPayload) {
|
|
376
|
+
parsed = true;
|
|
377
|
+
const chart = parseChartPayload(chartPayload, { sheetExists });
|
|
378
|
+
source = chart ? { kind: "chart", chart } : undefined;
|
|
379
|
+
}
|
|
380
|
+
else if (embedPayload) {
|
|
381
|
+
parsed = true;
|
|
382
|
+
const embed = parseEmbedPayload(embedPayload, {
|
|
383
|
+
...policy,
|
|
384
|
+
origin: typeof window === "undefined" ? undefined : window.location.origin,
|
|
385
|
+
});
|
|
386
|
+
source = embed ? { kind: "embed", embed } : undefined;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
source = entryRef.current;
|
|
390
|
+
}
|
|
391
|
+
if (!source) {
|
|
392
|
+
// A payload that is not a valid object pastes nothing; the cell paste reads the rest.
|
|
393
|
+
if (payload)
|
|
394
|
+
clearChartClipboard();
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
if (source.kind === "embed") {
|
|
398
|
+
const accepted = !canCreateEmbed
|
|
399
|
+
? undefined
|
|
400
|
+
: parsed
|
|
401
|
+
? source.embed
|
|
402
|
+
: acceptEmbed(source.embed);
|
|
403
|
+
if (!accepted)
|
|
404
|
+
return false;
|
|
405
|
+
source = { kind: "embed", embed: accepted };
|
|
406
|
+
}
|
|
190
407
|
e?.preventDefault();
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
408
|
+
const selected = findChart(selectedChartId) ?? findEmbed(selectedChartId);
|
|
409
|
+
const nearSource = positionOf(source).sheetId === sheetId && selected?.position.sheetId === sheetId;
|
|
410
|
+
const position = placeObject(positionOf(source), nearSource);
|
|
411
|
+
if (source.kind === "chart") {
|
|
412
|
+
createChartAt(source.chart, position);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
createEmbedAt(source.embed, position);
|
|
416
|
+
}
|
|
194
417
|
return true;
|
|
195
|
-
}, [
|
|
418
|
+
}, [
|
|
419
|
+
getContext,
|
|
420
|
+
clearChartClipboard,
|
|
421
|
+
acceptEmbed,
|
|
422
|
+
findChart,
|
|
423
|
+
findEmbed,
|
|
424
|
+
placeObject,
|
|
425
|
+
createChartAt,
|
|
426
|
+
createEmbedAt,
|
|
427
|
+
]);
|
|
196
428
|
/** Ctrl+D on a chart: a copy offset down-right, clipboard untouched. */
|
|
197
429
|
const duplicateChart = useCallback((chartId) => {
|
|
198
430
|
const chart = findChart(chartId);
|
|
199
431
|
if (!chart || getContext().readonly) {
|
|
200
432
|
return undefined;
|
|
201
433
|
}
|
|
202
|
-
return createChartAt(chart,
|
|
203
|
-
}, [findChart, getContext, createChartAt,
|
|
434
|
+
return createChartAt(chart, placeObject(chart.position, true));
|
|
435
|
+
}, [findChart, getContext, createChartAt, placeObject]);
|
|
436
|
+
/** Ctrl+D on a picture, shape or text box: a copy offset down-right, clipboard untouched. */
|
|
437
|
+
const duplicateEmbed = useCallback((embedId) => {
|
|
438
|
+
const embed = findEmbed(embedId);
|
|
439
|
+
const { readonly, canCreateEmbed } = getContext();
|
|
440
|
+
const accepted = embed && !readonly && canCreateEmbed ? acceptEmbed(embed) : undefined;
|
|
441
|
+
if (!accepted) {
|
|
442
|
+
return undefined;
|
|
443
|
+
}
|
|
444
|
+
return createEmbedAt(accepted, placeObject(accepted.position, true));
|
|
445
|
+
}, [findEmbed, getContext, acceptEmbed, createEmbedAt, placeObject]);
|
|
204
446
|
return {
|
|
205
447
|
copyChart,
|
|
206
448
|
cutChart,
|
|
207
449
|
pasteChart,
|
|
208
450
|
duplicateChart,
|
|
451
|
+
copyEmbed,
|
|
452
|
+
cutEmbed,
|
|
453
|
+
duplicateEmbed,
|
|
209
454
|
clearChartClipboard,
|
|
210
455
|
hasChartOnClipboard,
|
|
211
456
|
getSelectedChart,
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import type { CanvasGridProps, SpreadsheetTheme } from "../components/canvas-grid/typings";
|
|
5
5
|
import { type GetLinkedPictureSource } from "../components/embeds/linked-picture";
|
|
6
6
|
import type { OverlayPosition } from "../types";
|
|
7
|
+
import type { SheetPageLayout } from "../components/page-layout-view/compute-page-layout";
|
|
7
8
|
import type { ChartClipboard } from "./use-chart-clipboard";
|
|
8
9
|
import { type ContextMenuWrapperProps } from "./use-context-menu";
|
|
9
10
|
export type OverlayBounds = {
|
|
@@ -116,6 +117,11 @@ export type UseEmbedsChartsProps = {
|
|
|
116
117
|
* @param includeFrozen
|
|
117
118
|
*/
|
|
118
119
|
getCellCoordsFromOffset(x: number, y: number, includeFrozen?: boolean | undefined): CellInterface | null | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The cell at a point in sheet coordinates (the space objects are laid out in), whatever is
|
|
122
|
+
* scrolled and in whichever pane (`GridRef.getCellCoordsFromSheetOffset`).
|
|
123
|
+
*/
|
|
124
|
+
getCellCoordsFromSheetOffset?(x: number, y: number): CellInterface | null | undefined;
|
|
119
125
|
/**
|
|
120
126
|
* Get offset of a cel
|
|
121
127
|
* @param cell
|
|
@@ -253,8 +259,13 @@ export type UseEmbedsChartsProps = {
|
|
|
253
259
|
* Disable embeds
|
|
254
260
|
*/
|
|
255
261
|
disabled: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Page Layout view's pages (`CanvasGrid`'s page layout): an object crossing the gap between
|
|
264
|
+
* pages is drawn clipped per page. Omitted in Normal view and Page Break Preview.
|
|
265
|
+
*/
|
|
266
|
+
pageLayout?: Pick<SheetPageLayout, "rowBands" | "columnBands" | "getRowGap" | "getColumnGap">;
|
|
256
267
|
};
|
|
257
|
-
export declare const useEmbedsCharts: ({ scale, charts, embeds, slicers, sheetId, frozenRows, frozenColumns, getCellOffsetFromCoords, getCellCoordsFromOffset, getAbsolutePositionFromOffset, getRelativePositionFromOffset, ContextMenuWrapper, focusSheet, getBounds, selectedColor, onMoveChart, onResizeChart, chartClipboard, onMoveEmbed, onResizeEmbed, onDeleteChart, onUpdateChart, onChangeZOrder, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFilterTable, onFilterPivot, tables, pivotTables, getFormattedValue, getLinkedPictureSource, getSheetName, getChartComponent, getEmbedComponent, getSlicerComponent, readonly, locale, theme, backgroundColor, disabled, }: UseEmbedsChartsProps) => {
|
|
268
|
+
export declare const useEmbedsCharts: ({ scale, charts, embeds, slicers, sheetId, frozenRows, frozenColumns, getCellOffsetFromCoords, getCellCoordsFromOffset, getCellCoordsFromSheetOffset, getAbsolutePositionFromOffset, getRelativePositionFromOffset, ContextMenuWrapper, focusSheet, getBounds, selectedColor, onMoveChart, onResizeChart, chartClipboard, onMoveEmbed, onResizeEmbed, onDeleteChart, onUpdateChart, onChangeZOrder, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFilterTable, onFilterPivot, tables, pivotTables, getFormattedValue, getLinkedPictureSource, getSheetName, getChartComponent, getEmbedComponent, getSlicerComponent, readonly, locale, theme, backgroundColor, disabled, pageLayout, }: UseEmbedsChartsProps) => {
|
|
258
269
|
chartComponents: CategorizedComponents<React.JSX.Element>;
|
|
259
270
|
embedComponents: CategorizedComponents<React.JSX.Element>;
|
|
260
271
|
slicerComponents: CategorizedComponents<React.JSX.Element>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-embeds-charts.d.ts","sourceRoot":"","sources":["../../../hooks/use-embeds-charts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,IAAI,EACJ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAMN,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAO3C,OAAO,EACL,KAAK,sBAAsB,EAG5B,MAAM,qCAAqC,CAAC;AAa7C,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAiBjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,WAAW,GACX,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI;IACrC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,SAAS,EAAE,CAAC,EAAE,CAAC;IACf,YAAY,EAAE,CAAC,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC,EAAE,CAAC;CACnB,CA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