@sheetxl/grid-react 0.8.0-beta.1 → 0.8.0-beta.3
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/browser/cjs/index.cjs +3 -3
- package/browser/esm/index.mjs +1741 -1278
- package/node/esm/index.mjs +1742 -1272
- package/package.json +3 -3
- package/types/src/cell/CellRenderer.d.ts +14 -3
- package/types/src/editor/DefaultEditable.d.ts +9 -0
- package/types/src/editor/EditSession.d.ts +6 -0
- package/types/src/editor/EditState.d.ts +6 -0
- package/types/src/editor/EditorInput.d.ts +2 -1
- package/types/src/editor/useEditorKeymap.d.ts +11 -0
- package/types/src/header/useHeaderSelectionPointer.d.ts +6 -2
- package/types/src/layer/GridFloatPanel.d.ts +18 -0
- package/types/src/layer/RangeFloatLayer.d.ts +5 -0
- package/types/src/layer/index.d.ts +1 -0
- package/types/src/list/CheckboxList.d.ts +11 -0
- package/types/src/list/List.d.ts +11 -2
- package/types/src/list/ListSearch.d.ts +31 -0
- package/types/src/list/ListSurface.d.ts +25 -5
- package/types/src/list/PickList.d.ts +71 -0
- package/types/src/list/_measureText.d.ts +14 -0
- package/types/src/list/index.d.ts +2 -0
- package/types/src/range/DragHandle.d.ts +14 -0
- package/types/src/range/Draggable.d.ts +111 -6
- package/types/src/range/FillHandle.d.ts +28 -1
- package/types/src/range/RangeInsertBar.d.ts +91 -0
- package/types/src/range/index.d.ts +2 -0
- package/types/src/selection/SelectionLayer.d.ts +91 -9
- package/types/src/selection/SelectionStyle.d.ts +30 -0
- package/types/src/selection/useDragCells.d.ts +36 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { RangeCoords } from '@sheetxl/utils';
|
|
2
|
+
import { CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
3
3
|
import { VisualSVGProps } from '../svg';
|
|
4
4
|
import { DragHandleRenderProps } from './DragHandle';
|
|
5
5
|
/**
|
|
@@ -29,6 +29,16 @@ export interface FillHandleProps extends VisualSVGProps {
|
|
|
29
29
|
onDragMove?: (range: RangeCoords, e: React.PointerEvent) => void;
|
|
30
30
|
/** Drag released: commit the fill to this destination range. Fires only when there IS a fill. */
|
|
31
31
|
onDragEnd?: (range: RangeCoords, e: React.PointerEvent) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Released from a **secondary-button** (right) drag: offer a menu of fills at the pointer instead
|
|
34
|
+
* of committing one — Excel's right-drag of the fill handle. Fires INSTEAD of
|
|
35
|
+
* {@link FillHandleProps.onDragEnd} for that gesture (then {@link FillHandleProps.onDragDone} as
|
|
36
|
+
* usual); supplying it is what enables the right-button drag at all. Left-drag is untouched.
|
|
37
|
+
*
|
|
38
|
+
* The dashed preview STAYS on the release — the fill is still being decided — until `done` is
|
|
39
|
+
* called: once the menu has answered, or closed without answering. A new drag clears it regardless.
|
|
40
|
+
*/
|
|
41
|
+
onMenu?: (range: RangeCoords, e: React.PointerEvent, done: () => void) => void;
|
|
32
42
|
/**
|
|
33
43
|
* The drag finished — fires on **every** release after a press (unlike {@link FillHandleProps.onDragEnd},
|
|
34
44
|
* which fires only when a fill was drawn) AND on an abort (Escape / OS pointercancel). Use it for
|
|
@@ -49,6 +59,23 @@ export interface FillHandleProps extends VisualSVGProps {
|
|
|
49
59
|
*/
|
|
50
60
|
renderHandle?: (props: DragHandleRenderProps) => React.ReactNode;
|
|
51
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* The destination range when filling `template` toward `to`. Excel-style single axis: extend along
|
|
64
|
+
* whichever direction the pointer reaches furthest beyond the template, clamped to `bounds`. The
|
|
65
|
+
* destination includes the template.
|
|
66
|
+
*
|
|
67
|
+
* A pointer INSIDE the template shrinks it instead — Excel's drag of the fill handle back over the
|
|
68
|
+
* source, which vacates the cells past the pointer. Only the edges the handle sits on can move, the
|
|
69
|
+
* bottom and the right, along whichever axis the pointer pulled furthest from the corner; a whole-row
|
|
70
|
+
* or whole-column template has no such edge on its long axis and shrinks only on the other. Returns
|
|
71
|
+
* `null` when `to` is the handle's own corner (nothing to fill or vacate).
|
|
72
|
+
*/
|
|
73
|
+
export declare const resolveFillDestination: (template: RangeCoords, to: CellCoords, bounds: RangeCoords) => RangeCoords | null;
|
|
74
|
+
/**
|
|
75
|
+
* The cells a shrinking `destination` vacates from `template` — the strip past its bottom or right
|
|
76
|
+
* edge — or `null` for an outward fill.
|
|
77
|
+
*/
|
|
78
|
+
export declare const vacatedByFill: (template: RangeCoords, destination: RangeCoords) => RangeCoords | null;
|
|
52
79
|
/**
|
|
53
80
|
* The fill layer: a {@link DragHandle} at a corner of the `range` (bottom-right by default). It owns
|
|
54
81
|
* the handle placement — including the whole-row/column special-casing (pin to bottom-left / top-right
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { RangeAxis, RangeCoords } from '@sheetxl/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link RangeInsertBar}.
|
|
4
|
+
*/
|
|
5
|
+
export interface RangeInsertBarProps {
|
|
6
|
+
/**
|
|
7
|
+
* The range the insert lands on — the block's destination. Its LEADING edge on {@link axis} is the
|
|
8
|
+
* grid line the bar is drawn at (`insertRange` produces exactly this), and its other axis is the
|
|
9
|
+
* extent the bar spans, so the bar shows how wide the incoming block is.
|
|
10
|
+
*/
|
|
11
|
+
range: RangeCoords;
|
|
12
|
+
/**
|
|
13
|
+
* Which way the existing cells shift: `Row` draws a horizontal bar on the range's top edge (cells
|
|
14
|
+
* shift down), `Column` a vertical bar on its left edge (cells shift right).
|
|
15
|
+
*/
|
|
16
|
+
axis: RangeAxis;
|
|
17
|
+
/** The bar color. @defaultValue the grid primary. */
|
|
18
|
+
color?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Bar thickness in DEVICE px — the same currency as a selection outline's `alignWidth`, so a bar and
|
|
21
|
+
* a border of the same number read as the same weight at any dpr.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue 3
|
|
24
|
+
*/
|
|
25
|
+
alignWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* How far each end cap reaches past the bar, per side, in DEVICE px. `0` draws a plain bar.
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue 3
|
|
30
|
+
*/
|
|
31
|
+
capExtent?: number;
|
|
32
|
+
/**
|
|
33
|
+
* How long the bar takes to travel to a new line, in ms. `0` places it instantly.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue 100
|
|
36
|
+
*/
|
|
37
|
+
transitionDuration?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The curve it travels on. The default is a hard decelerate — most of the distance is covered in
|
|
40
|
+
* the first third, then it settles — which is what reads as SNAPPING onto a gridline rather than
|
|
41
|
+
* sliding to a stop near one.
|
|
42
|
+
*
|
|
43
|
+
* @defaultValue `cubic-bezier(0.16, 1, 0.3, 1)`
|
|
44
|
+
*/
|
|
45
|
+
transitionEasing?: string;
|
|
46
|
+
/**
|
|
47
|
+
* How long the beam takes to TURN, in ms — the outgoing orientation drawing in and the incoming one
|
|
48
|
+
* drawing out, together. `0` turns instantly. Shorter than
|
|
49
|
+
* {@link RangeInsertBarProps.transitionDuration} on purpose: a turn is a change of meaning (rows
|
|
50
|
+
* step aside, not columns), so it wants to read as a flip rather than as travel.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue 70
|
|
53
|
+
*/
|
|
54
|
+
axisDuration?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The **insert I-beam**: the Excel bar shown while Shift-dragging a range, marking the grid line the
|
|
58
|
+
* block will be inserted at (rather than dropped over). Drawn as a heavy line with a short cap at each
|
|
59
|
+
* end — the serifs are what separate "inserting AT this line" from "a border of something".
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Three device-aligned boxes rather than an SVG path: each is snapped independently, so the bar sits
|
|
63
|
+
* on the boundary pixel exactly like a gridline or a selection edge, at any dpr or zoom. It is placed
|
|
64
|
+
* from the destination range alone ({@link RangeInsertBarProps.range}) — the same range the drop
|
|
65
|
+
* commits — so the drawing and the operation can never disagree.
|
|
66
|
+
*
|
|
67
|
+
* The bar is clipped to the pane (a whole-column insert spans millions of pixels, and a box that size
|
|
68
|
+
* is a compositing tax for ink nobody can see), and an end cap is drawn only where the block's real
|
|
69
|
+
* end is on screen — a cap at a clipped edge would claim an end that isn't there.
|
|
70
|
+
*
|
|
71
|
+
* It GLIDES between lines: the three boxes transition their placement and their size together, on one
|
|
72
|
+
* duration and one curve, so they travel as a single object, and the color rides the same timing (a
|
|
73
|
+
* drop turning refused fades rather than blinks).
|
|
74
|
+
*
|
|
75
|
+
* A change of AXIS is a TURN, and both orientations are always mounted to draw it: each keeps its own
|
|
76
|
+
* shape forever and shows or hides by scaling, so the outgoing beam draws in while the incoming one
|
|
77
|
+
* draws out and something is on screen the whole way. They scale about the corner they SHARE — the
|
|
78
|
+
* destination's top-left, where a row beam starts running right and a column beam starts running
|
|
79
|
+
* down — so the pair reads as one beam swinging around that point, which is the part a rotation would
|
|
80
|
+
* have sold. That pivot is stated in PANE coordinates: these boxes lay out at the pane origin and
|
|
81
|
+
* move by transform, so their transform-origin is measured from the pane's corner, and a pivot stated
|
|
82
|
+
* relative to the box would scale the placement along with the beam and fly it in from the top-left.
|
|
83
|
+
*
|
|
84
|
+
* Two things this deliberately does NOT do. It does not interpolate one orientation into the other:
|
|
85
|
+
* width and height would cross and a bar whose width and height cross is a box at the halfway point,
|
|
86
|
+
* which smears. And it does not cut the old one and grow the new one, which leaves a moment with no
|
|
87
|
+
* beam at all — read as a flicker. (A real rotation is not something one transition can express: the
|
|
88
|
+
* orientations differ in LENGTH as well as angle.)
|
|
89
|
+
*/
|
|
90
|
+
export declare const RangeInsertBar: import('react').MemoExoticComponent<(props: RangeInsertBarProps) => import("react").JSX.Element | null>;
|
|
91
|
+
//# sourceMappingURL=RangeInsertBar.d.ts.map
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export * from './RangeStyle';
|
|
8
8
|
export * from './RangeRect';
|
|
9
|
+
export * from './RangeInsertBar';
|
|
9
10
|
export * from './DragHandle';
|
|
10
11
|
export * from './Draggable';
|
|
11
12
|
export * from './RangeResizer';
|
|
12
13
|
export * from './FillHandle';
|
|
14
|
+
export * from './useDoubleClick';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
2
|
+
import { RangeAxis, CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
3
3
|
import { LayerProps, GridPlacement } from '../layer';
|
|
4
4
|
import { VisualSVGProps } from '../svg';
|
|
5
5
|
import { RangeEdge } from '../range';
|
|
6
6
|
import { ISelection } from './ISelection';
|
|
7
7
|
import { SelectionNavigation } from './Types';
|
|
8
|
-
import { SelectionRangeStyle } from './SelectionStyle';
|
|
8
|
+
import { SelectionRangeStyle, InsertBarStyle } from './SelectionStyle';
|
|
9
9
|
/**
|
|
10
10
|
* The in-flight selection gesture passed to {@link SelectionLayerProps.renderTip}:
|
|
11
11
|
* - `select` — a drag-select growing the active range (Excel's live R×C);
|
|
@@ -19,11 +19,43 @@ export type SelectionGesture = {
|
|
|
19
19
|
kind: 'move';
|
|
20
20
|
from: RangeCoords;
|
|
21
21
|
to: RangeCoords;
|
|
22
|
+
drop: MoveDrop;
|
|
22
23
|
} | {
|
|
23
24
|
kind: 'fill';
|
|
24
25
|
template: RangeCoords;
|
|
25
26
|
destination: RangeCoords;
|
|
26
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* What a move drag would DO if released now — the destination plus the mode its modifiers select.
|
|
30
|
+
* Excel's three grip gestures, as data: drag relocates, Ctrl+drag copies, Shift+drag inserts (and
|
|
31
|
+
* Ctrl+Shift inserts a copy).
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The mode lives here rather than being re-derived from a pointer event by each consumer, because the
|
|
35
|
+
* modifiers change with the pointer standing still — see {@link DragMoveInfo}.
|
|
36
|
+
*/
|
|
37
|
+
export interface MoveDrop {
|
|
38
|
+
/**
|
|
39
|
+
* Where the block lands. For an insert this is the block RE-ANCHORED on the pointer's cell, not the
|
|
40
|
+
* drag's translation — take the destination from here rather than re-deriving it.
|
|
41
|
+
*/
|
|
42
|
+
to: RangeCoords;
|
|
43
|
+
/** Ctrl / Cmd is held: the source is copied rather than cut. */
|
|
44
|
+
copy: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Shift is held: INSERT at {@link MoveDrop.to} instead of dropping over it — the cells already there
|
|
47
|
+
* step aside along this axis (`Row` = down, `Column` = right), which is also the edge of `to` the
|
|
48
|
+
* I-beam is drawn on. Absent for a plain overwrite drop.
|
|
49
|
+
*/
|
|
50
|
+
insert?: RangeAxis;
|
|
51
|
+
/**
|
|
52
|
+
* The drop cannot be performed and a release does nothing: a cut INSERT whose line falls inside the
|
|
53
|
+
* block being dragged, or one that would shift only part of it (see `CoordUtils.classifyInsertCut`
|
|
54
|
+
* - the same call the model makes, so a beam drawn as legal is one the model will accept). The
|
|
55
|
+
* preview draws the I-beam in the refused color instead, and `onMove` never fires.
|
|
56
|
+
*/
|
|
57
|
+
refused?: boolean;
|
|
58
|
+
}
|
|
27
59
|
/**
|
|
28
60
|
* Props for {@link SelectionLayer}.
|
|
29
61
|
*/
|
|
@@ -41,7 +73,7 @@ export interface SelectionLayerProps extends LayerProps {
|
|
|
41
73
|
getContentBounds?: () => RangeCoords;
|
|
42
74
|
/**
|
|
43
75
|
* The bounding REGION enclosing a cell — a table's data range from a tier that knows tables (the sheet
|
|
44
|
-
* layer), else `null` (the bare sheet). Drives Tab
|
|
76
|
+
* layer), else `null` (the bare sheet). Drives Tab wrapping inside a table and the row/column
|
|
45
77
|
* span of Ctrl/Shift+Space. Omit it (the dumb {@link DefaultSelection} tier) and there is no enclosing
|
|
46
78
|
* region: Tab is a plain move and Ctrl/Shift+Space select the whole grid. The layer never learns it's a
|
|
47
79
|
* sheet — just a `cell → bounds | null` getter; any escalation lives in the provider.
|
|
@@ -70,6 +102,25 @@ export interface SelectionLayerProps extends LayerProps {
|
|
|
70
102
|
singleAnchorStyle?: VisualSVGProps;
|
|
71
103
|
/** The Ctrl/Cmd-drag remove rubber-band. Merged (slot-by-slot) over {@link DEFAULT_REMOVE_PREVIEW_STYLE}. */
|
|
72
104
|
removePreviewStyle?: SelectionRangeStyle;
|
|
105
|
+
/** The Shift-drag insert I-beam. Merged over {@link DEFAULT_INSERT_BAR_STYLE}. */
|
|
106
|
+
insertBarStyle?: InsertBarStyle;
|
|
107
|
+
/**
|
|
108
|
+
* Whether a drop would be REFUSED - drawn as a refused I-beam, and inert on release. Defaults to
|
|
109
|
+
* the geometry a grid can see on its own (`CoordUtils.classifyInsertCut`: a cut whose gap the
|
|
110
|
+
* insert would only half close, or a line dropped inside the block itself).
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* A model knows more than the grid does - a merge the shift would tear, a table it would split -
|
|
114
|
+
* so a host that has one should answer from it (`ICellRange.canInsertFrom`), which is what keeps
|
|
115
|
+
* the beam honest about drops the grid could not have ruled out.
|
|
116
|
+
*/
|
|
117
|
+
isDropRefused?: (from: RangeCoords, drop: MoveDrop) => boolean;
|
|
118
|
+
/**
|
|
119
|
+
* The mute drawn over the source while a **cut** (plain) move drag is in flight — see
|
|
120
|
+
* {@link DEFAULT_MOVE_SOURCE_STYLE}, which it merges over. `null` draws no mute, leaving the cursor
|
|
121
|
+
* as the only cut-vs-copy tell.
|
|
122
|
+
*/
|
|
123
|
+
moveSourceStyle?: SelectionRangeStyle | null;
|
|
73
124
|
/**
|
|
74
125
|
* Stacked layers (fill, move, …) rendered when a single range is selected.
|
|
75
126
|
*/
|
|
@@ -86,21 +137,33 @@ export interface SelectionLayerProps extends LayerProps {
|
|
|
86
137
|
enabledMove?: boolean;
|
|
87
138
|
/**
|
|
88
139
|
* Called when the single range is moved by its border — `from` is the original range, `to` the new
|
|
89
|
-
* one. The selection follows automatically; use this for the data
|
|
140
|
+
* one (`drop.to`, snapped when inserting). The selection follows automatically; use this for the data
|
|
141
|
+
* side-effect, which `drop` describes: a cut-move, a copy, or an insert along `drop.insert`.
|
|
90
142
|
*/
|
|
91
|
-
onMove?: (from: RangeCoords, to: RangeCoords, e: React.PointerEvent) => void;
|
|
143
|
+
onMove?: (from: RangeCoords, to: RangeCoords, e: React.PointerEvent, drop: MoveDrop) => void;
|
|
92
144
|
/** The move drag started (before any translation) — `from` is the range being moved. */
|
|
93
|
-
onMoveStart?: (from: RangeCoords, e: React.PointerEvent) => void;
|
|
145
|
+
onMoveStart?: (from: RangeCoords, e: React.PointerEvent, drop: MoveDrop) => void;
|
|
94
146
|
/**
|
|
95
|
-
* Live during the move drag — `to` is the in-flight
|
|
96
|
-
*
|
|
147
|
+
* Live during the move drag — `to` is the in-flight destination and `drop` what a release would do.
|
|
148
|
+
* Fires on every change, INCLUDING a modifier pressed or released with the pointer standing still
|
|
149
|
+
* (that is the whole point: the mode must be reflected — cursor, status description — the instant
|
|
150
|
+
* the key goes down). Take the mode from `drop`; `e` is merely the last pointer event.
|
|
97
151
|
*/
|
|
98
|
-
onMoveUpdate?: (from: RangeCoords, to: RangeCoords, e: React.PointerEvent) => void;
|
|
152
|
+
onMoveUpdate?: (from: RangeCoords, to: RangeCoords, e: React.PointerEvent, drop: MoveDrop) => void;
|
|
99
153
|
/**
|
|
100
154
|
* The move drag ended (fires on release regardless of whether the range actually moved) — for teardown
|
|
101
155
|
* of anything {@link SelectionLayerProps.onMoveStart}/`onMoveUpdate` set (e.g. clearing a drag mode).
|
|
102
156
|
*/
|
|
103
157
|
onMoveEnd?: () => void;
|
|
158
|
+
/**
|
|
159
|
+
* The cursor to paint while the move grip is dragged — pass one derived from the live
|
|
160
|
+
* {@link MoveDrop} (`copy` while Ctrl is held, say) to show the drop mode under the pointer. The
|
|
161
|
+
* grip is pointer-captured for the duration, so this is the cursor the browser shows anywhere on
|
|
162
|
+
* screen, and it is the only place a mode cursor can come from during the drag.
|
|
163
|
+
*
|
|
164
|
+
* @defaultValue 'grabbing'
|
|
165
|
+
*/
|
|
166
|
+
moveCursor?: string;
|
|
104
167
|
/**
|
|
105
168
|
* Enable the built-in fill handle on a single range (the Excel fill square at the bottom-right
|
|
106
169
|
* corner; drag to fill). Opt-in (unlike the always-on move grip) because it adds a visible handle.
|
|
@@ -133,6 +196,17 @@ export interface SelectionLayerProps extends LayerProps {
|
|
|
133
196
|
* anything {@link SelectionLayerProps.onFillPreview} set (e.g. closing the preview tooltip).
|
|
134
197
|
*/
|
|
135
198
|
onFillEnd?: () => void;
|
|
199
|
+
/**
|
|
200
|
+
* A **right-button** fill drag was released — Excel's right-drag of the fill handle, which offers a
|
|
201
|
+
* menu of fills at the pointer instead of filling. Fires INSTEAD of {@link SelectionLayerProps.onFill}
|
|
202
|
+
* for that gesture, and the selection is NOT extended: nothing has been decided yet, so the consumer
|
|
203
|
+
* extends it (or not) once a menu entry is chosen. Supplying it is what enables the right-button drag;
|
|
204
|
+
* left-drag is untouched.
|
|
205
|
+
*
|
|
206
|
+
* The dashed fill preview stays up while the menu decides; call `done` once it has answered or closed
|
|
207
|
+
* without answering, and the preview clears.
|
|
208
|
+
*/
|
|
209
|
+
onFillMenu?: (template: RangeCoords, destination: RangeCoords, e: React.PointerEvent, done: () => void) => void;
|
|
136
210
|
/**
|
|
137
211
|
* Resolve the destination for a **double-clicked** fill handle — Excel's "ride the rails" fill,
|
|
138
212
|
* whose extent comes from the data flanking the template rather than from a drag. Return the
|
|
@@ -154,6 +228,14 @@ export interface SelectionLayerProps extends LayerProps {
|
|
|
154
228
|
* {@link SelectionPointerOptions.onSelectionEnd}.
|
|
155
229
|
*/
|
|
156
230
|
onSelectionEnd?: (e: React.PointerEvent) => void;
|
|
231
|
+
/**
|
|
232
|
+
* The pointer drag-select started (`'extend'` / `'remove'`) or ended (`null`) — for reflecting an
|
|
233
|
+
* in-flight selection somewhere this layer's own {@link SelectionLayerProps.renderTip} can't reach
|
|
234
|
+
* (the name box's live `nR x nC`). Read off the drag engine rather than a start/end callback pair,
|
|
235
|
+
* so it is balanced by construction: the `null` also arrives for an aborted drag (Escape /
|
|
236
|
+
* `pointercancel`), which never reaches a release.
|
|
237
|
+
*/
|
|
238
|
+
onDragModeChange?: (dragMode: 'extend' | 'remove' | null) => void;
|
|
157
239
|
/**
|
|
158
240
|
* Render a transient tip during a gesture — a drag-select ({@link SelectionGesture} `select`, live
|
|
159
241
|
* R×C), a move (`move`, the destination address), or a fill (`fill`, the preview). Return a falsy node
|
|
@@ -25,4 +25,34 @@ export declare const DEFAULT_MULTI_STYLE: SelectionRangeStyle;
|
|
|
25
25
|
export declare const DEFAULT_ANCHOR_STYLE: VisualSVGProps;
|
|
26
26
|
/** The transient rubber-band shown while Ctrl/Cmd-dragging to remove an area (fill + border stack). */
|
|
27
27
|
export declare const DEFAULT_REMOVE_PREVIEW_STYLE: SelectionRangeStyle;
|
|
28
|
+
/** The look of the insert I-beam — the `RangeInsertBar` shown while Shift-dragging the move grip. */
|
|
29
|
+
export interface InsertBarStyle {
|
|
30
|
+
/** The bar color. */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** The bar color when the drop would be REFUSED (`MoveDrop.refused`) - the theme's warning. */
|
|
33
|
+
refusedColor?: string;
|
|
34
|
+
/** Bar thickness in DEVICE px (the same currency as a border's `alignWidth`). */
|
|
35
|
+
alignWidth?: number;
|
|
36
|
+
/** How far each end cap reaches past the bar, per side, in DEVICE px. */
|
|
37
|
+
capExtent?: number;
|
|
38
|
+
/** How long the bar takes to travel to a new line, in ms. `0` places it instantly. */
|
|
39
|
+
transitionDuration?: number;
|
|
40
|
+
/** The curve it travels on - a hard decelerate reads as a snap onto the line. */
|
|
41
|
+
transitionEasing?: string;
|
|
42
|
+
/** How long the beam takes to grow into a new ORIENTATION, in ms. `0` shows it at once. */
|
|
43
|
+
axisDuration?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The insert I-beam: the selection color, heavier than the selection outline so it reads as a drop
|
|
47
|
+
* target rather than a border. A drop the model would refuse draws in the theme's WARNING instead
|
|
48
|
+
* (the same token the remove rubber-band uses) - the gesture stays visible, it just says no.
|
|
49
|
+
*/
|
|
50
|
+
export declare const DEFAULT_INSERT_BAR_STYLE: InsertBarStyle;
|
|
51
|
+
/**
|
|
52
|
+
* The **mute** laid over the SOURCE of a move (cut) drag — a scrim in the grid's own surface color,
|
|
53
|
+
* drawn under the selection visuals so it fades the cell content while the outline stays crisp. The
|
|
54
|
+
* content reads as already lifted out; a Ctrl (copy) drag draws no mute, so the two modes are
|
|
55
|
+
* distinguishable at a glance rather than by cursor alone.
|
|
56
|
+
*/
|
|
57
|
+
export declare const DEFAULT_MOVE_SOURCE_STYLE: SelectionRangeStyle;
|
|
28
58
|
//# sourceMappingURL=SelectionStyle.d.ts.map
|
|
@@ -36,6 +36,23 @@ export declare const edgeScrollPane: (pane: IGridPane, point: {
|
|
|
36
36
|
x?: boolean;
|
|
37
37
|
y?: boolean;
|
|
38
38
|
}) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The modifier keys held during a drag — Excel's *mode* keys: Ctrl turns a move into a copy, Shift
|
|
41
|
+
* into an insert. Tracked by the engine off BOTH the pointer and the keyboard, so it stays true while
|
|
42
|
+
* the pointer stands still (pressing Ctrl fires no pointer event).
|
|
43
|
+
*/
|
|
44
|
+
export interface DragModifiers {
|
|
45
|
+
ctrlKey: boolean;
|
|
46
|
+
shiftKey: boolean;
|
|
47
|
+
altKey: boolean;
|
|
48
|
+
metaKey: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Nothing held — what a drag starts from unless its pointer-down says otherwise. */
|
|
51
|
+
export declare const NO_DRAG_MODIFIERS: DragModifiers;
|
|
52
|
+
/** Snapshot the modifier flags off any event that carries them (pointer, mouse, or keyboard). */
|
|
53
|
+
export declare const readDragModifiers: (e: Partial<DragModifiers>) => DragModifiers;
|
|
54
|
+
/** Whether two modifier snapshots describe the same held keys. */
|
|
55
|
+
export declare const isSameDragModifiers: (a: DragModifiers, b: DragModifiers) => boolean;
|
|
39
56
|
/**
|
|
40
57
|
* The in-flight gesture returned by {@link DragCellsOptions.onStart}. It carries the *policy* — how a
|
|
41
58
|
* given cell-drag mutates the model — while the engine owns the *mechanics* (pointer capture, `lastCell`
|
|
@@ -56,6 +73,25 @@ export interface DragCellsSession {
|
|
|
56
73
|
* (no pointer event fires while the pointer is parked past the edge), so treat it as optional.
|
|
57
74
|
*/
|
|
58
75
|
drag: (cell: CellCoords, e?: React.PointerEvent) => void;
|
|
76
|
+
/**
|
|
77
|
+
* The pointer is AT a position — fired on every move (including one that stays inside the cell it is
|
|
78
|
+
* already in) and on every held-still auto-scroll tick, right after any `drag` the same position
|
|
79
|
+
* triggered. For policies whose result is sub-cell, which the per-cell `drag` cannot express: a move
|
|
80
|
+
* drag's insert line snaps to the nearer HALF of the cell under the cursor, so it has to see the
|
|
81
|
+
* pointer cross a midpoint. `cell` is the cell resolved at that point; `e` is absent on an
|
|
82
|
+
* auto-scroll tick. Fires only when a cell resolved.
|
|
83
|
+
*
|
|
84
|
+
* It is called at pointer rate, so a consumer should report onward only what actually changed.
|
|
85
|
+
*/
|
|
86
|
+
point?: (cell: CellCoords, clientX: number, clientY: number, e?: React.PointerEvent) => void;
|
|
87
|
+
/**
|
|
88
|
+
* The held modifier keys CHANGED mid-drag — fired on every press/release of Ctrl / Shift / Alt / Meta
|
|
89
|
+
* (never on start, and only on an actual change). Excel's mode keys take effect the instant they are
|
|
90
|
+
* pressed, even with the pointer standing still — and a key press fires no pointer event, so `drag`
|
|
91
|
+
* alone can never see it. Wire this to whatever reflects the mode (a status description, a cursor, a
|
|
92
|
+
* drop preview).
|
|
93
|
+
*/
|
|
94
|
+
modifiers?: (mods: DragModifiers) => void;
|
|
59
95
|
/**
|
|
60
96
|
* The auto-scroll step: given the pointer's client `point`, scroll the viewport ONE cell toward any edge
|
|
61
97
|
* the pointer is at (see {@link edgeScrollPane}), and return whether an edge is still engaged so the
|