@rowsncolumns/spreadsheet 10.13.0 → 10.15.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/cell-input-context.atom.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/cjs/components/canvas-grid/index.js +225 -54
- package/dist/cjs/components/canvas-grid/typings.d.ts +20 -0
- package/dist/cjs/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts +1 -1
- package/dist/cjs/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/cjs/components/embeds/embed-draggable.js +24 -8
- 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/hooks/object-spec-schema.generated.d.ts.map +1 -1
- package/dist/cjs/hooks/object-spec-schema.generated.js +12 -0
- package/dist/cjs/hooks/use-embeds-charts.d.ts +6 -1
- package/dist/cjs/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/cjs/hooks/use-embeds-charts.js +46 -21
- 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-header-actions.d.ts +11 -1
- package/dist/cjs/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/cjs/hooks/use-header-actions.js +16 -6
- package/dist/cjs/hooks/use-move-columns-rows.d.ts +7 -1
- package/dist/cjs/hooks/use-move-columns-rows.d.ts.map +1 -1
- package/dist/cjs/hooks/use-move-columns-rows.js +12 -10
- 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/release-date.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +6 -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/cell-input-context.atom.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.d.ts.map +1 -1
- package/dist/esm/components/canvas-grid/index.js +176 -10
- package/dist/esm/components/canvas-grid/typings.d.ts +20 -0
- package/dist/esm/components/canvas-grid/typings.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts +1 -1
- package/dist/esm/components/embeds/embed-draggable.d.ts.map +1 -1
- package/dist/esm/components/embeds/embed-draggable.js +25 -9
- 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/hooks/object-spec-schema.generated.d.ts.map +1 -1
- package/dist/esm/hooks/object-spec-schema.generated.js +12 -0
- package/dist/esm/hooks/use-embeds-charts.d.ts +6 -1
- package/dist/esm/hooks/use-embeds-charts.d.ts.map +1 -1
- package/dist/esm/hooks/use-embeds-charts.js +45 -20
- 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-header-actions.d.ts +11 -1
- package/dist/esm/hooks/use-header-actions.d.ts.map +1 -1
- package/dist/esm/hooks/use-header-actions.js +12 -2
- package/dist/esm/hooks/use-move-columns-rows.d.ts +7 -1
- package/dist/esm/hooks/use-move-columns-rows.d.ts.map +1 -1
- package/dist/esm/hooks/use-move-columns-rows.js +11 -7
- 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/release-date.js +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +6 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-draggable.d.ts","sourceRoot":"","sources":["../../../../components/embeds/embed-draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,
|
|
1
|
+
{"version":3,"file":"embed-draggable.d.ts","sourceRoot":"","sources":["../../../../components/embeds/embed-draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAezB,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,aAAa,CAAC;AAErB,KAAK,mBAAmB,GAAG,IAAI,CAC7B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAClC,IAAI,GACJ,UAAU,GACV,UAAU,GACV,QAAQ,GACR,OAAO,GACP,SAAS,GACT,eAAe,CAClB,GAAG;IACF,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;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,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,qFAAqF;IACrF,kBAAkB,CAAC,IAAI,IAAI,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C;;;OAGG;IACH,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACxE;;;;OAIG;IACH,oBAAoB,CAAC,CACnB,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,GACtB,IAAI,CAAC;IACR;;OAEG;IACH,UAAU,EAAE,aAAa,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,CACR,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KACrC,KAAK,CAAC,SAAS,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AA+DF,eAAO,MAAM,cAAc,GAAI,qZAkC5B,mBAAmB,6BA0rBrB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { getOwnerDocument, useGridContext, useIsInRtlMirrorLayer, } from "@rowsncolumns/grid";
|
|
2
2
|
import { cn } from "@rowsncolumns/ui";
|
|
3
3
|
import { useAtomValue } from "jotai";
|
|
4
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import React, { useCallback, useContext, useEffect, useRef, useState, } from "react";
|
|
5
5
|
import { DraggableCore } from "react-draggable";
|
|
6
6
|
import { Resizable } from "react-resizable";
|
|
7
7
|
import { editingCellAtom } from "../../atoms/editing-cell.atom";
|
|
8
8
|
import { useIsomorphicLayoutEffect } from "../../hooks/use-isomorphic-layout-effect";
|
|
9
9
|
import { commandOrigins, mayReclaimFocus, mayTakeFocus, objectFocusTargetsAtom, sheetFocusTargetsAtom, } from "./object-focus";
|
|
10
|
+
import { PaneCopyContext, paneCopyPiece } from "./pane-copy";
|
|
10
11
|
import { resolvePageGaps, splitAcrossPages, toGapFree, toScreen, } from "./page-gaps";
|
|
11
12
|
/** The smallest width and height a resize leaves: react-resizable's default `minConstraints`. */
|
|
12
13
|
const MIN_OBJECT_SIZE = 20;
|
|
@@ -48,12 +49,14 @@ export const EmbedDraggable = ({ id, scale = 1, height, width, offsetXPixels, of
|
|
|
48
49
|
const unmirror = useIsInRtlMirrorLayer();
|
|
49
50
|
const physicalToLogicalX = unmirror ? -1 : 1;
|
|
50
51
|
const { getCellOffsetFromCoords } = useGridContext();
|
|
52
|
+
const paneCopy = useContext(PaneCopyContext);
|
|
51
53
|
const pageGaps = pageGapIndexes
|
|
52
54
|
? resolvePageGaps(pageGapIndexes, getCellOffsetFromCoords)
|
|
53
55
|
: undefined;
|
|
54
56
|
const position = getCellOffsetFromCoords?.(anchorCell);
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
+
// The anchors' offsets are stored in sheet pixels (100 % zoom), as the size is: drawn zoomed.
|
|
58
|
+
const x = (position?.x ?? 0) + offsetXPixels * scale;
|
|
59
|
+
const y = (position?.y ?? 0) + offsetYPixels * scale;
|
|
57
60
|
// Two anchors: the frame is whatever lies between them (a collapsed span
|
|
58
61
|
// after a delete draws nothing rather than a negative box)
|
|
59
62
|
const toPosition = toCell ? getCellOffsetFromCoords?.(toCell) : undefined;
|
|
@@ -61,13 +64,13 @@ export const EmbedDraggable = ({ id, scale = 1, height, width, offsetXPixels, of
|
|
|
61
64
|
// Across Page Layout's gaps the frame is what lies between the anchors on the sheet itself,
|
|
62
65
|
// not the gaps between them.
|
|
63
66
|
width = Math.max(0, pageGaps
|
|
64
|
-
? toGapFree(pageGaps.x, toPosition.x + toOffsetXPixels) -
|
|
67
|
+
? toGapFree(pageGaps.x, toPosition.x + toOffsetXPixels * scale) -
|
|
65
68
|
toGapFree(pageGaps.x, x)
|
|
66
|
-
: toPosition.x + toOffsetXPixels - x);
|
|
69
|
+
: toPosition.x + toOffsetXPixels * scale - x);
|
|
67
70
|
height = Math.max(0, pageGaps
|
|
68
|
-
? toGapFree(pageGaps.y, toPosition.y + toOffsetYPixels) -
|
|
71
|
+
? toGapFree(pageGaps.y, toPosition.y + toOffsetYPixels * scale) -
|
|
69
72
|
toGapFree(pageGaps.y, y)
|
|
70
|
-
: toPosition.y + toOffsetYPixels - y);
|
|
73
|
+
: toPosition.y + toOffsetYPixels * scale - y);
|
|
71
74
|
}
|
|
72
75
|
const [dimensions, setDimensions] = useState(() => ({
|
|
73
76
|
internalWidth: width,
|
|
@@ -475,6 +478,17 @@ export const EmbedDraggable = ({ id, scale = 1, height, width, offsetXPixels, of
|
|
|
475
478
|
height: internalHeight,
|
|
476
479
|
pieces: undefined,
|
|
477
480
|
};
|
|
481
|
+
/**
|
|
482
|
+
* On a split sheet this is one pane's copy of the object. It is drawn only in the panes it is
|
|
483
|
+
* visible in — judged by the STORED box, so a copy never disappears in the middle of its own
|
|
484
|
+
* drag — and tells its content which piece it is, as Page Layout's pieces do.
|
|
485
|
+
*/
|
|
486
|
+
const panePiece = paneCopy
|
|
487
|
+
? paneCopyPiece(paneCopy, { x, y, width, height })
|
|
488
|
+
: undefined;
|
|
489
|
+
if (paneCopy && !panePiece)
|
|
490
|
+
return null;
|
|
491
|
+
const pieceOfPanes = panePiece && panePiece.count > 1 ? panePiece : undefined;
|
|
478
492
|
return (React.createElement(DraggableCore, { nodeRef: nodeRef, onStart: handleMoveStart, onDrag: handleMove, onStop: handleMoveEnd, cancel: ".react-resizable-handle, .rnc-draggable-ignore", scale: 1, disabled: !draggable },
|
|
479
493
|
React.createElement(Resizable, { width: drawn.width, height: drawn.height, onResizeStart: handleResizeStart, onResize: handleResize, onResizeStop: handleResizeEnd,
|
|
480
494
|
// In Page Layout view the ratio is held on the object's own size (`handleResize`).
|
|
@@ -530,7 +544,9 @@ export const EmbedDraggable = ({ id, scale = 1, height, width, offsetXPixels, of
|
|
|
530
544
|
if (delta && draggable) {
|
|
531
545
|
// The grid must not scroll while the object is being nudged
|
|
532
546
|
e.preventDefault();
|
|
533
|
-
|
|
547
|
+
// A nudge is a step on the sheet (one sheet pixel, ten with Shift) at every zoom:
|
|
548
|
+
// laid out zoomed, so the same nudge stores the same offset at any zoom.
|
|
549
|
+
const step = (e.shiftKey ? NUDGE_STEP_SHIFT : NUDGE_STEP) * scale;
|
|
534
550
|
handleNudge(physicalToLogicalX * delta[0] * step, delta[1] * step);
|
|
535
551
|
return;
|
|
536
552
|
}
|
|
@@ -565,7 +581,7 @@ export const EmbedDraggable = ({ id, scale = 1, height, width, offsetXPixels, of
|
|
|
565
581
|
index,
|
|
566
582
|
count: pieces.length,
|
|
567
583
|
})))))
|
|
568
|
-
: children(internalWidth, internalHeight),
|
|
584
|
+
: children(internalWidth, internalHeight, pieceOfPanes),
|
|
569
585
|
drawn.pieces && borderColor
|
|
570
586
|
? drawn.pieces.map((piece, index) => {
|
|
571
587
|
// The frame's 1px border sits outside its content box: each piece's share of it
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { GridPane } from "@rowsncolumns/grid";
|
|
2
|
+
/**
|
|
3
|
+
* Excel's View ▸ Split: an object (a chart, a picture, a shape, a slicer) is drawn in every pane
|
|
4
|
+
* it is visible in, as Excel draws it. The grid's children render the object list once per pane
|
|
5
|
+
* block; this context tells each copy which pane it is in and what the panes are, so it can draw
|
|
6
|
+
* itself only where it shows and say which piece it is (see `paneCopyPiece`).
|
|
7
|
+
*
|
|
8
|
+
* Every copy is the same logical object: selecting, dragging or resizing any of them acts on the
|
|
9
|
+
* object, and the others follow when the change is stored.
|
|
10
|
+
*/
|
|
11
|
+
export type PaneCopy = {
|
|
12
|
+
paneId: GridPane["id"];
|
|
13
|
+
panes: GridPane[];
|
|
14
|
+
};
|
|
15
|
+
export declare const PaneCopyContext: import("react").Context<PaneCopy | undefined>;
|
|
16
|
+
type Box = {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** The panes a box in sheet coordinates is at least partly visible in, in pane order. */
|
|
23
|
+
export declare const panesShowing: (panes: GridPane[], box: Box) => GridPane[];
|
|
24
|
+
/**
|
|
25
|
+
* Which piece this copy is: its index among the panes the object shows in, and how many there
|
|
26
|
+
* are — the same `{ index, count }` an object cut by Page Layout's page boundaries gives its
|
|
27
|
+
* content, so a host that registers its component by id registers the first piece only.
|
|
28
|
+
* `undefined` when this pane does not show the object, which is then not drawn here at all.
|
|
29
|
+
*/
|
|
30
|
+
export declare const paneCopyPiece: (copy: PaneCopy, box: Box) => {
|
|
31
|
+
index: number;
|
|
32
|
+
count: number;
|
|
33
|
+
} | undefined;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=pane-copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pane-copy.d.ts","sourceRoot":"","sources":["../../../../components/embeds/pane-copy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,eAAe,+CAAiD,CAAC;AAE9E,KAAK,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,yFAAyF;AACzF,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,EAAE,EAAE,KAAK,GAAG,eAUpD,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,QAAQ,EAAE,KAAK,GAAG;;;aAIrD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
export const PaneCopyContext = createContext(undefined);
|
|
3
|
+
/** The panes a box in sheet coordinates is at least partly visible in, in pane order. */
|
|
4
|
+
export const panesShowing = (panes, box) => panes.filter((pane) => {
|
|
5
|
+
const x = box.x - pane.offsetLeft;
|
|
6
|
+
const y = box.y - pane.offsetTop;
|
|
7
|
+
return (x < pane.rect.x + pane.rect.width &&
|
|
8
|
+
x + box.width > pane.rect.x &&
|
|
9
|
+
y < pane.rect.y + pane.rect.height &&
|
|
10
|
+
y + box.height > pane.rect.y);
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Which piece this copy is: its index among the panes the object shows in, and how many there
|
|
14
|
+
* are — the same `{ index, count }` an object cut by Page Layout's page boundaries gives its
|
|
15
|
+
* content, so a host that registers its component by id registers the first piece only.
|
|
16
|
+
* `undefined` when this pane does not show the object, which is then not drawn here at all.
|
|
17
|
+
*/
|
|
18
|
+
export const paneCopyPiece = (copy, box) => {
|
|
19
|
+
const showing = panesShowing(copy.panes, box);
|
|
20
|
+
const index = showing.findIndex((pane) => pane.id === copy.paneId);
|
|
21
|
+
return index === -1 ? undefined : { index, count: showing.length };
|
|
22
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-spec-schema.generated.d.ts","sourceRoot":"","sources":["../../../hooks/object-spec-schema.generated.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,GACtE;IAAE,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AAE,CAAA;CAAE,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAqqJ3D,CAAC"}
|
|
@@ -2730,6 +2730,18 @@ export const OBJECT_SPEC_SCHEMA = {
|
|
|
2730
2730
|
}
|
|
2731
2731
|
]
|
|
2732
2732
|
},
|
|
2733
|
+
"subtitleTextFormat": {
|
|
2734
|
+
"kind": "union",
|
|
2735
|
+
"of": [
|
|
2736
|
+
{
|
|
2737
|
+
"kind": "object",
|
|
2738
|
+
"ref": "ChartTextFormat"
|
|
2739
|
+
},
|
|
2740
|
+
{
|
|
2741
|
+
"kind": "null"
|
|
2742
|
+
}
|
|
2743
|
+
]
|
|
2744
|
+
},
|
|
2733
2745
|
"title": {
|
|
2734
2746
|
"kind": "union",
|
|
2735
2747
|
"of": [
|
|
@@ -117,6 +117,11 @@ export type UseEmbedsChartsProps = {
|
|
|
117
117
|
* @param includeFrozen
|
|
118
118
|
*/
|
|
119
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;
|
|
120
125
|
/**
|
|
121
126
|
* Get offset of a cel
|
|
122
127
|
* @param cell
|
|
@@ -260,7 +265,7 @@ export type UseEmbedsChartsProps = {
|
|
|
260
265
|
*/
|
|
261
266
|
pageLayout?: Pick<SheetPageLayout, "rowBands" | "columnBands" | "getRowGap" | "getColumnGap">;
|
|
262
267
|
};
|
|
263
|
-
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, pageLayout, }: 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) => {
|
|
264
269
|
chartComponents: CategorizedComponents<React.JSX.Element>;
|
|
265
270
|
embedComponents: CategorizedComponents<React.JSX.Element>;
|
|
266
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,E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AG,MAAM,WACV,MAAM,WACN,MAAM,WACN,cAAc;;CAsyB5B,CAAC"}
|
|
@@ -86,7 +86,7 @@ const validateEmbeds = (embedsOrCharts, sheetId) => {
|
|
|
86
86
|
return obj;
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, frozenRows = 0, frozenColumns = 0, getCellOffsetFromCoords, getCellCoordsFromOffset, getAbsolutePositionFromOffset, getRelativePositionFromOffset, ContextMenuWrapper = DefaultContextMenuWrapper, focusSheet, getBounds, selectedColor = "#1a73e8", onMoveChart, onResizeChart, chartClipboard, onMoveEmbed, onResizeEmbed, onDeleteChart, onUpdateChart, onChangeZOrder, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFilterTable, onFilterPivot, tables, pivotTables, getFormattedValue, getLinkedPictureSource, getSheetName, getChartComponent = defaultGetChartComponent, getEmbedComponent = defaultGetEmbedComponent, getSlicerComponent = defaultGetSlicerComponent, readonly, locale, theme, backgroundColor, disabled, pageLayout, }) => {
|
|
89
|
+
export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, frozenRows = 0, frozenColumns = 0, getCellOffsetFromCoords, getCellCoordsFromOffset, getCellCoordsFromSheetOffset, getAbsolutePositionFromOffset, getRelativePositionFromOffset, ContextMenuWrapper = DefaultContextMenuWrapper, focusSheet, getBounds, selectedColor = "#1a73e8", onMoveChart, onResizeChart, chartClipboard, onMoveEmbed, onResizeEmbed, onDeleteChart, onUpdateChart, onChangeZOrder, onDeleteEmbed, onRequestEditEmbed, onMoveSlicer, onResizeSlicer, onDeleteSlicer, onDeleteObjects, onRequestEditSlicer, onFilterTable, onFilterPivot, tables, pivotTables, getFormattedValue, getLinkedPictureSource, getSheetName, getChartComponent = defaultGetChartComponent, getEmbedComponent = defaultGetEmbedComponent, getSlicerComponent = defaultGetSlicerComponent, readonly, locale, theme, backgroundColor, disabled, pageLayout, }) => {
|
|
90
90
|
/**
|
|
91
91
|
* Page Layout view: the row and column each page starts at and the gap before it (grid pixels),
|
|
92
92
|
* for `EmbedDraggable`'s `pageGaps`; resolved into grid coordinates where they are used.
|
|
@@ -416,9 +416,17 @@ export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, f
|
|
|
416
416
|
const bounds = getBounds();
|
|
417
417
|
const lookupX = bounds.right !== undefined && x >= bounds.right ? bounds.right - 1 : x;
|
|
418
418
|
const lookupY = bounds.bottom !== undefined && y >= bounds.bottom ? bounds.bottom - 1 : y;
|
|
419
|
-
|
|
420
|
-
//
|
|
421
|
-
|
|
419
|
+
// An object's corners are in SHEET coordinates (it is laid out from its anchor cell's
|
|
420
|
+
// offset), so the cell is read there directly: through the page it would be read again
|
|
421
|
+
// through the scroll position of the window, or of the pane under it on a split sheet, and
|
|
422
|
+
// a sheet scrolled by 200 px would store E21 − 189 px for what is E12 + 0.
|
|
423
|
+
const anchorCell = getCellCoordsFromSheetOffset
|
|
424
|
+
? getCellCoordsFromSheetOffset(lookupX, lookupY)
|
|
425
|
+
: (() => {
|
|
426
|
+
const position = getAbsolutePositionFromOffset(lookupX, lookupY);
|
|
427
|
+
// Use includeFrozen=true to detect cells in all regions
|
|
428
|
+
return getCellCoordsFromOffset(position?.x ?? 0, position?.y ?? 0, true);
|
|
429
|
+
})();
|
|
422
430
|
const cellPosition = anchorCell
|
|
423
431
|
? getCellOffsetFromCoords(anchorCell)
|
|
424
432
|
: undefined;
|
|
@@ -428,6 +436,7 @@ export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, f
|
|
|
428
436
|
}, [
|
|
429
437
|
getCellOffsetFromCoords,
|
|
430
438
|
getCellCoordsFromOffset,
|
|
439
|
+
getCellCoordsFromSheetOffset,
|
|
431
440
|
getAbsolutePositionFromOffset,
|
|
432
441
|
getBounds,
|
|
433
442
|
]);
|
|
@@ -450,6 +459,20 @@ export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, f
|
|
|
450
459
|
}
|
|
451
460
|
return getCellPositionAt(clampedX, clampedY);
|
|
452
461
|
}, [getCellPositionAt, getBounds]);
|
|
462
|
+
/**
|
|
463
|
+
* What a gesture STORES for a point: its cell and the offset inside it in sheet pixels — 100 %
|
|
464
|
+
* zoom, as an object's size is stored and as xlsx writes it — whatever the zoom the gesture
|
|
465
|
+
* was made at. The layout (and `getCellPosition`) is in zoomed pixels; at any zoom but 100 %
|
|
466
|
+
* the offset is divided by the zoom and rounded to a whole pixel, so the same gesture on the
|
|
467
|
+
* sheet stores the same anchor at every zoom. At 100 % the offset is stored as measured.
|
|
468
|
+
*/
|
|
469
|
+
const getStoredPosition = useCallback((x, y) => {
|
|
470
|
+
const position = getCellPosition(x, y);
|
|
471
|
+
if (!position || scale === 1)
|
|
472
|
+
return position;
|
|
473
|
+
const [cell, offsetX, offsetY] = position;
|
|
474
|
+
return [cell, Math.round(offsetX / scale), Math.round(offsetY / scale)];
|
|
475
|
+
}, [getCellPosition, scale]);
|
|
453
476
|
// Alt-drag / Alt-resize: nearest cell corner to a point, in the same pixel space the objects are laid out in
|
|
454
477
|
const snapToCellGrid = useCallback((x, y) => {
|
|
455
478
|
const position = getCellPosition(x, y);
|
|
@@ -482,13 +505,13 @@ export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, f
|
|
|
482
505
|
const bottom = gaps
|
|
483
506
|
? toScreen(gaps.y, toGapFree(gaps.y, y) + height)
|
|
484
507
|
: y + height;
|
|
485
|
-
const position =
|
|
508
|
+
const position = getStoredPosition(right, bottom);
|
|
486
509
|
if (!position) {
|
|
487
510
|
return undefined;
|
|
488
511
|
}
|
|
489
512
|
const [toCell, toOffsetXPixels, toOffsetYPixels] = position;
|
|
490
513
|
return { toCell, toOffsetXPixels, toOffsetYPixels };
|
|
491
|
-
}, [
|
|
514
|
+
}, [getStoredPosition, pageGaps, getCellOffsetFromCoords]);
|
|
492
515
|
const getChartOverlay = useCallback((id) => charts?.find((chart) => chart.chartId === id)?.position
|
|
493
516
|
?.overlayPosition, [charts]);
|
|
494
517
|
const getEmbedOverlay = useCallback((id) => embeds?.find((embed) => embed.embedId === id)?.position
|
|
@@ -497,65 +520,67 @@ export const useEmbedsCharts = ({ scale = 1, charts, embeds, slicers, sheetId, f
|
|
|
497
520
|
?.overlayPosition, [slicers]);
|
|
498
521
|
// Callback when user moves a chart
|
|
499
522
|
const handleMove = useCallback((id, x, y, width, height) => {
|
|
500
|
-
const position =
|
|
523
|
+
const position = getStoredPosition(x, y);
|
|
501
524
|
if (!position) {
|
|
502
525
|
return;
|
|
503
526
|
}
|
|
504
527
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
505
528
|
onMoveChart?.(id, anchorCell, offsetXPixels, offsetYPixels, getToAnchor(getChartOverlay(id), x, y, width, height));
|
|
506
|
-
}, [onMoveChart,
|
|
529
|
+
}, [onMoveChart, getStoredPosition, getToAnchor, getChartOverlay]);
|
|
507
530
|
// Callback when resizes an embed
|
|
508
531
|
const handleEmbedResize = useCallback((id, x, y, width, height) => {
|
|
509
|
-
const position =
|
|
532
|
+
const position = getStoredPosition(x, y);
|
|
510
533
|
if (!position) {
|
|
511
534
|
return;
|
|
512
535
|
}
|
|
513
536
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
514
537
|
onResizeEmbed?.(id, sheetId, anchorCell, offsetXPixels, offsetYPixels, width, height, getToAnchor(getEmbedOverlay(id), x, y, width * scale, height * scale));
|
|
515
|
-
}, [onResizeEmbed, sheetId, scale,
|
|
538
|
+
}, [onResizeEmbed, sheetId, scale, getStoredPosition, getToAnchor, getEmbedOverlay]);
|
|
516
539
|
// Callback when user moves a chart
|
|
517
540
|
const handleEmbedMove = useCallback((id, x, y, width, height) => {
|
|
518
|
-
const position =
|
|
541
|
+
const position = getStoredPosition(x, y);
|
|
519
542
|
if (!position) {
|
|
520
543
|
return;
|
|
521
544
|
}
|
|
522
545
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
523
546
|
onMoveEmbed?.(id, sheetId, anchorCell, offsetXPixels, offsetYPixels, getToAnchor(getEmbedOverlay(id), x, y, width, height));
|
|
524
|
-
}, [onMoveEmbed, sheetId,
|
|
547
|
+
}, [onMoveEmbed, sheetId, getStoredPosition, getToAnchor, getEmbedOverlay]);
|
|
525
548
|
// Callback when resizes a chart
|
|
526
549
|
const handleResize = useCallback((id, x, y, width, height) => {
|
|
527
|
-
const position =
|
|
550
|
+
const position = getStoredPosition(x, y);
|
|
528
551
|
if (!position) {
|
|
529
552
|
return;
|
|
530
553
|
}
|
|
531
554
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
532
555
|
onResizeChart?.(id, anchorCell, offsetXPixels, offsetYPixels, width, height, getToAnchor(getChartOverlay(id), x, y, width * scale, height * scale));
|
|
533
|
-
}, [onResizeChart, scale,
|
|
556
|
+
}, [onResizeChart, scale, getStoredPosition, getToAnchor, getChartOverlay]);
|
|
534
557
|
// Callback when user resizes a slicer
|
|
535
558
|
const handleSlicerResize = useCallback((id, x, y, width, height) => {
|
|
536
|
-
const position =
|
|
559
|
+
const position = getStoredPosition(x, y);
|
|
537
560
|
if (!position) {
|
|
538
561
|
return;
|
|
539
562
|
}
|
|
540
563
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
541
564
|
onResizeSlicer?.(id, sheetId, anchorCell, offsetXPixels, offsetYPixels, width, height, getToAnchor(getSlicerOverlay(id), x, y, width * scale, height * scale));
|
|
542
|
-
}, [onResizeSlicer, sheetId, scale,
|
|
565
|
+
}, [onResizeSlicer, sheetId, scale, getStoredPosition, getToAnchor, getSlicerOverlay]);
|
|
543
566
|
// Callback when user moves a slicer
|
|
544
567
|
const handleSlicerMove = useCallback((id, x, y, width, height) => {
|
|
545
|
-
const position =
|
|
568
|
+
const position = getStoredPosition(x, y);
|
|
546
569
|
if (!position) {
|
|
547
570
|
return;
|
|
548
571
|
}
|
|
549
572
|
const [anchorCell, offsetXPixels, offsetYPixels] = position;
|
|
550
573
|
onMoveSlicer?.(id, sheetId, anchorCell, offsetXPixels, offsetYPixels, getToAnchor(getSlicerOverlay(id), x, y, width, height));
|
|
551
|
-
}, [onMoveSlicer, sheetId,
|
|
574
|
+
}, [onMoveSlicer, sheetId, getStoredPosition, getToAnchor, getSlicerOverlay]);
|
|
552
575
|
// The frozen-pane layer an object renders in: the cell its top-left corner
|
|
553
576
|
// actually sits in (anchor walked forward by the pixel offsets) against the
|
|
554
577
|
// frozen counts. Charts, pictures / embeds and slicers share it, so an object
|
|
555
578
|
// anchored in the frozen rows stays put while the body scrolls, like Excel.
|
|
556
579
|
const placementOf = useCallback(({ anchorCell, offsetXPixels, offsetYPixels, }) => getOverlayPlacement(anchorCell
|
|
557
|
-
? resolveOverlayCell(anchorCell,
|
|
558
|
-
|
|
580
|
+
? resolveOverlayCell(anchorCell,
|
|
581
|
+
// Offsets are stored in sheet pixels; the cells are measured zoomed.
|
|
582
|
+
(offsetXPixels ?? 0) * scale, (offsetYPixels ?? 0) * scale, getCellOffsetFromCoords, frozenRows, frozenColumns)
|
|
583
|
+
: anchorCell, frozenRows, frozenColumns), [frozenRows, frozenColumns, getCellOffsetFromCoords, scale]);
|
|
559
584
|
// Chart components - categorized by frozen pane placement
|
|
560
585
|
const chartComponents = useMemo(() => {
|
|
561
586
|
const result = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GridChildrenProps, GridPane } from "@rowsncolumns/grid";
|
|
1
|
+
import type { CellInterface, CellPosition, GridChildrenProps, GridPane } from "@rowsncolumns/grid";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { CanvasGridProps } from "../components/canvas-grid/typings";
|
|
4
4
|
import type { SheetCoordinate, SheetRange } from "../types";
|
|
@@ -30,11 +30,13 @@ type UseGridChildrenProps = {
|
|
|
30
30
|
*/
|
|
31
31
|
editorPaneId?: GridPane["id"];
|
|
32
32
|
popoverRange?: SheetRange | SheetCoordinate;
|
|
33
|
+
/** Where a cell is laid out: on a split sheet, what decides the pane a note or handle is in. */
|
|
34
|
+
getCellOffsetFromCoords?(cell: CellInterface): CellPosition | undefined;
|
|
33
35
|
gridLineWidth?: number;
|
|
34
36
|
frozenColumns: number;
|
|
35
37
|
frozenRows: number;
|
|
36
38
|
};
|
|
37
|
-
export declare const useGridChildren: ({ stickyEditor, editorComponent, shownNoteComponents, chartComponents, embedComponents, slicerComponents, pivotPlaceholders, tableResizers, hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers, gridLineWidth, frozenColumns, frozenRows, headerMenuComponent, isHeaderMenuInFrozenColumn, popoverRange, popoverComponent, cellExpandComponent, arrowComponents, editorPaneId, }: UseGridChildrenProps) => (props: GridChildrenProps) => React.JSX.Element;
|
|
39
|
+
export declare const useGridChildren: ({ stickyEditor, editorComponent, shownNoteComponents, chartComponents, embedComponents, slicerComponents, pivotPlaceholders, tableResizers, hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers, gridLineWidth, frozenColumns, frozenRows, headerMenuComponent, isHeaderMenuInFrozenColumn, popoverRange, popoverComponent, cellExpandComponent, arrowComponents, editorPaneId, getCellOffsetFromCoords, }: UseGridChildrenProps) => (props: GridChildrenProps) => React.JSX.Element;
|
|
38
40
|
export declare const StyledGridChildren: ({ className, elevate, ...props }: React.HTMLAttributes<HTMLDivElement> & {
|
|
39
41
|
elevate?: boolean;
|
|
40
42
|
}) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-grid-children.d.ts","sourceRoot":"","sources":["../../../hooks/use-grid-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-grid-children.d.ts","sourceRoot":"","sources":["../../../hooks/use-grid-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EAC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C7D,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACvD,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,uEAAuE;IACvE,eAAe,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;IACrD;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC;IAC5C,gGAAgG;IAChG,uBAAuB,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,ibAwB7B,oBAAoB,aAiBX,iBAAiB,sBAsS5B,CAAC;AA+BF,eAAO,MAAM,kBAAkB,GAAI,kCAIhC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,sBAS9D,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { cn } from "@rowsncolumns/ui";
|
|
2
2
|
import React, { useCallback } from "react";
|
|
3
3
|
import { useEditingCellCoordinate } from "../atoms";
|
|
4
|
+
import { PaneCopyContext, panesShowing } from "../components/embeds/pane-copy";
|
|
4
5
|
import { isSheetRange } from "../helpers";
|
|
5
6
|
/** Shared, so a sheet with no split hands the same empty list to every render. */
|
|
6
7
|
const EMPTY_PANES = [];
|
|
7
|
-
export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteComponents, chartComponents, embedComponents, slicerComponents, pivotPlaceholders, tableResizers, hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers, gridLineWidth = 1, frozenColumns, frozenRows, headerMenuComponent, isHeaderMenuInFrozenColumn, popoverRange, popoverComponent, cellExpandComponent, arrowComponents, editorPaneId, }) => {
|
|
8
|
+
export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteComponents, chartComponents, embedComponents, slicerComponents, pivotPlaceholders, tableResizers, hiddenColumnMarkers, frozenHiddenColumnMarkers, hiddenRowMarkers, frozenHiddenRowMarkers, gridLineWidth = 1, frozenColumns, frozenRows, headerMenuComponent, isHeaderMenuInFrozenColumn, popoverRange, popoverComponent, cellExpandComponent, arrowComponents, editorPaneId, getCellOffsetFromCoords, }) => {
|
|
8
9
|
const editingCellCoordinate = useEditingCellCoordinate();
|
|
9
10
|
// Quite a bit of logic for non sticky editor
|
|
10
11
|
// Remove if majority dont use this
|
|
@@ -19,6 +20,8 @@ export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteCompon
|
|
|
19
20
|
* block below, unchanged.
|
|
20
21
|
*/
|
|
21
22
|
const isSplit = panes.length > 1;
|
|
23
|
+
/** What each pane's copy of an object is told: its pane, and all of them. */
|
|
24
|
+
const paneCopies = panes.map((pane) => ({ paneId: pane.id, panes }));
|
|
22
25
|
/**
|
|
23
26
|
* Two notions, deliberately apart. The EDITOR belongs to the pane the edit started in and
|
|
24
27
|
* stays there while that pane scrolls. Everything else that exists once — the comment /
|
|
@@ -29,6 +32,40 @@ export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteCompon
|
|
|
29
32
|
panes[0]?.id;
|
|
30
33
|
const overlayOwningPaneId = panes.find((pane) => pane.id === activePaneId)?.id ?? panes[0]?.id;
|
|
31
34
|
/** The bottom of the leading pane: what the frozen column strip is cut off at. */
|
|
35
|
+
/**
|
|
36
|
+
* What exists once and belongs to a cell — a note shown on the sheet, a table's resize
|
|
37
|
+
* handle, a pivot table's placeholder — is drawn in the pane that shows its cell: the pane
|
|
38
|
+
* being worked in when it shows it, else the first that does, else the leading pane (where
|
|
39
|
+
* a cell no pane shows was drawn before, clipped). Excel draws such shapes in every pane
|
|
40
|
+
* they show in; these are drawn once because a shown note carries its own editing state.
|
|
41
|
+
*/
|
|
42
|
+
const paneOfCell = (cell) => {
|
|
43
|
+
const box = cell ? getCellOffsetFromCoords?.(cell) : undefined;
|
|
44
|
+
if (!box)
|
|
45
|
+
return panes[0]?.id;
|
|
46
|
+
const showing = panesShowing(panes, box);
|
|
47
|
+
return (showing.find((pane) => pane.id === overlayOwningPaneId) ??
|
|
48
|
+
showing[0] ??
|
|
49
|
+
panes[0])?.id;
|
|
50
|
+
};
|
|
51
|
+
const byPane = (elements, cellOf) => {
|
|
52
|
+
const groups = new Map();
|
|
53
|
+
if (!isSplit || !elements)
|
|
54
|
+
return groups;
|
|
55
|
+
for (const element of elements) {
|
|
56
|
+
const id = paneOfCell(cellOf(element));
|
|
57
|
+
const group = groups.get(id);
|
|
58
|
+
if (group)
|
|
59
|
+
group.push(element);
|
|
60
|
+
else
|
|
61
|
+
groups.set(id, [element]);
|
|
62
|
+
}
|
|
63
|
+
return groups;
|
|
64
|
+
};
|
|
65
|
+
const notesByPane = byPane(shownNoteComponents?.body, (element) => element.props.cell);
|
|
66
|
+
const tableResizersByPane = byPane(tableResizers, (element) => element.props.cornerCell);
|
|
67
|
+
const pivotPlaceholdersByPane = byPane(pivotPlaceholders, (element) => element.props
|
|
68
|
+
.pivotTable?.targetPosition);
|
|
32
69
|
const leadingBottom = panes[0]
|
|
33
70
|
? panes[0].rect.y + panes[0].rect.height
|
|
34
71
|
: undefined;
|
|
@@ -52,13 +89,17 @@ export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteCompon
|
|
|
52
89
|
pointerEvents: "all",
|
|
53
90
|
} }, headerMenuComponent)),
|
|
54
91
|
isSplit ? (panes.map((pane, index) => {
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
92
|
+
// Charts, pictures, shapes and slicers are drawn in every pane they are visible in,
|
|
93
|
+
// as Excel draws them: each pane renders the object list inside a `PaneCopyContext`,
|
|
94
|
+
// and each copy draws itself only where it shows (`EmbedDraggable`). Every copy is
|
|
95
|
+
// the same object — selection, drag and resize work from any of them.
|
|
96
|
+
//
|
|
97
|
+
// A note shown on the sheet, a table's resize handle and a pivot placeholder are
|
|
98
|
+
// drawn in the pane that shows their cell (`paneOfCell`). Trace arrows are the
|
|
99
|
+
// host's drawing, laid out in sheet coordinates: every pane draws them and clips
|
|
100
|
+
// them, as Excel draws them in every pane they show in. A host places its own
|
|
101
|
+
// overlays per pane with `getGridRef()?.getDrawnRects(range)`. The editor and the
|
|
102
|
+
// popover exist once too, and belong to the pane being worked in.
|
|
62
103
|
const isEditorPane = pane.id === editorOwningPaneId;
|
|
63
104
|
const isOverlayPane = pane.id === overlayOwningPaneId;
|
|
64
105
|
return (React.createElement(StyledGridChildren, { key: `pane-children-${pane.id}`, style: {
|
|
@@ -68,24 +109,25 @@ export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteCompon
|
|
|
68
109
|
height: pane.rect.height,
|
|
69
110
|
} },
|
|
70
111
|
React.createElement("div", { style: {
|
|
71
|
-
transform: `translate(-${pane.
|
|
112
|
+
transform: `translate(-${pane.offsetLeft + pane.rect.x}px, -${pane.offsetTop + pane.rect.y}px)`,
|
|
72
113
|
} },
|
|
73
|
-
|
|
114
|
+
tableResizersByPane.get(pane.id),
|
|
74
115
|
!stickyEditor &&
|
|
75
116
|
stickyEditorPlacement === "body" &&
|
|
76
117
|
isEditorPane
|
|
77
118
|
? editorComponent
|
|
78
119
|
: null,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
120
|
+
React.createElement(PaneCopyContext.Provider, { value: paneCopies[index] },
|
|
121
|
+
chartComponents.body,
|
|
122
|
+
embedComponents?.body,
|
|
123
|
+
slicerComponents?.body),
|
|
124
|
+
notesByPane.get(pane.id),
|
|
125
|
+
pivotPlaceholdersByPane.get(pane.id),
|
|
84
126
|
popoverPlacement === "body" && isOverlayPane
|
|
85
127
|
? popoverComponent
|
|
86
128
|
: null,
|
|
87
129
|
isOverlayPane ? cellExpandComponent : null,
|
|
88
|
-
|
|
130
|
+
arrowComponents)));
|
|
89
131
|
})) : (React.createElement(StyledGridChildren, { style: {
|
|
90
132
|
top: frozenRowHeight + gridLineWidth,
|
|
91
133
|
left: frozenColumnWidth + gridLineWidth,
|
|
@@ -178,6 +220,7 @@ export const useGridChildren = ({ stickyEditor, editorComponent, shownNoteCompon
|
|
|
178
220
|
cellExpandComponent,
|
|
179
221
|
arrowComponents,
|
|
180
222
|
editorPaneId,
|
|
223
|
+
getCellOffsetFromCoords,
|
|
181
224
|
]);
|
|
182
225
|
};
|
|
183
226
|
/**
|
|
@@ -7,7 +7,17 @@ import type { useSelection } from "./use-selection";
|
|
|
7
7
|
type UseHeaderActions = {
|
|
8
8
|
backgroundColor?: string;
|
|
9
9
|
activeCell?: CellInterface | null;
|
|
10
|
+
/**
|
|
11
|
+
* What the hovered heading is drawn offset by: the window's scroll position, or on a split
|
|
12
|
+
* sheet the offset of the band of headings under the pointer.
|
|
13
|
+
*/
|
|
10
14
|
getScrollPosition: () => ScrollCoords | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The window's own scroll position, which the layer the header menu is drawn in follows; on a
|
|
17
|
+
* split sheet the menu is shifted from it to the band its heading is drawn in. Defaults to
|
|
18
|
+
* `getScrollPosition`.
|
|
19
|
+
*/
|
|
20
|
+
getWindowScrollPosition?: () => ScrollCoords | undefined;
|
|
11
21
|
getCellOffsetFromCoords: (cell: CellInterface) => CellPosition | undefined;
|
|
12
22
|
getRelativePositionFromOffset: (x: number, y: number) => PosXYRequired | null | undefined;
|
|
13
23
|
/**
|
|
@@ -63,7 +73,7 @@ type UseHeaderActions = {
|
|
|
63
73
|
* @param param0
|
|
64
74
|
* @returns
|
|
65
75
|
*/
|
|
66
|
-
export declare const useHeaderActions: ({ activeCell, getScrollPosition, getCellOffsetFromCoords, getRelativePositionFromOffset, onResize, onAutoFit, isRowHeader, isColumnHeader, showContextMenu, selectColumn, setActiveCell, getViewPort, isHiddenColumn, focusSheet, frozenRows, frozenColumns, showHeaderMenuButton, selectionTopBound, resizerDimension, headerBorderWidth, minDimension, containerHeight, containerWidth, backgroundColor, scale, headerMenuWidth, sheetId, selectedRowHeaders, selectedColumnHeaders, enableResizerOverflow, }: UseHeaderActions) => {
|
|
76
|
+
export declare const useHeaderActions: ({ activeCell, getScrollPosition, getWindowScrollPosition, getCellOffsetFromCoords, getRelativePositionFromOffset, onResize, onAutoFit, isRowHeader, isColumnHeader, showContextMenu, selectColumn, setActiveCell, getViewPort, isHiddenColumn, focusSheet, frozenRows, frozenColumns, showHeaderMenuButton, selectionTopBound, resizerDimension, headerBorderWidth, minDimension, containerHeight, containerWidth, backgroundColor, scale, headerMenuWidth, sheetId, selectedRowHeaders, selectedColumnHeaders, enableResizerOverflow, }: UseHeaderActions) => {
|
|
67
77
|
headerMenuComponent: React.JSX.Element | null;
|
|
68
78
|
isHeaderMenuInFrozenColumn: boolean;
|
|
69
79
|
headerResizer: React.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-header-actions.d.ts","sourceRoot":"","sources":["../../../hooks/use-header-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,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