@sheetxl/grid-react 0.7.22 → 0.7.23-beta.1
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/README.md +502 -2
- package/browser/cjs/index.cjs +3 -12
- package/browser/esm/index.mjs +5797 -1867
- package/licenses/dependencies.txt +143 -41
- package/node/esm/index.mjs +4951 -1861
- package/package.json +7 -6
- package/types/index.d.ts +2 -1497
- package/types/src/cell/CellLayer.d.ts +70 -0
- package/types/src/cell/CellLayer.d.ts.map +1 -0
- package/types/src/cell/CellRenderer.d.ts +42 -0
- package/types/src/cell/CellRenderer.d.ts.map +1 -0
- package/types/src/cell/DefaultCellRenderer.d.ts +6 -0
- package/types/src/cell/DefaultCellRenderer.d.ts.map +1 -0
- package/types/src/cell/GridlineLayer.d.ts +38 -0
- package/types/src/cell/GridlineLayer.d.ts.map +1 -0
- package/types/src/cell/Types.d.ts +12 -0
- package/types/src/cell/Types.d.ts.map +1 -0
- package/types/src/cell/_CellModel.d.ts +82 -0
- package/types/src/cell/_CellModel.d.ts.map +1 -0
- package/types/src/cell/index.d.ts +6 -0
- package/types/src/cell/index.d.ts.map +1 -0
- package/types/src/editor/DefaultEditable.d.ts +121 -0
- package/types/src/editor/DefaultEditable.d.ts.map +1 -0
- package/types/src/editor/EditSession.d.ts +182 -0
- package/types/src/editor/EditSession.d.ts.map +1 -0
- package/types/src/editor/EditState.d.ts +61 -0
- package/types/src/editor/EditState.d.ts.map +1 -0
- package/types/src/editor/EditorDiv.d.ts +65 -0
- package/types/src/editor/EditorDiv.d.ts.map +1 -0
- package/types/src/editor/EditorInput.d.ts +88 -0
- package/types/src/editor/EditorInput.d.ts.map +1 -0
- package/types/src/editor/EditorLayer.d.ts +69 -0
- package/types/src/editor/EditorLayer.d.ts.map +1 -0
- package/types/src/editor/EditorPlacement.d.ts +38 -0
- package/types/src/editor/EditorPlacement.d.ts.map +1 -0
- package/types/src/editor/index.d.ts +10 -0
- package/types/src/editor/index.d.ts.map +1 -0
- package/types/src/editor/useEditorKeymap.d.ts +74 -0
- package/types/src/editor/useEditorKeymap.d.ts.map +1 -0
- package/types/src/grid/Grid.d.ts +16 -0
- package/types/src/grid/Grid.d.ts.map +1 -0
- package/types/src/grid/IGrid.d.ts +93 -0
- package/types/src/grid/IGrid.d.ts.map +1 -0
- package/types/src/grid/index.d.ts +3 -0
- package/types/src/grid/index.d.ts.map +1 -0
- package/types/src/header/HeaderDividerAnchor.d.ts +120 -0
- package/types/src/header/HeaderDividerAnchor.d.ts.map +1 -0
- package/types/src/header/index.d.ts +3 -0
- package/types/src/header/index.d.ts.map +1 -0
- package/types/src/header/useHeaderSelectionPointer.d.ts +122 -0
- package/types/src/header/useHeaderSelectionPointer.d.ts.map +1 -0
- package/types/src/index.d.ts +13 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/layer/HoverTipLayer.d.ts +74 -0
- package/types/src/layer/HoverTipLayer.d.ts.map +1 -0
- package/types/src/layer/Layer.d.ts +92 -0
- package/types/src/layer/Layer.d.ts.map +1 -0
- package/types/src/layer/LayerTypes.d.ts +47 -0
- package/types/src/layer/LayerTypes.d.ts.map +1 -0
- package/types/src/layer/RangePrompt.d.ts +42 -0
- package/types/src/layer/RangePrompt.d.ts.map +1 -0
- package/types/src/layer/Stage.d.ts +147 -0
- package/types/src/layer/Stage.d.ts.map +1 -0
- package/types/src/layer/StickyAnchor.d.ts +83 -0
- package/types/src/layer/StickyAnchor.d.ts.map +1 -0
- package/types/src/layer/StickyFloat.d.ts +65 -0
- package/types/src/layer/StickyFloat.d.ts.map +1 -0
- package/types/src/layer/VirtualDiv.d.ts +59 -0
- package/types/src/layer/VirtualDiv.d.ts.map +1 -0
- package/types/src/layer/_Utils.d.ts +37 -0
- package/types/src/layer/_Utils.d.ts.map +1 -0
- package/types/src/layer/index.d.ts +11 -0
- package/types/src/layer/index.d.ts.map +1 -0
- package/types/src/layer/useGridAnchor.d.ts +157 -0
- package/types/src/layer/useGridAnchor.d.ts.map +1 -0
- package/types/src/layer/useHoverIntent.d.ts +49 -0
- package/types/src/layer/useHoverIntent.d.ts.map +1 -0
- package/types/src/layer/useLayerResponder.d.ts +29 -0
- package/types/src/layer/useLayerResponder.d.ts.map +1 -0
- package/types/src/layer/usePlacement.d.ts +18 -0
- package/types/src/layer/usePlacement.d.ts.map +1 -0
- package/types/src/layer/useRangeHover.d.ts +35 -0
- package/types/src/layer/useRangeHover.d.ts.map +1 -0
- package/types/src/list/CheckboxList.d.ts +63 -0
- package/types/src/list/CheckboxList.d.ts.map +1 -0
- package/types/src/list/List.d.ts +55 -0
- package/types/src/list/List.d.ts.map +1 -0
- package/types/src/list/index.d.ts +3 -0
- package/types/src/list/index.d.ts.map +1 -0
- package/types/src/metrics/Types.d.ts +23 -0
- package/types/src/metrics/Types.d.ts.map +1 -0
- package/types/src/metrics/index.d.ts +3 -0
- package/types/src/metrics/index.d.ts.map +1 -0
- package/types/src/metrics/useGridMetrics.d.ts +67 -0
- package/types/src/metrics/useGridMetrics.d.ts.map +1 -0
- package/types/src/range/DragHandle.d.ts +129 -0
- package/types/src/range/DragHandle.d.ts.map +1 -0
- package/types/src/range/Draggable.d.ts +86 -0
- package/types/src/range/Draggable.d.ts.map +1 -0
- package/types/src/range/FillHandle.d.ts +54 -0
- package/types/src/range/FillHandle.d.ts.map +1 -0
- package/types/src/range/RangeRect.d.ts +36 -0
- package/types/src/range/RangeRect.d.ts.map +1 -0
- package/types/src/range/RangeResizer.d.ts +68 -0
- package/types/src/range/RangeResizer.d.ts.map +1 -0
- package/types/src/range/RangeStyle.d.ts +8 -0
- package/types/src/range/RangeStyle.d.ts.map +1 -0
- package/types/src/range/index.d.ts +13 -0
- package/types/src/range/index.d.ts.map +1 -0
- package/types/src/selection/DefaultSelection.d.ts +59 -0
- package/types/src/selection/DefaultSelection.d.ts.map +1 -0
- package/types/src/selection/ICellAnchor.d.ts +21 -0
- package/types/src/selection/ICellAnchor.d.ts.map +1 -0
- package/types/src/selection/ISelection.d.ts +65 -0
- package/types/src/selection/ISelection.d.ts.map +1 -0
- package/types/src/selection/RangesPickerLayer.d.ts +128 -0
- package/types/src/selection/RangesPickerLayer.d.ts.map +1 -0
- package/types/src/selection/SelectionLayer.d.ts +179 -0
- package/types/src/selection/SelectionLayer.d.ts.map +1 -0
- package/types/src/selection/SelectionStyle.d.ts +28 -0
- package/types/src/selection/SelectionStyle.d.ts.map +1 -0
- package/types/src/selection/SelectionTouchGrips.d.ts +29 -0
- package/types/src/selection/SelectionTouchGrips.d.ts.map +1 -0
- package/types/src/selection/SelectionUtils.d.ts +2 -0
- package/types/src/selection/SelectionUtils.d.ts.map +1 -0
- package/types/src/selection/Types.d.ts +67 -0
- package/types/src/selection/Types.d.ts.map +1 -0
- package/types/src/selection/_SelectionNavigation.d.ts +6 -0
- package/types/src/selection/_SelectionNavigation.d.ts.map +1 -0
- package/types/src/selection/_SelectionUtils.d.ts +7 -0
- package/types/src/selection/_SelectionUtils.d.ts.map +1 -0
- package/types/src/selection/index.d.ts +12 -0
- package/types/src/selection/index.d.ts.map +1 -0
- package/types/src/selection/useDragCells.d.ts +218 -0
- package/types/src/selection/useDragCells.d.ts.map +1 -0
- package/types/src/selection/useSelectionPointer.d.ts +70 -0
- package/types/src/selection/useSelectionPointer.d.ts.map +1 -0
- package/types/src/surface/GridPane.d.ts +85 -0
- package/types/src/surface/GridPane.d.ts.map +1 -0
- package/types/src/surface/GridPaneProvider.d.ts +37 -0
- package/types/src/surface/GridPaneProvider.d.ts.map +1 -0
- package/types/src/surface/GridSurface.d.ts +11 -0
- package/types/src/surface/GridSurface.d.ts.map +1 -0
- package/types/src/surface/IGridPane.d.ts +288 -0
- package/types/src/surface/IGridPane.d.ts.map +1 -0
- package/types/src/surface/IGridSurface.d.ts +141 -0
- package/types/src/surface/IGridSurface.d.ts.map +1 -0
- package/types/src/surface/SurfaceStateProvider.d.ts +50 -0
- package/types/src/surface/SurfaceStateProvider.d.ts.map +1 -0
- package/types/src/surface/_GridUtils.d.ts +37 -0
- package/types/src/surface/_GridUtils.d.ts.map +1 -0
- package/types/src/surface/index.d.ts +7 -0
- package/types/src/surface/index.d.ts.map +1 -0
- package/types/src/surface/useGridPane.d.ts +31 -0
- package/types/src/surface/useGridPane.d.ts.map +1 -0
- package/types/src/surface/useSurfaceState.d.ts +22 -0
- package/types/src/surface/useSurfaceState.d.ts.map +1 -0
- package/types/src/svg/LineSVG.d.ts +13 -0
- package/types/src/svg/LineSVG.d.ts.map +1 -0
- package/types/src/svg/RectangleSVG.d.ts +114 -0
- package/types/src/svg/RectangleSVG.d.ts.map +1 -0
- package/types/src/svg/ShapeBounds.d.ts +15 -0
- package/types/src/svg/ShapeBounds.d.ts.map +1 -0
- package/types/src/svg/Types.d.ts +37 -0
- package/types/src/svg/Types.d.ts.map +1 -0
- package/types/src/svg/index.d.ts +9 -0
- package/types/src/svg/index.d.ts.map +1 -0
- package/types/src/theme/GridTheme.d.ts +56 -0
- package/types/src/theme/GridTheme.d.ts.map +1 -0
- package/types/src/theme/index.d.ts +2 -0
- package/types/src/theme/index.d.ts.map +1 -0
- package/node/assets/style.css +0 -1
package/types/index.d.ts
CHANGED
|
@@ -1,1497 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Bounds } from '@sheetxl/utils';
|
|
4
|
-
import { CellCoords } from '@sheetxl/utils';
|
|
5
|
-
import { CellFinder } from '@sheetxl/utils-react';
|
|
6
|
-
import { default as default_2 } from 'react';
|
|
7
|
-
import { Direction } from '@sheetxl/utils';
|
|
8
|
-
import { HiddenHeadersAt } from '@sheetxl/utils-react';
|
|
9
|
-
import { HorizontalAlignment } from '@sheetxl/utils-react';
|
|
10
|
-
import { ICellLayout } from '@sheetxl/utils-react';
|
|
11
|
-
import { ICommands } from '@sheetxl/utils-react';
|
|
12
|
-
import { IScrollPaneElement } from '@sheetxl/utils-react';
|
|
13
|
-
import { ItemSizer } from '@sheetxl/utils-react';
|
|
14
|
-
import { JSX } from 'react/jsx-runtime';
|
|
15
|
-
import { PaintableText } from '@sheetxl/utils';
|
|
16
|
-
import { Point } from '@sheetxl/utils';
|
|
17
|
-
import { PointerHandlerOptions } from '@sheetxl/utils-react';
|
|
18
|
-
import { PointerModifiers } from '@sheetxl/utils-react';
|
|
19
|
-
import { RangeCoords } from '@sheetxl/utils';
|
|
20
|
-
import { RangeOrientation } from '@sheetxl/utils';
|
|
21
|
-
import { Rectangle } from '@sheetxl/utils';
|
|
22
|
-
import { ScrollableViewport } from '@sheetxl/utils-react';
|
|
23
|
-
import { ScrollPaneProps } from '@sheetxl/utils-react';
|
|
24
|
-
import { SelectionCoords } from '@sheetxl/utils';
|
|
25
|
-
import { Size } from '@sheetxl/utils';
|
|
26
|
-
import { TopLeft } from '@sheetxl/utils';
|
|
27
|
-
|
|
28
|
-
export declare interface AnimatedStrokeProps {
|
|
29
|
-
/**
|
|
30
|
-
* The named of the animation
|
|
31
|
-
*/
|
|
32
|
-
name?: string;
|
|
33
|
-
dashGap: number;
|
|
34
|
-
speed: number;
|
|
35
|
-
dashLength: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Data grid component for rendering cells onto a virtual panel.
|
|
40
|
-
* This component coordinates between ICellLayout and CellRenderer.
|
|
41
|
-
* This component expects a width and height to be passed to it.
|
|
42
|
-
*
|
|
43
|
-
* * To support dynamic width/height based on div sizing wrap this is @see <Grid>
|
|
44
|
-
* * To support scrolling wrap use @see <ScrollableGrid> (which wraps @see <Grid>)
|
|
45
|
-
*
|
|
46
|
-
* @see GridProps
|
|
47
|
-
*/
|
|
48
|
-
export declare const BaseGrid: default_2.NamedExoticComponent<GridProps & default_2.RefAttributes<IGridElement>>;
|
|
49
|
-
|
|
50
|
-
export declare interface CellEditorProps<CT, DT> extends default_2.HTMLAttributes<HTMLElement>, default_2.Attributes {
|
|
51
|
-
/**
|
|
52
|
-
* editState of the cell
|
|
53
|
-
*/
|
|
54
|
-
editState?: EditState<CT, DT> | null;
|
|
55
|
-
/**
|
|
56
|
-
* Styling for the textfield
|
|
57
|
-
*/
|
|
58
|
-
defaultTextStyle?: TextStyle;
|
|
59
|
-
/**
|
|
60
|
-
* Override defaultText styling with cellStyling?
|
|
61
|
-
*/
|
|
62
|
-
useRichStyling?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Callback when a value has changed.
|
|
65
|
-
*/
|
|
66
|
-
onStartEdit?(editState: EditState<CT, DT>): void;
|
|
67
|
-
/**
|
|
68
|
-
* Callback when a value has changed.
|
|
69
|
-
*/
|
|
70
|
-
onChangeEdit?(editState: EditState<CT, DT>): void;
|
|
71
|
-
/**
|
|
72
|
-
* Callback to submit the value back to data store
|
|
73
|
-
*/
|
|
74
|
-
onSubmitEdit?(editState: EditState<CT, DT>): void;
|
|
75
|
-
/**
|
|
76
|
-
* On Cancel callbacks. Hides the editor
|
|
77
|
-
*/
|
|
78
|
-
onCancelEdit?(): void;
|
|
79
|
-
/**
|
|
80
|
-
* Called when either the cancel or submit is called.
|
|
81
|
-
*/
|
|
82
|
-
onDoneEdit?(): void;
|
|
83
|
-
/**
|
|
84
|
-
* Position of editor, x, y, width and height
|
|
85
|
-
*/
|
|
86
|
-
containerBounds?: Bounds;
|
|
87
|
-
disabled?: boolean;
|
|
88
|
-
setNaturalSize?(size: Size): void;
|
|
89
|
-
/**
|
|
90
|
-
* Callback to enable navigation after submit
|
|
91
|
-
* @param direction
|
|
92
|
-
*/
|
|
93
|
-
onNavigate?(direction: Direction): void;
|
|
94
|
-
zoom?: number;
|
|
95
|
-
/**
|
|
96
|
-
* Reference to the underlying element
|
|
97
|
-
*/
|
|
98
|
-
ref?: default_2.Ref<ICellEditorElement>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export declare interface CellRendererProps<T = any> extends React.HTMLAttributes<HTMLElement>, React.Attributes {
|
|
102
|
-
/**
|
|
103
|
-
* A value to render
|
|
104
|
-
*/
|
|
105
|
-
value: T;
|
|
106
|
-
/**
|
|
107
|
-
* The range bounds relative to the current viewport and zoom
|
|
108
|
-
*/
|
|
109
|
-
bounds: Bounds;
|
|
110
|
-
/**
|
|
111
|
-
* The Coords that is being rendered.
|
|
112
|
-
*/
|
|
113
|
-
coords: CellCoords;
|
|
114
|
-
/**
|
|
115
|
-
* The view that is rendering a collection of cells
|
|
116
|
-
*/
|
|
117
|
-
view: IGridView;
|
|
118
|
-
/**
|
|
119
|
-
* The RangeCoords that is being rendering.
|
|
120
|
-
* @remarks
|
|
121
|
-
* For non most cells this is the same as the coords. This will only be different for spanning cells
|
|
122
|
-
* @defaultValue The sames as the coords
|
|
123
|
-
*/
|
|
124
|
-
range?: RangeCoords;
|
|
125
|
-
/**
|
|
126
|
-
* If there is a zoom scale.
|
|
127
|
-
* @defaultValue 1
|
|
128
|
-
*/
|
|
129
|
-
zoom?: number;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export declare interface CoordOffset {
|
|
133
|
-
index: number;
|
|
134
|
-
offset: number;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Default cell editor
|
|
139
|
-
*
|
|
140
|
-
* @param props
|
|
141
|
-
*/
|
|
142
|
-
export declare const DefaultCellEditor: default_2.NamedExoticComponent<Omit<StringCellEditorProps, "ref"> & default_2.RefAttributes<ICellEditorElement>>;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Default cell component capable of rendering a value
|
|
146
|
-
* @param props
|
|
147
|
-
*/
|
|
148
|
-
export declare const DefaultCellRenderer: default_2.MemoExoticComponent<(props: CellRendererProps) => JSX.Element>;
|
|
149
|
-
|
|
150
|
-
export declare const DefaultHeaderDivider: default_2.NamedExoticComponent<Omit<HeaderDividerRendererProps, "ref"> & default_2.RefAttributes<IHeaderDividerElement>>;
|
|
151
|
-
|
|
152
|
-
export declare const defaultSelectionRenderer: (props: SelectionProps) => JSX.Element;
|
|
153
|
-
|
|
154
|
-
export declare interface EditorOverlayResults {
|
|
155
|
-
/**
|
|
156
|
-
* Editor component to be injected.
|
|
157
|
-
*/
|
|
158
|
-
renderOverlay: <T>(view: IGridView, ref?: default_2.Ref<T>) => default_2.ReactNode;
|
|
159
|
-
/**
|
|
160
|
-
* Bind to keyboard event
|
|
161
|
-
*/
|
|
162
|
-
onKeyboardEvent: (e: default_2.KeyboardEvent<HTMLDivElement>) => void;
|
|
163
|
-
onKeyboardEventNative: (e: globalThis.KeyboardEvent) => void;
|
|
164
|
-
/**
|
|
165
|
-
* Bind to pointer event
|
|
166
|
-
*/
|
|
167
|
-
onPointerEvent(e: default_2.PointerEvent<HTMLDivElement>): void;
|
|
168
|
-
onPointerEventNative(e: globalThis.PointerEvent): void;
|
|
169
|
-
/**
|
|
170
|
-
* Make a cell editable
|
|
171
|
-
*
|
|
172
|
-
* @param event an option StartEditEvent
|
|
173
|
-
*/
|
|
174
|
-
startEdit(event?: StartEditEvent): void;
|
|
175
|
-
/**
|
|
176
|
-
* Imperatively trigger submit
|
|
177
|
-
*/
|
|
178
|
-
submitEdit(): void;
|
|
179
|
-
/**
|
|
180
|
-
* Cancels an edit
|
|
181
|
-
*/
|
|
182
|
-
cancelEdit(): void;
|
|
183
|
-
/**
|
|
184
|
-
* indicates if the editor is active
|
|
185
|
-
*/
|
|
186
|
-
isEditing: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* OnScroll listener to align the editor
|
|
189
|
-
*/
|
|
190
|
-
onScroll?: (scrollPoint: TopLeft) => void;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export declare interface EditState<CT, DT> {
|
|
194
|
-
clean: CT;
|
|
195
|
-
dirty?: DT | undefined;
|
|
196
|
-
editMode?: boolean;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Fill handle component
|
|
201
|
-
*/
|
|
202
|
-
export declare const FillHandle: default_2.NamedExoticComponent<Omit<FillHandleProps, "ref"> & default_2.RefAttributes<FillHandleElement>>;
|
|
203
|
-
|
|
204
|
-
export declare interface FillHandleAttributes {
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export declare interface FillHandleElement extends HTMLDivElement, FillHandleAttributes {
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export declare interface FillHandleProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
211
|
-
corner?: string;
|
|
212
|
-
x?: number;
|
|
213
|
-
y?: number;
|
|
214
|
-
size?: number;
|
|
215
|
-
borderWidth?: number;
|
|
216
|
-
borderStroke?: string;
|
|
217
|
-
background?: string;
|
|
218
|
-
/**
|
|
219
|
-
* Underlying element reference
|
|
220
|
-
*/
|
|
221
|
-
ref?: default_2.Ref<FillHandleAttributes>;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export declare interface FrozenEdge {
|
|
225
|
-
/**
|
|
226
|
-
* The boundaries for the edge
|
|
227
|
-
*/
|
|
228
|
-
index: number;
|
|
229
|
-
/**
|
|
230
|
-
* If specified then the edge has a scrollOffset
|
|
231
|
-
*/
|
|
232
|
-
scrollOffset?: number;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export declare const getDefaultStringEditState: (clean?: string) => EditState<string, string> | undefined;
|
|
236
|
-
|
|
237
|
-
export declare const Grid: default_2.NamedExoticComponent<GridProps & default_2.RefAttributes<IGridElement>>;
|
|
238
|
-
|
|
239
|
-
export declare interface GridHeaderStyle extends GridSurfaceStyle {
|
|
240
|
-
strokeFillShadow?: string;
|
|
241
|
-
edgeStrokeFill?: string;
|
|
242
|
-
dividerStrokeFill?: string;
|
|
243
|
-
edgeStrokeWidth?: number;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
247
|
-
/**
|
|
248
|
-
* Width of the grid container
|
|
249
|
-
*/
|
|
250
|
-
width?: number;
|
|
251
|
-
/**
|
|
252
|
-
* Height of the grid container
|
|
253
|
-
*/
|
|
254
|
-
height?: number;
|
|
255
|
-
/**
|
|
256
|
-
* Number of columns in the grid
|
|
257
|
-
*/
|
|
258
|
-
columnCount: number;
|
|
259
|
-
/**
|
|
260
|
-
* Number of rows in the grid
|
|
261
|
-
*/
|
|
262
|
-
rowCount: number;
|
|
263
|
-
/**
|
|
264
|
-
* Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored
|
|
265
|
-
*/
|
|
266
|
-
defaultColumnWidth?: number;
|
|
267
|
-
/**
|
|
268
|
-
* Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored
|
|
269
|
-
*/
|
|
270
|
-
defaultRowHeight?: number;
|
|
271
|
-
/**
|
|
272
|
-
* Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored
|
|
273
|
-
*/
|
|
274
|
-
getRowHeight?: ItemSizer;
|
|
275
|
-
/**
|
|
276
|
-
* Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored
|
|
277
|
-
*/
|
|
278
|
-
getColumnWidth?: ItemSizer;
|
|
279
|
-
/**
|
|
280
|
-
* The layout for the cells
|
|
281
|
-
*/
|
|
282
|
-
layout?: ICellLayout;
|
|
283
|
-
/**
|
|
284
|
-
* Called on scroll, subject to debouncing. Used for programmatic changes. Called even on load
|
|
285
|
-
*/
|
|
286
|
-
onViewportScroll?: (scrollPoint: Partial<TopLeft>) => void;
|
|
287
|
-
/**
|
|
288
|
-
* Called immediately on scroll. Used for programmatic changes. Called even on load
|
|
289
|
-
*/
|
|
290
|
-
onImmediateScroll?: (scrollPoint: Partial<TopLeft>) => void;
|
|
291
|
-
/**
|
|
292
|
-
* Fired when the view port changes.
|
|
293
|
-
* This is in pixel coordinates and is slightly different than viewable cells because off screen location range could change
|
|
294
|
-
*/
|
|
295
|
-
onViewportChange?: (viewport: ScrollableViewport) => void;
|
|
296
|
-
/**
|
|
297
|
-
* Enable dragging active cell and selections
|
|
298
|
-
*/
|
|
299
|
-
enableMouseWheel?: boolean;
|
|
300
|
-
/**
|
|
301
|
-
* When wheel mouse is called. If return false then wheelMouse will not be processed
|
|
302
|
-
*/
|
|
303
|
-
onWheelScroll?: (event: globalThis.WheelEvent) => boolean | void;
|
|
304
|
-
/**
|
|
305
|
-
* The location of the top left scroll corner
|
|
306
|
-
*/
|
|
307
|
-
scrollPoint?: Partial<TopLeft>;
|
|
308
|
-
/**
|
|
309
|
-
* Number of frozen left
|
|
310
|
-
*/
|
|
311
|
-
freezeLeft?: number | FrozenEdge;
|
|
312
|
-
/**
|
|
313
|
-
* Number of frozen top
|
|
314
|
-
*/
|
|
315
|
-
freezeTop?: number | FrozenEdge;
|
|
316
|
-
/**
|
|
317
|
-
* Allow for customization of freezeTopDivider
|
|
318
|
-
*/
|
|
319
|
-
propsFreezeLeft?: Partial<LineProps>;
|
|
320
|
-
/**
|
|
321
|
-
* Allow for customization of freezeTopDivider
|
|
322
|
-
*/
|
|
323
|
-
propsFreezeTop?: Partial<LineProps>;
|
|
324
|
-
/**
|
|
325
|
-
* Called right before a row is being rendered.
|
|
326
|
-
* Will be called for frozen cells and merged cells
|
|
327
|
-
* @remarks Not implement.
|
|
328
|
-
*/
|
|
329
|
-
/**
|
|
330
|
-
* Call only once when the renders for the first time.
|
|
331
|
-
*/
|
|
332
|
-
onFirstRender?: (grid: IGridElement) => void;
|
|
333
|
-
/**
|
|
334
|
-
* Returns the actual element to render.
|
|
335
|
-
*
|
|
336
|
-
* @remarks
|
|
337
|
-
* There can be many cells so care should be taken
|
|
338
|
-
* to ensure these are as performant as possible. By default
|
|
339
|
-
* the pointerEvents are set to none. To enable interaction this should be
|
|
340
|
-
* overwritten.
|
|
341
|
-
*/
|
|
342
|
-
renderCell?: (props: CellRendererProps) => default_2.ReactNode;
|
|
343
|
-
/**
|
|
344
|
-
* Allow for cells to be inset. This is a way to account for borders. By default this is 1, 1, 1,x.
|
|
345
|
-
*/
|
|
346
|
-
cellInsets?: Rectangle;
|
|
347
|
-
/**
|
|
348
|
-
* Render elements for the view. This will be called whenever the viewport changes.
|
|
349
|
-
*/
|
|
350
|
-
renderOverlays?: ((view: IGridView) => default_2.ReactNode)[];
|
|
351
|
-
/**
|
|
352
|
-
* Props passed to all overlayRenderers
|
|
353
|
-
*/
|
|
354
|
-
propsOverlays?: default_2.HTMLAttributes<HTMLDivElement>;
|
|
355
|
-
/**
|
|
356
|
-
* Used for rendering overlays. Similar to cell render but covers the entire area.
|
|
357
|
-
*
|
|
358
|
-
* @param props
|
|
359
|
-
*/
|
|
360
|
-
renderOverlay?: <T extends HTMLDivElement = HTMLDivElement>(props: OverlayRendererProps<T>) => default_2.ReactNode;
|
|
361
|
-
propsOverlay?: default_2.HTMLAttributes<HTMLDivElement>;
|
|
362
|
-
/**
|
|
363
|
-
* Overlays are generally clipped to fit in the viewport but
|
|
364
|
-
* this allows for the properties to be overridden.
|
|
365
|
-
*/
|
|
366
|
-
allowOverlaysOverflow?: boolean;
|
|
367
|
-
/**
|
|
368
|
-
* Allows users to Wrap stage children in Top level Context
|
|
369
|
-
*/
|
|
370
|
-
wrapperStage?: (children: default_2.ReactNode) => default_2.ReactNode;
|
|
371
|
-
/**
|
|
372
|
-
* Props that can be injected to stage
|
|
373
|
-
*/
|
|
374
|
-
propsStage?: default_2.HTMLAttributes<HTMLDivElement>;
|
|
375
|
-
/**
|
|
376
|
-
* Show grid lines.
|
|
377
|
-
* Useful for spreadsheets
|
|
378
|
-
* NOTE - should we just allow gridline renderers to be null?
|
|
379
|
-
*/
|
|
380
|
-
showGridLines?: boolean | Partial<AxisOrientationFlags>;
|
|
381
|
-
/**
|
|
382
|
-
* Customize grid line color.
|
|
383
|
-
* @remarks
|
|
384
|
-
* This is overwritten by gridlinePropsVertical and gridlinePropsHorizontal
|
|
385
|
-
*/
|
|
386
|
-
gridLineColor?: string;
|
|
387
|
-
/**
|
|
388
|
-
* Gridline props for rows.
|
|
389
|
-
*/
|
|
390
|
-
propsGridLineRows?: default_2.SVGProps<SVGPathElement>;
|
|
391
|
-
/**
|
|
392
|
-
* Gridline props for columns.
|
|
393
|
-
*/
|
|
394
|
-
propsGridLineColumns?: default_2.SVGProps<SVGPathElement>;
|
|
395
|
-
/**
|
|
396
|
-
* Will skip rendering for this row and the adjacent rows in the given direction.
|
|
397
|
-
*/
|
|
398
|
-
hiddenRowsAt?: (rowIndex: number, forward: boolean) => number;
|
|
399
|
-
/**
|
|
400
|
-
* Will skip rendering for this columns and the adjacent columns in the given direction.
|
|
401
|
-
*/
|
|
402
|
-
hiddenColumnsAt?: (colIndex: number, forward: boolean) => number;
|
|
403
|
-
/**
|
|
404
|
-
* Indicates the cell is hidden and should not be rendered.
|
|
405
|
-
*
|
|
406
|
-
* @remarks
|
|
407
|
-
* * Superseded by hiddenRowsAt and hiddenColumnsAt.
|
|
408
|
-
* * If getVisibleCells is define this is ignored
|
|
409
|
-
* This is typically used for cells that have nothing to render.
|
|
410
|
-
*/
|
|
411
|
-
hiddenCellAt?: (coords: CellCoords) => boolean;
|
|
412
|
-
/**
|
|
413
|
-
* Allows for optimization of rendering.
|
|
414
|
-
*
|
|
415
|
-
* @param view
|
|
416
|
-
* @returns Either a CellCoord that should be rendered or an object with a coord and value. Note - the value is passed to the cell renderer
|
|
417
|
-
*
|
|
418
|
-
* @remarks
|
|
419
|
-
* * Allows for quick skipping of cells that have nothing to render.
|
|
420
|
-
* * If not specified then all cells within the visible range will be
|
|
421
|
-
* iterated and if hiddenCellAt does not return false then cellRender will be
|
|
422
|
-
* called.
|
|
423
|
-
*/
|
|
424
|
-
getVisibleCells?: (view: IGridView) => ({
|
|
425
|
-
coords: CellCoords;
|
|
426
|
-
value?: any;
|
|
427
|
-
range?: RangeCoords;
|
|
428
|
-
} | CellCoords)[];
|
|
429
|
-
/**
|
|
430
|
-
* Returns the cell as a range. If this cell is merged this will be reflected.
|
|
431
|
-
*
|
|
432
|
-
* @remarks
|
|
433
|
-
* Slightly more sophisticated than rowSpan and colSpan because it allows for queries that are not on the top/left.
|
|
434
|
-
*/
|
|
435
|
-
getCellCoordsAsRangeCoords?: (coords: CellCoords) => RangeCoords;
|
|
436
|
-
/**
|
|
437
|
-
* Zoom. `1` indicates no zoom.
|
|
438
|
-
*
|
|
439
|
-
* @defaultValue 1 or none.
|
|
440
|
-
*/
|
|
441
|
-
zoom?: number;
|
|
442
|
-
/**
|
|
443
|
-
* Cursor used for grid.
|
|
444
|
-
*/
|
|
445
|
-
cursor?: string;
|
|
446
|
-
/**
|
|
447
|
-
* Clip overflow of cells unless explicitly provided.
|
|
448
|
-
*/
|
|
449
|
-
clipCells?: boolean;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
export declare interface GridStyle extends GridSurfaceStyle {
|
|
453
|
-
body?: GridSurfaceStyle;
|
|
454
|
-
selection?: SelectionStyle;
|
|
455
|
-
selectionRemove?: SelectionStyle;
|
|
456
|
-
selectionInactive?: SelectionStyle;
|
|
457
|
-
header?: GridHeaderStyle;
|
|
458
|
-
headerSelect?: GridHeaderStyle;
|
|
459
|
-
headerSelectAll?: GridHeaderStyle;
|
|
460
|
-
headerHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle);
|
|
461
|
-
headerSelection?: SelectionStyle;
|
|
462
|
-
headerSelectionInactive?: SelectionStyle;
|
|
463
|
-
colorShadow?: string;
|
|
464
|
-
colorGrey?: string;
|
|
465
|
-
filterDarkInvert?: string;
|
|
466
|
-
buttonSurface?: GridHeaderStyle;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
export declare interface GridSurfaceStyle extends PaintStyle {
|
|
470
|
-
text?: TextStyle;
|
|
471
|
-
/**
|
|
472
|
-
* Indicates to the renderers that the colors being rendered are for dark mode.
|
|
473
|
-
* @remarks
|
|
474
|
-
* Renderers should invert colors if the colors being used are not specifically for dark mode.
|
|
475
|
-
*/
|
|
476
|
-
darkMode?: boolean;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* A divider placed between headers to provider a visual cue for various actions.
|
|
481
|
-
* Resize, hide/unhide, etc.
|
|
482
|
-
*/
|
|
483
|
-
export declare const HeaderDivider: default_2.NamedExoticComponent<Omit<HeaderDividerAnchorProps, "ref"> & default_2.RefAttributes<IHeaderDividerElement>>;
|
|
484
|
-
|
|
485
|
-
export declare interface HeaderDividerAnchorProps extends HeaderDividerProps {
|
|
486
|
-
renderDivider?: (props: HeaderDividerRendererProps) => default_2.ReactNode;
|
|
487
|
-
/**
|
|
488
|
-
* The number of pixels to mouse before resizing starts.
|
|
489
|
-
* If this number is less than 1 then it will be 1.
|
|
490
|
-
*/
|
|
491
|
-
resizeThreshold?: number;
|
|
492
|
-
/**
|
|
493
|
-
* Called when the mouse is pressed down.
|
|
494
|
-
* @param index the index of the divider.
|
|
495
|
-
* @param size the size of the header during callback.
|
|
496
|
-
*/
|
|
497
|
-
onDividerMouseDown?: (index: number, size: number) => void;
|
|
498
|
-
/**
|
|
499
|
-
* Called after the mouse has dragged beyond the threshold
|
|
500
|
-
*
|
|
501
|
-
* @param index the index of the divider
|
|
502
|
-
* @param prevSize the size of the header on DividerResizeStart (not last resize call)
|
|
503
|
-
*/
|
|
504
|
-
onDividerResizeStart?: (index: number, prevSize: number) => void;
|
|
505
|
-
/**
|
|
506
|
-
* Called during resize.
|
|
507
|
-
* @param index the index of the divider
|
|
508
|
-
* @param size the size of the header during callback
|
|
509
|
-
* @param prevSize the size of the header on resizeStart (not last resize call)
|
|
510
|
-
*/
|
|
511
|
-
onDividerResize?: (index: number, size: number, prevSize: number) => void;
|
|
512
|
-
/**
|
|
513
|
-
* Called after the mouse has been released but only if the mouse onDividerResizeStart was called.
|
|
514
|
-
*
|
|
515
|
-
* @param index The index of the divider
|
|
516
|
-
* @param size the size of the header during callback
|
|
517
|
-
* @param prevSize In pixel the previous size of the divider
|
|
518
|
-
*/
|
|
519
|
-
onDividerResizeEnd?: (index: number, size: number, prevSize: number) => void;
|
|
520
|
-
/**
|
|
521
|
-
* Called when the mouse is released (regardless of resize).
|
|
522
|
-
*
|
|
523
|
-
* @param index
|
|
524
|
-
*/
|
|
525
|
-
onDividerMouseUp?: (index: number) => void;
|
|
526
|
-
/**
|
|
527
|
-
* Called when the mouse autoFit has been initiated (usually a double-click).
|
|
528
|
-
*
|
|
529
|
-
* @param index
|
|
530
|
-
*/
|
|
531
|
-
onDividerAutoFit?: (index: number) => void;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* HeaderDividers follow the header
|
|
536
|
-
* // TODO - allow negative resizing (before the current) (easy to do I think)
|
|
537
|
-
*/
|
|
538
|
-
export declare interface HeaderDividerProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
539
|
-
orientation: RangeOrientation;
|
|
540
|
-
view: IGridView;
|
|
541
|
-
index: number;
|
|
542
|
-
/**
|
|
543
|
-
* This should disable interaction. This should also
|
|
544
|
-
* provide a visual cue that the divider is disabled.
|
|
545
|
-
*/
|
|
546
|
-
disabled?: boolean;
|
|
547
|
-
/**
|
|
548
|
-
* If the divider does not allow resize.
|
|
549
|
-
* @remarks
|
|
550
|
-
* We create a faux divider on the left of the first header and we mark it as disabledResize.
|
|
551
|
-
*/
|
|
552
|
-
disabledResize?: boolean;
|
|
553
|
-
/**
|
|
554
|
-
* If the next header is hidden.
|
|
555
|
-
* This allows the divider to shift location
|
|
556
|
-
*/
|
|
557
|
-
isNextHidden?: boolean;
|
|
558
|
-
/**
|
|
559
|
-
* If the current header is hidden.
|
|
560
|
-
* This allows the divider to shift location
|
|
561
|
-
*/
|
|
562
|
-
isHidden?: boolean;
|
|
563
|
-
/**
|
|
564
|
-
* If the header associated with this divider is selected.
|
|
565
|
-
*/
|
|
566
|
-
isSelected?: boolean;
|
|
567
|
-
/**
|
|
568
|
-
* If the header associated with this divider is selected.
|
|
569
|
-
*/
|
|
570
|
-
isSelectedAll?: boolean;
|
|
571
|
-
/**
|
|
572
|
-
* If the divider is the last one in view. Useful for touch divider that only show the last one.
|
|
573
|
-
*/
|
|
574
|
-
showTouchDivider?: boolean;
|
|
575
|
-
headerStyle: GridHeaderStyle;
|
|
576
|
-
headerStyleSelect: GridHeaderStyle;
|
|
577
|
-
headerStyleSelectAll: GridHeaderStyle;
|
|
578
|
-
headerStyleHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle);
|
|
579
|
-
/**
|
|
580
|
-
* The reference to the element.
|
|
581
|
-
*/
|
|
582
|
-
ref?: default_2.Ref<IHeaderDividerElement>;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
export declare interface HeaderDividerRendererProps extends HeaderDividerProps {
|
|
586
|
-
bounds: Bounds;
|
|
587
|
-
/**
|
|
588
|
-
* Handle mouse down and all dragging
|
|
589
|
-
*/
|
|
590
|
-
onPointerDown: default_2.PointerEventHandler<HTMLDivElement>;
|
|
591
|
-
onAutoFit: () => void;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
export declare const HeaderRenderer: default_2.MemoExoticComponent<(props: HeaderRendererCellProps) => JSX.Element>;
|
|
595
|
-
|
|
596
|
-
export declare interface HeaderRendererCellProps extends CellRendererProps {
|
|
597
|
-
orientation: RangeOrientation;
|
|
598
|
-
index: number;
|
|
599
|
-
headerStyle: GridHeaderStyle;
|
|
600
|
-
headerStyleSelect: GridHeaderStyle;
|
|
601
|
-
headerStyleSelectAll: GridHeaderStyle;
|
|
602
|
-
headerStyleHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle);
|
|
603
|
-
verticalPadding?: number;
|
|
604
|
-
horizontalPadding?: number;
|
|
605
|
-
headerText?: (index: number) => string;
|
|
606
|
-
isSelected?: (index: number) => boolean;
|
|
607
|
-
isSelectedAll?: (index: number) => boolean;
|
|
608
|
-
/**
|
|
609
|
-
* This is not the default grid zoom this is just for rendering.
|
|
610
|
-
* @defaultValue 100
|
|
611
|
-
*/
|
|
612
|
-
zoomScale?: number;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
export declare interface HeaderSelectionResults {
|
|
616
|
-
/**
|
|
617
|
-
* Handler for pointerdown
|
|
618
|
-
*/
|
|
619
|
-
onPointerDown: (e: default_2.PointerEvent<HTMLElement>) => void;
|
|
620
|
-
getCellCoordsFromClient: (x: number, y: number) => CellCoords;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
export declare type ICellEditorAttributes = {
|
|
624
|
-
/**
|
|
625
|
-
* When editor is loaded, this will be called. Note this should not use the autoFocus property. here
|
|
626
|
-
* If this is set the editor focus will be called as appropriate.
|
|
627
|
-
*/
|
|
628
|
-
startEdit?(event: StartEditEvent): void;
|
|
629
|
-
submitEdit(): boolean;
|
|
630
|
-
cancelEdit(): void;
|
|
631
|
-
/**
|
|
632
|
-
* Called if the StartEditEvent event has autoFocus set.
|
|
633
|
-
* @param selector A selector string (or empty means 'default' focus)
|
|
634
|
-
*/
|
|
635
|
-
autoFocus(selector?: string): void;
|
|
636
|
-
/**
|
|
637
|
-
* Returns the default line height.
|
|
638
|
-
*/
|
|
639
|
-
getLineHeight: () => number;
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
export declare interface ICellEditorElement extends HTMLDivElement, ICellEditorAttributes {
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
export declare interface IGridAttributes {
|
|
646
|
-
/**
|
|
647
|
-
* The stage element for the cells
|
|
648
|
-
*/
|
|
649
|
-
readonly stage: HTMLDivElement | null;
|
|
650
|
-
/**
|
|
651
|
-
* The rowCount provided by the properties
|
|
652
|
-
*/
|
|
653
|
-
readonly rowCount: number;
|
|
654
|
-
/**
|
|
655
|
-
* The columnCount provided by the properties
|
|
656
|
-
*/
|
|
657
|
-
readonly columnCount: number;
|
|
658
|
-
/**
|
|
659
|
-
* Invalidate either a cell or a range of cells. If no arguments are provided then the entire grid is invalidated.
|
|
660
|
-
* @param coords
|
|
661
|
-
*/
|
|
662
|
-
invalidate: (coords?: CellCoords | RangeCoords) => void;
|
|
663
|
-
handleWheel: (event: globalThis.WheelEvent) => void;
|
|
664
|
-
getScrollPosition: () => TopLeft;
|
|
665
|
-
getViewport: () => RangeCoords;
|
|
666
|
-
getDimensions: () => {
|
|
667
|
-
containerWidth: number;
|
|
668
|
-
containerHeight: number;
|
|
669
|
-
totalWidth: number;
|
|
670
|
-
totalHeight: number;
|
|
671
|
-
};
|
|
672
|
-
/**
|
|
673
|
-
* Scroll the cell into view. If the coord does not have an index it will only scroll in a single direction.
|
|
674
|
-
*/
|
|
675
|
-
scrollCellCoordsIntoView: (coords: Partial<CellCoords>, options?: globalThis.ScrollIntoViewOptions | boolean) => Promise<Partial<TopLeft>>;
|
|
676
|
-
/**
|
|
677
|
-
* The grid coordinates relative to the containing div (includes any padding, margins)
|
|
678
|
-
*/
|
|
679
|
-
getRelativePointFromClient: (x: number, y: number) => Point | null;
|
|
680
|
-
/**
|
|
681
|
-
* Returns the view for the given point. If point is
|
|
682
|
-
* over a frozen pane it will return the frozen pane otherwise
|
|
683
|
-
* it will return the center view.
|
|
684
|
-
*/
|
|
685
|
-
getViewFromClient: (x: number, y: number) => IGridView;
|
|
686
|
-
/**
|
|
687
|
-
* Returns the view for the given coords. If coord is
|
|
688
|
-
* over a frozen pane it will return the frozen pane otherwise
|
|
689
|
-
* it will return the center view.
|
|
690
|
-
*/
|
|
691
|
-
getViewFromCellCoords: (coords: CellCoords) => IGridView;
|
|
692
|
-
/**
|
|
693
|
-
* Returns null if the view does not exist.
|
|
694
|
-
*/
|
|
695
|
-
getViewFromLocation: (anchor: AnchorLocation) => IGridView | null;
|
|
696
|
-
/**
|
|
697
|
-
* Called when the view has been changed.
|
|
698
|
-
* @remarks
|
|
699
|
-
* This is only called once.
|
|
700
|
-
*/
|
|
701
|
-
onViewChangeOnce: (callback: () => void) => void;
|
|
702
|
-
/**
|
|
703
|
-
* Reference to the underlying element
|
|
704
|
-
*/
|
|
705
|
-
ref?: default_2.Ref<HTMLDivElement>;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Type returned via ref property
|
|
710
|
-
*/
|
|
711
|
-
export declare interface IGridElement extends HTMLDivElement, IGridAttributes {
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Describes the view of a grid.
|
|
716
|
-
*
|
|
717
|
-
* @remarks
|
|
718
|
-
* Useful for overlay rendering.
|
|
719
|
-
*/
|
|
720
|
-
export declare interface IGridView {
|
|
721
|
-
/**
|
|
722
|
-
* Returns the underlying stage element for the view.
|
|
723
|
-
*
|
|
724
|
-
* @remarks
|
|
725
|
-
* Useful for capturing stage events.
|
|
726
|
-
*/
|
|
727
|
-
getStage(): HTMLDivElement | null;
|
|
728
|
-
/**
|
|
729
|
-
* The anchor for the view.
|
|
730
|
-
*/
|
|
731
|
-
getAnchor(): AnchorLocation;
|
|
732
|
-
/**
|
|
733
|
-
* Allow for dimensions to be determined for various cells.
|
|
734
|
-
* The cellLayout is inclusive of the zoom
|
|
735
|
-
*/
|
|
736
|
-
getLayout(): ICellLayout;
|
|
737
|
-
/**
|
|
738
|
-
* Useful for internal rendering.
|
|
739
|
-
*
|
|
740
|
-
* @remarks
|
|
741
|
-
* The cell layout will account for zoom factors already.
|
|
742
|
-
*/
|
|
743
|
-
getZoom(): number;
|
|
744
|
-
/**
|
|
745
|
-
* This captures the total viewable range.
|
|
746
|
-
*
|
|
747
|
-
* @remarks
|
|
748
|
-
* Will have the sames values as {@link getVisibleRows} and {@link getVisibleColumns}.
|
|
749
|
-
*/
|
|
750
|
-
getVisibleRangeCoords(): RangeCoords;
|
|
751
|
-
/**
|
|
752
|
-
* Useful for scanning. Contains a list of row offsets that are visible.
|
|
753
|
-
* Guaranteed to be non-null but may be zero length if no rows are visible.
|
|
754
|
-
*/
|
|
755
|
-
getVisibleRows(): readonly number[];
|
|
756
|
-
/**
|
|
757
|
-
* Useful for scanning. Contains a list of column offsets that are visible.
|
|
758
|
-
* Guaranteed to be non-null but may be zero length if no column are visible.
|
|
759
|
-
*/
|
|
760
|
-
getVisibleColumns(): readonly number[];
|
|
761
|
-
/**
|
|
762
|
-
* Returns the SizedOffsets for columns.
|
|
763
|
-
*/
|
|
764
|
-
getVisibleColumnOffsets(): SizedOffset;
|
|
765
|
-
/**
|
|
766
|
-
* Returns the SizedOffsets for rows.
|
|
767
|
-
*/
|
|
768
|
-
getVisibleRowOffsets(): SizedOffset;
|
|
769
|
-
/**
|
|
770
|
-
* Returns the range coords that captures the entire view.
|
|
771
|
-
*/
|
|
772
|
-
getTotalRangeCoords(): RangeCoords;
|
|
773
|
-
/**
|
|
774
|
-
* Clip a rectangle against the viewport.
|
|
775
|
-
*
|
|
776
|
-
* @remarks
|
|
777
|
-
* * A negative inset will extend outside of the viewport;
|
|
778
|
-
* * Useful when elements should visually 'flow' off of the viewport. (i.e. selection with borders)
|
|
779
|
-
*/
|
|
780
|
-
toClipBounds(bounds?: Bounds, insets?: number | Bounds): Bounds;
|
|
781
|
-
/**
|
|
782
|
-
* Returns the viewport bounds for an absolute bounds.
|
|
783
|
-
*/
|
|
784
|
-
toViewBounds(bounds: Bounds): Bounds;
|
|
785
|
-
/**
|
|
786
|
-
* Returns the absolute bounds for a viewport bounds.
|
|
787
|
-
*/
|
|
788
|
-
toAbsoluteBounds(bounds: Bounds): Bounds;
|
|
789
|
-
/**
|
|
790
|
-
* The bounds of the the overlay relative to the total view.
|
|
791
|
-
*/
|
|
792
|
-
getBounds(): Bounds;
|
|
793
|
-
/**
|
|
794
|
-
* Additional inside padding.
|
|
795
|
-
*/
|
|
796
|
-
getInsets(): Rectangle;
|
|
797
|
-
/**
|
|
798
|
-
* Returns the cell as a range. If this cell is merged this will be reflected.
|
|
799
|
-
* Note - This is slightly more sophisticated than rowSpan and colSpan
|
|
800
|
-
* because it allows for queries that are not on the top/left.
|
|
801
|
-
*/
|
|
802
|
-
getCellCoordsAsRangeCoords(coords: CellCoords): RangeCoords;
|
|
803
|
-
/**
|
|
804
|
-
* Returns a bounds for a given range.
|
|
805
|
-
* If not specified then will return for the cellRange.
|
|
806
|
-
*
|
|
807
|
-
* @param adjustment This allows you to adjust the rect. Note - This is not like insets
|
|
808
|
-
*
|
|
809
|
-
* @remarks
|
|
810
|
-
* The bounds are relative to the view.
|
|
811
|
-
*/
|
|
812
|
-
getRangeCoordsBounds(range?: RangeCoords, adjustment?: Partial<Rectangle>): Bounds;
|
|
813
|
-
/**
|
|
814
|
-
* Scroll the cell coords into view.
|
|
815
|
-
* If the coord does not have an index it will only scroll in a single direction.
|
|
816
|
-
*/
|
|
817
|
-
scrollCellCoordsIntoView(coords: Partial<CellCoords>, options?: globalThis.ScrollIntoViewOptions | boolean): Promise<Partial<TopLeft>>;
|
|
818
|
-
/**
|
|
819
|
-
* Returns the coords at the offset.
|
|
820
|
-
* @param x - The x offset relative to the view
|
|
821
|
-
* @param y - The y offset relative to the view
|
|
822
|
-
* @param actualCell - Don't return the topLeft of a merge. Default value `false`.
|
|
823
|
-
*/
|
|
824
|
-
getCellCoordsFromClient(x: number, y: number, actualCell?: boolean): CellCoords | null;
|
|
825
|
-
/**
|
|
826
|
-
* Indicate the allowable scroll directions.
|
|
827
|
-
*/
|
|
828
|
-
getScrollOrientation(): AxisOrientationFlags;
|
|
829
|
-
getScrollTopLeft(): TopLeft;
|
|
830
|
-
getFreezeTopLeft(): TopLeft;
|
|
831
|
-
/**
|
|
832
|
-
* Returns the total size of all rendered values in pixels.
|
|
833
|
-
*/
|
|
834
|
-
getTotalSize(): Size;
|
|
835
|
-
/**
|
|
836
|
-
* This is the size for all views (but not including the headers)
|
|
837
|
-
*/
|
|
838
|
-
getViewportSize(): Size;
|
|
839
|
-
/**
|
|
840
|
-
* Allows for access to all current views.
|
|
841
|
-
*/
|
|
842
|
-
allViews(): Partial<Record<AnchorLocation, IGridView>>;
|
|
843
|
-
/**
|
|
844
|
-
* Returns a point relative to the view.
|
|
845
|
-
*/
|
|
846
|
-
getRelativePointFromClient(x: number, y: number): Point | null;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
export declare interface IHeaderDividerAttributes {
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
export declare interface IHeaderDividerElement extends HTMLDivElement, IHeaderDividerAttributes {
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
export declare interface LineProps extends default_2.SVGProps<SVGSVGElement> {
|
|
856
|
-
linePoints: number[];
|
|
857
|
-
bounds: Bounds;
|
|
858
|
-
propsPath?: default_2.SVGProps<SVGPathElement>;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
export declare type NewHeaderSelectionMode = "clear" | "modify" | "append";
|
|
862
|
-
|
|
863
|
-
export declare type NewSelectionMode = "clear" | "modify" | "append";
|
|
864
|
-
|
|
865
|
-
export declare interface OverlayRendererProps<T extends HTMLDivElement = any> extends React.HTMLAttributes<HTMLDivElement>, React.Attributes {
|
|
866
|
-
/**
|
|
867
|
-
* The view that is rendering a collection of cells
|
|
868
|
-
*/
|
|
869
|
-
view: IGridView;
|
|
870
|
-
onStageKeyDown?: (e: React.KeyboardEvent<Element>) => void;
|
|
871
|
-
onStagePointerDown?: (e: React.PointerEvent<Element>) => void;
|
|
872
|
-
onStageDoubleClick?: (e: React.PointerEvent<Element>) => void;
|
|
873
|
-
ref?: React.Ref<T>;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
export declare interface PaintStyle {
|
|
877
|
-
fill?: string;
|
|
878
|
-
strokeFill?: string;
|
|
879
|
-
strokeWidth?: number;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
export declare const RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL = 150;
|
|
883
|
-
|
|
884
|
-
export declare const safeSelectionCoords: (prev?: SelectionCoords) => SelectionCoords;
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* ScrollableGrid. This wraps BaseGrid and manages bounds to create consistent css behavior for consumers
|
|
888
|
-
*/
|
|
889
|
-
export declare const ScrollableGrid: default_2.NamedExoticComponent<Omit<ScrollableGridProps, "ref"> & default_2.RefAttributes<IGridElement & IScrollPaneElement>>;
|
|
890
|
-
|
|
891
|
-
export declare interface ScrollableGridProps extends GridProps, ScrollPaneProps {
|
|
892
|
-
/**
|
|
893
|
-
* Callback for detecting a change in the ScrollPane.
|
|
894
|
-
* @param scrollPoint
|
|
895
|
-
*/
|
|
896
|
-
onScrollViewport?: (scrollPoint: Partial<TopLeft>) => void;
|
|
897
|
-
/**
|
|
898
|
-
* Ref for the HTMLDivElement
|
|
899
|
-
*/
|
|
900
|
-
ref?: default_2.Ref<IGridElement | IScrollPaneElement | any>;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
declare const Selection_2: default_2.FC<SelectionProps>;
|
|
904
|
-
export { Selection_2 as Selection }
|
|
905
|
-
|
|
906
|
-
export declare const SELECTION_CLIP_INSETS = -10;
|
|
907
|
-
|
|
908
|
-
export declare interface SelectionPointerHandlerOptions extends Omit<PointerHandlerOptions, "onPointerDown" | "onPointerMoveOrWait"> {
|
|
909
|
-
onSelectionPointerDown: (event: default_2.PointerEvent<Element>, modifiers: PointerModifiers, view?: IGridView, coords?: CellCoords, pivotCoords?: CellCoords, extendSelection?: boolean, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => boolean | void;
|
|
910
|
-
onSelectionPointerMoveOrWait?: (event: default_2.PointerEvent<Element>, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<Element>, view?: IGridView, coords?: CellCoords, pivotCoords?: CellCoords, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => void;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
export declare type SelectionPolicy = "single" | "range" | "multiple";
|
|
914
|
-
|
|
915
|
-
export declare interface SelectionProps extends SVGRectProps {
|
|
916
|
-
/**
|
|
917
|
-
* @defaultValue false unless props are set
|
|
918
|
-
*/
|
|
919
|
-
isAnimatedStroke?: boolean;
|
|
920
|
-
/**
|
|
921
|
-
* Customize props for Animated Stroke
|
|
922
|
-
*/
|
|
923
|
-
propsAnimatedStroke?: AnimatedStrokeProps;
|
|
924
|
-
/**
|
|
925
|
-
* The range that this selection represents.
|
|
926
|
-
*/
|
|
927
|
-
range: RangeCoords;
|
|
928
|
-
/**
|
|
929
|
-
* An area may or may not contain an anchor cell.
|
|
930
|
-
*/
|
|
931
|
-
cell?: CellCoords;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
export declare interface SelectionResults {
|
|
935
|
-
/**
|
|
936
|
-
* The current selection.
|
|
937
|
-
*/
|
|
938
|
-
selection: SelectionCoords;
|
|
939
|
-
/**
|
|
940
|
-
* Set the currently active cell.
|
|
941
|
-
*/
|
|
942
|
-
setSelectionCell: (coords: CellCoords | null, shouldScroll?: boolean) => void;
|
|
943
|
-
/**
|
|
944
|
-
* Use this to update selections without clearing old selection.
|
|
945
|
-
*/
|
|
946
|
-
setSelectionRanges: (ranges: RangeCoords[] | ((ranges: RangeCoords[]) => RangeCoords[])) => void;
|
|
947
|
-
/**
|
|
948
|
-
* Handler for pointerdown, use to set activeCoords
|
|
949
|
-
*/
|
|
950
|
-
onPointerDown: (e: default_2.PointerEvent) => void;
|
|
951
|
-
/**
|
|
952
|
-
* Returns a flag indicating if the entire range is selected
|
|
953
|
-
*/
|
|
954
|
-
isEntire: boolean;
|
|
955
|
-
/**
|
|
956
|
-
* Preferred global cursor if set
|
|
957
|
-
*/
|
|
958
|
-
cursor?: string;
|
|
959
|
-
/**
|
|
960
|
-
* Array of functions that return components to overlay
|
|
961
|
-
* // TODO - make this a function that takes props and received onMouse, onKeyboard
|
|
962
|
-
* (we can then make selection overlays a function that doesn't rerender the table (or sheet on move))
|
|
963
|
-
*/
|
|
964
|
-
renderOverlay: (view: IGridView) => default_2.ReactNode;
|
|
965
|
-
/**
|
|
966
|
-
* Navigate left/right/up/down
|
|
967
|
-
* @param direction The direction to navigate.
|
|
968
|
-
* @param select A flag indicating if we should select the new cell.
|
|
969
|
-
* @param contentFul A flag indicating if we should navigate to the next contentful cell.
|
|
970
|
-
* @param incrementAmount Use instead of contentful. Allows for navigating distances (useful for pageUp/pageDown).
|
|
971
|
-
*/
|
|
972
|
-
navigate?: (direction: Direction, select?: boolean, contentFul?: boolean, incrementAmount?: number) => void;
|
|
973
|
-
/**
|
|
974
|
-
* Navigate with the selections (unless there is no active selection)
|
|
975
|
-
*/
|
|
976
|
-
navigateSelection: (direction: Direction) => void;
|
|
977
|
-
/**
|
|
978
|
-
* Use this to invoke a new selection. All old selections will be cleared
|
|
979
|
-
*/
|
|
980
|
-
newSelection: (coordsStart: Partial<CellCoords>, coordsEnd?: Partial<CellCoords>, anchor?: Partial<CellCoords>) => void;
|
|
981
|
-
/**
|
|
982
|
-
* Modify selection. If the coordsPivot is not provided then the current anchor will be used.
|
|
983
|
-
*/
|
|
984
|
-
modifySelection: (coords: CellCoords, coordsPivot?: CellCoords) => void;
|
|
985
|
-
/**
|
|
986
|
-
* Add a new selection
|
|
987
|
-
*/
|
|
988
|
-
appendSelection: (start: CellCoords, end: CellCoords, anchor?: Partial<CellCoords>) => void;
|
|
989
|
-
/**
|
|
990
|
-
* Clear all current ranges. Leaves the anchor intact
|
|
991
|
-
*/
|
|
992
|
-
clearSelections: () => void;
|
|
993
|
-
/**
|
|
994
|
-
* Clears the last selection
|
|
995
|
-
*/
|
|
996
|
-
clearLastSelection: () => void;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
export declare interface SelectionStyle extends PaintStyle {
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
export declare type SizedOffset = Record<number, {
|
|
1003
|
-
offset: number;
|
|
1004
|
-
size: number;
|
|
1005
|
-
spanIndex: number;
|
|
1006
|
-
}>;
|
|
1007
|
-
|
|
1008
|
-
/**
|
|
1009
|
-
* A set of standard characters that are used for starting a CellEditor.
|
|
1010
|
-
*/
|
|
1011
|
-
export declare const STANDARD_KEY_CHARS: string;
|
|
1012
|
-
|
|
1013
|
-
export declare interface StartEditEvent {
|
|
1014
|
-
/**
|
|
1015
|
-
* Edit text. If this is null or undefined then this will not replace the text.
|
|
1016
|
-
*
|
|
1017
|
-
* @defaultValue null
|
|
1018
|
-
*
|
|
1019
|
-
* @remarks
|
|
1020
|
-
* * A '' will clear the text.
|
|
1021
|
-
*/
|
|
1022
|
-
text?: string;
|
|
1023
|
-
/**
|
|
1024
|
-
* Is editor starting in edit mode.
|
|
1025
|
-
*
|
|
1026
|
-
* @defaultValue false
|
|
1027
|
-
*/
|
|
1028
|
-
editMode?: boolean;
|
|
1029
|
-
/**
|
|
1030
|
-
* Allows the initial selection position to be overridden. By default it's at the end
|
|
1031
|
-
*/
|
|
1032
|
-
initialSelection?: {
|
|
1033
|
-
start: number;
|
|
1034
|
-
end: number;
|
|
1035
|
-
direction?: "forward" | "backward" | "none";
|
|
1036
|
-
};
|
|
1037
|
-
/**
|
|
1038
|
-
* Should editor start editing with focus. If a string is passed this will use a querySelector to a nest element to focus.
|
|
1039
|
-
*
|
|
1040
|
-
* @defaultValue true
|
|
1041
|
-
*/
|
|
1042
|
-
autoFocus?: boolean | string;
|
|
1043
|
-
/**
|
|
1044
|
-
* The cell that should be edited
|
|
1045
|
-
*/
|
|
1046
|
-
cell?: CellCoords;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
export declare interface StringCellEditorProps extends CellEditorProps<string, string> {
|
|
1050
|
-
textProperties?: PaintableText;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
export declare const SVGLine: (props: LineProps) => JSX.Element;
|
|
1054
|
-
|
|
1055
|
-
declare const SVGRect_2: (props: SVGRectProps) => JSX.Element;
|
|
1056
|
-
export { SVGRect_2 as SVGRect }
|
|
1057
|
-
|
|
1058
|
-
export declare interface SVGRectProps extends default_2.SVGProps<SVGSVGElement> {
|
|
1059
|
-
boundsPath?: Bounds;
|
|
1060
|
-
propsPath?: default_2.SVGProps<SVGPathElement>;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
export declare interface TextStyle extends PaintStyle {
|
|
1064
|
-
fontFamily?: string;
|
|
1065
|
-
fontSize?: number;
|
|
1066
|
-
fontWeight?: string | number;
|
|
1067
|
-
fontStyle?: string;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* TouchSelectHandle component
|
|
1072
|
-
*/
|
|
1073
|
-
export declare const TouchSelectHandle: default_2.NamedExoticComponent<Omit<TouchSelectHandleProps, "ref"> & default_2.RefAttributes<TouchSelectHandleElement>>;
|
|
1074
|
-
|
|
1075
|
-
export declare interface TouchSelectHandleAttributes {
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
export declare interface TouchSelectHandleElement extends HTMLDivElement, TouchSelectHandleAttributes {
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
export declare interface TouchSelectHandleProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
1082
|
-
/**
|
|
1083
|
-
* Possible anchors are. If 'l', 't', 'r', or 'b', then it will center along view the view.
|
|
1084
|
-
*
|
|
1085
|
-
* @remarks
|
|
1086
|
-
* Determines not only the position but the event that is fired.
|
|
1087
|
-
*/
|
|
1088
|
-
anchor: 'tl' | 'br' | 'l' | 't' | 'r' | 'b';
|
|
1089
|
-
range: RangeCoords;
|
|
1090
|
-
view: IGridView;
|
|
1091
|
-
size?: number;
|
|
1092
|
-
borderWidth?: number;
|
|
1093
|
-
borderStroke?: string;
|
|
1094
|
-
background?: string;
|
|
1095
|
-
selectionTouchPointerHandler: SelectionPointerHandlerOptions;
|
|
1096
|
-
onTouchSelectStart?: (anchor: string) => void;
|
|
1097
|
-
onTouchSelectEnd?: (anchor: string) => void;
|
|
1098
|
-
/**
|
|
1099
|
-
* Indicate that a touch handling is being used
|
|
1100
|
-
*/
|
|
1101
|
-
currentTouchAnchor?: string;
|
|
1102
|
-
/**
|
|
1103
|
-
* If provided then touch control will walk the parent hierarchy
|
|
1104
|
-
* to find the absolute scroll position
|
|
1105
|
-
*/
|
|
1106
|
-
scrollableElement?: HTMLElement;
|
|
1107
|
-
/**
|
|
1108
|
-
* Use to add create the portal
|
|
1109
|
-
* @defaultValue document.body
|
|
1110
|
-
*/
|
|
1111
|
-
scrollableRoot?: HTMLElement;
|
|
1112
|
-
/**
|
|
1113
|
-
* Reference to the underling element
|
|
1114
|
-
*/
|
|
1115
|
-
ref?: default_2.Ref<TouchSelectHandleElement>;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
/**
|
|
1119
|
-
* Hook to manage cell layout
|
|
1120
|
-
*/
|
|
1121
|
-
export declare const useCellLayout: (props: UseCellLayoutProps | null) => ICellLayout;
|
|
1122
|
-
|
|
1123
|
-
export declare interface UseCellLayoutProps {
|
|
1124
|
-
/**
|
|
1125
|
-
* Number of columns in the grid
|
|
1126
|
-
*/
|
|
1127
|
-
columnCount: number;
|
|
1128
|
-
/**
|
|
1129
|
-
* Number of rows in the grid
|
|
1130
|
-
*/
|
|
1131
|
-
rowCount: number;
|
|
1132
|
-
/**
|
|
1133
|
-
* Performance - Helps in lazy grid width calculation
|
|
1134
|
-
*/
|
|
1135
|
-
defaultColumnWidth?: number;
|
|
1136
|
-
/**
|
|
1137
|
-
* Performance - Helps in lazy grid height calculation
|
|
1138
|
-
*/
|
|
1139
|
-
defaultRowHeight?: number;
|
|
1140
|
-
/**
|
|
1141
|
-
* Should return height of a row at an index
|
|
1142
|
-
*/
|
|
1143
|
-
getRowHeight?: ItemSizer;
|
|
1144
|
-
/**
|
|
1145
|
-
* Should return width of a column at an index
|
|
1146
|
-
*/
|
|
1147
|
-
getColumnWidth?: ItemSizer;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Hook to enable selection in grid
|
|
1152
|
-
*/
|
|
1153
|
-
export declare const useHeaderSelection: ({ gridRef, gridMainRef, orientation, headerCount: propHeaderCount, selectionPolicy, newSelectionMode, alwaysScrollToActiveCoords, onDragStart: propOnDragStart, onDragEnd: propOnDragEnd, pointerDownInterceptor, pointerMoveInterceptor, onPointerUp, newSelection: propNewSelection, modifySelection: propModifySelection, appendSelection: propAppendSelection, clearSelections: propClearSelections, }: UseHeaderSelectionOptions) => HeaderSelectionResults;
|
|
1154
|
-
|
|
1155
|
-
/**
|
|
1156
|
-
* Hook for managing the header selections.
|
|
1157
|
-
*
|
|
1158
|
-
* TODO - When dragging a selection that already exist it should drag for reorder. (Not supported yet)
|
|
1159
|
-
*/
|
|
1160
|
-
export declare interface UseHeaderSelectionOptions {
|
|
1161
|
-
/**
|
|
1162
|
-
* Access grid functions
|
|
1163
|
-
*/
|
|
1164
|
-
gridMainRef: default_2.RefObject<IGridElement | null>;
|
|
1165
|
-
/**
|
|
1166
|
-
* Access grid functions
|
|
1167
|
-
*/
|
|
1168
|
-
gridRef: default_2.RefObject<IGridElement | null>;
|
|
1169
|
-
/**
|
|
1170
|
-
* The orientation of the header.
|
|
1171
|
-
*/
|
|
1172
|
-
orientation?: RangeOrientation;
|
|
1173
|
-
/**
|
|
1174
|
-
* No of headers in the grid
|
|
1175
|
-
*/
|
|
1176
|
-
headerCount?: number;
|
|
1177
|
-
/**
|
|
1178
|
-
* scroll to active cell when
|
|
1179
|
-
*/
|
|
1180
|
-
alwaysScrollToActiveCoords?: boolean;
|
|
1181
|
-
/**
|
|
1182
|
-
* Pointerdown Interceptor
|
|
1183
|
-
*/
|
|
1184
|
-
pointerDownInterceptor?: (e: default_2.PointerEvent<Element>, coords: CellCoords) => boolean | undefined;
|
|
1185
|
-
/**
|
|
1186
|
-
* Pointer Move Interceptor
|
|
1187
|
-
*/
|
|
1188
|
-
pointerMoveInterceptor?: (e: default_2.PointerEvent, coords: CellCoords) => boolean | undefined;
|
|
1189
|
-
/**
|
|
1190
|
-
* Pointer Up Listener
|
|
1191
|
-
*/
|
|
1192
|
-
onPointerUp?: (e: default_2.PointerEvent) => void;
|
|
1193
|
-
/**
|
|
1194
|
-
* Returns true if the coordinate span can overlap merged ranges.
|
|
1195
|
-
* @param start
|
|
1196
|
-
* @param end
|
|
1197
|
-
* @returns A flag indicating if the selection will span over (ignore) merged cells.
|
|
1198
|
-
*/
|
|
1199
|
-
canSelectionSpanMergedCells?: (start: CellCoords, end: CellCoords) => boolean;
|
|
1200
|
-
/**
|
|
1201
|
-
* Selection policy
|
|
1202
|
-
*/
|
|
1203
|
-
selectionPolicy?: SelectionPolicy;
|
|
1204
|
-
/**
|
|
1205
|
-
* New selection mode
|
|
1206
|
-
*/
|
|
1207
|
-
newSelectionMode?: NewHeaderSelectionMode;
|
|
1208
|
-
/**
|
|
1209
|
-
* Callback when drag starts
|
|
1210
|
-
*/
|
|
1211
|
-
onDragStart?: () => void;
|
|
1212
|
-
/**
|
|
1213
|
-
* Callback when drag ends
|
|
1214
|
-
*/
|
|
1215
|
-
onDragEnd?: () => void;
|
|
1216
|
-
/**
|
|
1217
|
-
* Use this to invoke a new selection. All old selections will be cleared
|
|
1218
|
-
*/
|
|
1219
|
-
newSelection: (coordsStart: Partial<CellCoords>, coordsEnd?: Partial<CellCoords>, anchor?: Partial<CellCoords>) => void;
|
|
1220
|
-
/**
|
|
1221
|
-
* Modify selection. If the coordsPivot is not provided then the current anchor will be used.
|
|
1222
|
-
*/
|
|
1223
|
-
modifySelection: (coords: CellCoords, coordsPivot?: CellCoords) => void;
|
|
1224
|
-
/**
|
|
1225
|
-
* Add a new selection
|
|
1226
|
-
*/
|
|
1227
|
-
appendSelection: (start: CellCoords, end: CellCoords, anchor?: Partial<CellCoords>) => void;
|
|
1228
|
-
/**
|
|
1229
|
-
* Clear all current ranges. Leaves the anchor intact
|
|
1230
|
-
*/
|
|
1231
|
-
clearSelections: () => void;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Hook to make enable inline 'keyboard editing'. Simple editing like checkboxes can be implemented as renderers
|
|
1236
|
-
*
|
|
1237
|
-
* @param props
|
|
1238
|
-
*
|
|
1239
|
-
* @remarks
|
|
1240
|
-
* For creating a CellOverlay that routes keyboard (and pointer) events.
|
|
1241
|
-
*/
|
|
1242
|
-
export declare const useKeyboardEditorOverlay: (props: useKeyboardEditorOverlayOptions) => EditorOverlayResults;
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* This enables custom editors to be injected in place of a renderer.
|
|
1246
|
-
* Note sometimes is makes more sense to just allow the renderer to edit in place.
|
|
1247
|
-
* Some examples are when a formula is being entered or if the cell is empty
|
|
1248
|
-
*
|
|
1249
|
-
* TODO - should the editor extend the render interface?
|
|
1250
|
-
*/
|
|
1251
|
-
export declare interface useKeyboardEditorOverlayOptions {
|
|
1252
|
-
/**
|
|
1253
|
-
* If provided and it doesn't return null then the editor will be aligned to the range.
|
|
1254
|
-
*/
|
|
1255
|
-
getRangeCoords?: (coord: CellCoords) => RangeCoords;
|
|
1256
|
-
/**
|
|
1257
|
-
* The view that is being used for rendering
|
|
1258
|
-
*/
|
|
1259
|
-
view: IGridView;
|
|
1260
|
-
/**
|
|
1261
|
-
* Active selected cell. This is required to enable
|
|
1262
|
-
* the editor to activate when a key is pressed
|
|
1263
|
-
*/
|
|
1264
|
-
activeCoords: CellCoords | null;
|
|
1265
|
-
/**
|
|
1266
|
-
* Inject custom editors based on a cell.
|
|
1267
|
-
* This should not return null but rather can canEdit.
|
|
1268
|
-
* This is called during placement after scrolling and other bookkeeping has occurred
|
|
1269
|
-
*/
|
|
1270
|
-
getCellEditor: (props: CellEditorProps<any, any>, coords: CellCoords) => default_2.ReactElement<CellEditorProps<any, any>>;
|
|
1271
|
-
/**
|
|
1272
|
-
* Callback fired before editing. Can be used to prevent editing.
|
|
1273
|
-
*/
|
|
1274
|
-
canEdit?(coords: CellCoords): boolean;
|
|
1275
|
-
/**
|
|
1276
|
-
* Callback when a start has been initialed. This is called before the editor is mounted.
|
|
1277
|
-
*/
|
|
1278
|
-
onBeforeStartEdit?: (coords: CellCoords) => void;
|
|
1279
|
-
/**
|
|
1280
|
-
* Callback when user start editing
|
|
1281
|
-
*/
|
|
1282
|
-
onStartEdit?: (coords: CellCoords) => void;
|
|
1283
|
-
/**
|
|
1284
|
-
* Callback when user submits a value. Use this to update state
|
|
1285
|
-
*/
|
|
1286
|
-
onSubmitEdit?: (coords: CellCoords) => void;
|
|
1287
|
-
/**
|
|
1288
|
-
* Callback when user cancels editing
|
|
1289
|
-
*/
|
|
1290
|
-
onCancelEdit?: (coords: CellCoords) => void;
|
|
1291
|
-
/**
|
|
1292
|
-
* Callback when user is done editing, either a submit or a cancel
|
|
1293
|
-
*/
|
|
1294
|
-
onDoneEdit?: (coords: CellCoords) => void;
|
|
1295
|
-
onNavigate?: (direction: Direction) => void;
|
|
1296
|
-
/**
|
|
1297
|
-
* Test if the key event should start the editor
|
|
1298
|
-
*/
|
|
1299
|
-
isEditorStartKeyEvent?: (e: KeyboardEvent, coords: CellCoords) => boolean | StartEditEvent;
|
|
1300
|
-
/**
|
|
1301
|
-
* Test if the mouse event should start the editor. If this returns an event this will be dispatched to the editor.
|
|
1302
|
-
*
|
|
1303
|
-
* @param e - The pointer event
|
|
1304
|
-
*
|
|
1305
|
-
* @returns Either `true` or an `StartEditEvent`
|
|
1306
|
-
*/
|
|
1307
|
-
isEditorStartPointerEvent?: (e: PointerEvent, coords: CellCoords) => boolean | StartEditEvent;
|
|
1308
|
-
propsContainer?: default_2.HTMLAttributes<HTMLDivElement>;
|
|
1309
|
-
borderStrokeFill?: string;
|
|
1310
|
-
borderStrokeWidth?: number;
|
|
1311
|
-
/**
|
|
1312
|
-
* The editor alignment. Used for expanding on overflow
|
|
1313
|
-
*/
|
|
1314
|
-
alignment?: HorizontalAlignment;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
/**
|
|
1318
|
-
* Hook to enable selection in grid
|
|
1319
|
-
*/
|
|
1320
|
-
export declare const useSelection: ({ gridRef, commands, layout, selection: propSelection, onSelectionChange: propOnSelectionChange, onSelectionDragStart: propOnSelectionDragStart, onSelectionDragEnd: propOnSelectionDragEnd, selectionPolicy, newSelectionMode, allowDeselectSelection, onFillPreview: propOnFillPreview, onFillCancel: propOnFillCancel, onFillDone: propOnFillDone, onFill: propOnFill, disableFillDrag, fillHandleBorderColor, hiddenRowsAt: propHiddenRowsAt, hiddenColumnsAt: propHiddenColumnsAt, isContentfulCell: propsIsContentfulCell, contentfulCellFinder: propContentfulCellFinder, getDataCoords, alwaysScrollToActiveCoords, selectionBounds: propSelectionBounds, pointerDownInterceptor, pointerMoveInterceptor, mergedRanges, canSelectionSpanMergedCells, onMoveDragStart: propOnMoveDragStart, onMoveDragUpdate: propOnMoveDragUpdate, onMoveDragEnd: propOnMoveDragEnd, onMoveDragDone: propOnMoveDragDone, renderSelection: propRenderSelection, disableMoveDrag, getCellCoordsAsRangeCoords, moveDragHitSize, moveDragOutlineSize, selectionBackgroundColor, selectionBorderColor, selectionRemoveBorderColor, selectionRemoveBackgroundColor, disableTouchSelection, propsTouchSelectHandle, }: UseSelectionOptions) => SelectionResults;
|
|
1321
|
-
|
|
1322
|
-
export declare interface UseSelectionOptions {
|
|
1323
|
-
/**
|
|
1324
|
-
* Access grid functions.
|
|
1325
|
-
*/
|
|
1326
|
-
gridRef: default_2.RefObject<IGridElement | null>;
|
|
1327
|
-
commands?: ICommands.IGroup;
|
|
1328
|
-
/**
|
|
1329
|
-
* This is used for pageUp/pageDown and getHiddenAuto.
|
|
1330
|
-
*/
|
|
1331
|
-
layout?: ICellLayout;
|
|
1332
|
-
/**
|
|
1333
|
-
* selections
|
|
1334
|
-
*/
|
|
1335
|
-
selection?: SelectionCoords;
|
|
1336
|
-
/**
|
|
1337
|
-
* Callback when a value has changed.
|
|
1338
|
-
*/
|
|
1339
|
-
onSelectionChange?: (selection: SelectionCoords) => void;
|
|
1340
|
-
/**
|
|
1341
|
-
* Callback at the start of selection change driven by the pointer.
|
|
1342
|
-
*/
|
|
1343
|
-
onSelectionDragStart?: (selection: SelectionCoords, e: default_2.PointerEvent<Element>) => void;
|
|
1344
|
-
/**
|
|
1345
|
-
* Callback at the end of selection change driven by the pointer.
|
|
1346
|
-
*/
|
|
1347
|
-
onSelectionDragEnd?: (selection: SelectionCoords, e: default_2.PointerEvent<Element>) => void;
|
|
1348
|
-
/**
|
|
1349
|
-
* Allow deselect a selected area
|
|
1350
|
-
*/
|
|
1351
|
-
allowDeselectSelection?: boolean;
|
|
1352
|
-
/**
|
|
1353
|
-
* Hidden rows
|
|
1354
|
-
*/
|
|
1355
|
-
hiddenRowsAt?: HiddenHeadersAt;
|
|
1356
|
-
/**
|
|
1357
|
-
* Hidden columns
|
|
1358
|
-
*/
|
|
1359
|
-
hiddenColumnsAt?: HiddenHeadersAt;
|
|
1360
|
-
/**
|
|
1361
|
-
* If there is no value. Note - This is slightly different than isEmpty because it may still have logical render (like fill, border, etc)
|
|
1362
|
-
*/
|
|
1363
|
-
isContentfulCell?: (coords: CellCoords) => boolean;
|
|
1364
|
-
/**
|
|
1365
|
-
* Allows for selection to navigate intelligently between cells based on if they have data.
|
|
1366
|
-
* If this is note specified a default implementation will be used that uses hiddenRowsAt/hiddenColumnsAt/hiddenCellAt.
|
|
1367
|
-
* If no intelligently navigation is desired then this can be set explicitly to null.
|
|
1368
|
-
*/
|
|
1369
|
-
contentfulCellFinder?: CellFinder;
|
|
1370
|
-
/**
|
|
1371
|
-
* Performance - important performance consideration.
|
|
1372
|
-
* This allows functions (like copy and scan to not operate on the entire sheet.)
|
|
1373
|
-
* If this is not set or returns `undefined` then a scan of all the rows/columns will
|
|
1374
|
-
* be done when needed to determine. (For example select all in a large sheet and copy to clipboard)
|
|
1375
|
-
*/
|
|
1376
|
-
getDataCoords?: () => RangeCoords;
|
|
1377
|
-
/**
|
|
1378
|
-
* Always scroll to active cell
|
|
1379
|
-
*/
|
|
1380
|
-
alwaysScrollToActiveCoords?: boolean;
|
|
1381
|
-
/**
|
|
1382
|
-
* bound of selection
|
|
1383
|
-
*/
|
|
1384
|
-
selectionBounds?: Rectangle;
|
|
1385
|
-
/**
|
|
1386
|
-
* pointerDownInterceptor
|
|
1387
|
-
*/
|
|
1388
|
-
pointerDownInterceptor?: (e: default_2.PointerEvent<Element>, coords: CellCoords, selection: SelectionCoords) => boolean | undefined;
|
|
1389
|
-
pointerMoveInterceptor?: (e: default_2.PointerEvent<Element>, coords: CellCoords, selection: SelectionCoords) => boolean | undefined;
|
|
1390
|
-
/**
|
|
1391
|
-
* Is the current selection able to intersect merged cells.
|
|
1392
|
-
*/
|
|
1393
|
-
canSelectionSpanMergedCells?: (range: RangeCoords) => boolean;
|
|
1394
|
-
/**
|
|
1395
|
-
* Selection policy
|
|
1396
|
-
*/
|
|
1397
|
-
selectionPolicy?: SelectionPolicy;
|
|
1398
|
-
/**
|
|
1399
|
-
* New selection mode
|
|
1400
|
-
*/
|
|
1401
|
-
newSelectionMode?: NewSelectionMode;
|
|
1402
|
-
/**
|
|
1403
|
-
* Disable move drag
|
|
1404
|
-
* @defaultValue if the onMoveDragDone is provided
|
|
1405
|
-
*/
|
|
1406
|
-
disableMoveDrag?: boolean;
|
|
1407
|
-
/**
|
|
1408
|
-
* The size of the move hit stroke.
|
|
1409
|
-
* @defaultValue 5
|
|
1410
|
-
*/
|
|
1411
|
-
moveDragHitSize?: number;
|
|
1412
|
-
/**
|
|
1413
|
-
* The size of the move outline.
|
|
1414
|
-
* @defaultValue 3
|
|
1415
|
-
*/
|
|
1416
|
-
moveDragOutlineSize?: number;
|
|
1417
|
-
/**
|
|
1418
|
-
* Callback at the start of selection change driven by the pointer.
|
|
1419
|
-
*/
|
|
1420
|
-
onMoveDragStart?: (from: RangeCoords, e: default_2.PointerEvent<Element>, modifiers: PointerModifiers) => void;
|
|
1421
|
-
/**
|
|
1422
|
-
* Callback at the start of selection change driven by the pointer.
|
|
1423
|
-
*/
|
|
1424
|
-
onMoveDragUpdate?: (from: RangeCoords, e: default_2.PointerEvent<Element>, modifiers: PointerModifiers) => void;
|
|
1425
|
-
/**
|
|
1426
|
-
* Callback at the end of selection change driven by the pointer.
|
|
1427
|
-
*/
|
|
1428
|
-
onMoveDragEnd?: (from: RangeCoords, e: default_2.PointerEvent<Element>, modifiers: PointerModifiers) => void;
|
|
1429
|
-
/**
|
|
1430
|
-
* When selection is moved.
|
|
1431
|
-
*/
|
|
1432
|
-
onMoveDragDone?: (from: RangeCoords, to: RangeCoords, event: default_2.PointerEvent<Element>, modifiers: PointerModifiers) => Promise<void>;
|
|
1433
|
-
/**
|
|
1434
|
-
* Disable fill drag.
|
|
1435
|
-
* @defaultValue to a value based on if onFill is provided.
|
|
1436
|
-
*/
|
|
1437
|
-
disableFillDrag?: boolean;
|
|
1438
|
-
/**
|
|
1439
|
-
* Called to actually perform the fill.
|
|
1440
|
-
*/
|
|
1441
|
-
onFill?: (template: RangeCoords, destination: RangeCoords, direction: Direction) => void;
|
|
1442
|
-
/**
|
|
1443
|
-
* Called when dragging to fill.
|
|
1444
|
-
*/
|
|
1445
|
-
onFillPreview?: (template: RangeCoords, destination: RangeCoords, direction: Direction) => void;
|
|
1446
|
-
/**
|
|
1447
|
-
* Called when a cancel is started but not completed by dragging to original rect.
|
|
1448
|
-
*/
|
|
1449
|
-
onFillCancel?: () => void;
|
|
1450
|
-
/**
|
|
1451
|
-
* Called when fill gesture is complete; either onFill or onFillCancel'
|
|
1452
|
-
*/
|
|
1453
|
-
onFillDone?: () => void;
|
|
1454
|
-
/**
|
|
1455
|
-
* Border color of fill handle.
|
|
1456
|
-
*/
|
|
1457
|
-
fillHandleBorderColor?: string;
|
|
1458
|
-
/**
|
|
1459
|
-
* Disable touch selection If false then the touch selection handles are not set
|
|
1460
|
-
* @defaultValue true
|
|
1461
|
-
*/
|
|
1462
|
-
disableTouchSelection?: boolean;
|
|
1463
|
-
/**
|
|
1464
|
-
* If touch is enabled.
|
|
1465
|
-
*/
|
|
1466
|
-
propsTouchSelectHandle?: TouchSelectHandleProps;
|
|
1467
|
-
/**
|
|
1468
|
-
* Allow users to customize selected cells design
|
|
1469
|
-
*/
|
|
1470
|
-
renderSelection?: (props: SelectionProps) => default_2.ReactNode;
|
|
1471
|
-
/**
|
|
1472
|
-
* Border color of selected area
|
|
1473
|
-
*/
|
|
1474
|
-
selectionBorderColor?: string;
|
|
1475
|
-
/**
|
|
1476
|
-
* Background of selection
|
|
1477
|
-
*/
|
|
1478
|
-
selectionBackgroundColor?: string;
|
|
1479
|
-
selectionRemoveBorderColor?: string;
|
|
1480
|
-
/**
|
|
1481
|
-
* Background of selection for removal
|
|
1482
|
-
*/
|
|
1483
|
-
selectionRemoveBackgroundColor?: string;
|
|
1484
|
-
/**
|
|
1485
|
-
* Is either an array of merged cells or a RangeCoordsLookup
|
|
1486
|
-
*/
|
|
1487
|
-
mergedRanges?: RangeCoords[] | ((range: RangeCoords) => RangeCoords[]);
|
|
1488
|
-
/**
|
|
1489
|
-
* Returns the cell as a range. If this cell is merged this will be reflected.
|
|
1490
|
-
* @remarks
|
|
1491
|
-
* This is slightly more sophisticated than rowSpan and colSpan
|
|
1492
|
-
* because it allows for queries that are not on the top/left.
|
|
1493
|
-
*/
|
|
1494
|
-
getCellCoordsAsRangeCoords?: (coords: CellCoords) => RangeCoords;
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
export { }
|
|
1
|
+
export * from './src/index'
|
|
2
|
+
export {}
|