@sheetxl/grid-react 0.7.19 → 0.7.21

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/types/index.d.ts CHANGED
@@ -3,11 +3,11 @@ import { AxisOrientationFlags } from '@sheetxl/utils';
3
3
  import { Bounds } from '@sheetxl/utils';
4
4
  import { CellCoords } from '@sheetxl/utils';
5
5
  import { CellFinder } from '@sheetxl/utils-react';
6
- import { CellLayout } from '@sheetxl/utils-react';
7
6
  import { default as default_2 } from 'react';
8
7
  import { Direction } from '@sheetxl/utils';
9
8
  import { HiddenHeadersAt } from '@sheetxl/utils-react';
10
9
  import { HorizontalAlignment } from '@sheetxl/utils-react';
10
+ import { ICellLayout } from '@sheetxl/utils-react';
11
11
  import { ICommands } from '@sheetxl/utils-react';
12
12
  import { IScrollPaneElement } from '@sheetxl/utils-react';
13
13
  import { ItemSizer } from '@sheetxl/utils-react';
@@ -37,7 +37,7 @@ export declare interface AnimatedStrokeProps {
37
37
 
38
38
  /**
39
39
  * Data grid component for rendering cells onto a virtual panel.
40
- * This component coordinates between CellLayout and CellRenderer.
40
+ * This component coordinates between ICellLayout and CellRenderer.
41
41
  * This component expects a width and height to be passed to it.
42
42
  *
43
43
  * * To support dynamic width/height based on div sizing wrap this is @see <Grid>
@@ -45,26 +45,7 @@ export declare interface AnimatedStrokeProps {
45
45
  *
46
46
  * @see GridProps
47
47
  */
48
- export declare const BaseGrid: default_2.FC<GridProps & GridRefAttribute>;
49
-
50
- export declare type CellEditorAttributes = {
51
- /**
52
- * When editor is loaded, this will be called. Note this should not use the autoFocus property. here
53
- * If this is set the editor focus will be called as appropriate.
54
- */
55
- startEdit?(event: StartEditEvent): void;
56
- submitEdit(): boolean;
57
- cancelEdit(): void;
58
- /**
59
- * Called if the StartEditEvent event has autoFocus set.
60
- * @param selector A selector string (or empty means 'default' focus)
61
- */
62
- autoFocus(selector?: string): void;
63
- /**
64
- * Returns the default line height.
65
- */
66
- getLineHeight: () => number;
67
- };
48
+ export declare const BaseGrid: default_2.NamedExoticComponent<GridProps & default_2.RefAttributes<IGridElement>>;
68
49
 
69
50
  export declare interface CellEditorProps<CT, DT> extends default_2.HTMLAttributes<HTMLElement>, default_2.Attributes {
70
51
  /**
@@ -111,11 +92,11 @@ export declare interface CellEditorProps<CT, DT> extends default_2.HTMLAttribute
111
92
  */
112
93
  onNavigate?(direction: Direction): void;
113
94
  zoom?: number;
114
- }
115
-
116
- export declare type CellEditorRefAttribute = {
95
+ /**
96
+ * Reference to the underlying element
97
+ */
117
98
  ref?: default_2.Ref<ICellEditorElement>;
118
- };
99
+ }
119
100
 
120
101
  export declare interface CellRendererProps<T = any> extends React.HTMLAttributes<HTMLElement>, React.Attributes {
121
102
  /**
@@ -133,7 +114,7 @@ export declare interface CellRendererProps<T = any> extends React.HTMLAttributes
133
114
  /**
134
115
  * The view that is rendering a collection of cells
135
116
  */
136
- view: GridView;
117
+ view: IGridView;
137
118
  /**
138
119
  * The RangeCoords that is being rendering.
139
120
  * @remarks
@@ -155,19 +136,18 @@ export declare interface CoordOffset {
155
136
 
156
137
  /**
157
138
  * Default cell editor
139
+ *
158
140
  * @param props
159
141
  */
160
- export declare const DefaultCellEditor: default_2.FC<StringCellEditorProps & CellEditorRefAttribute>;
142
+ export declare const DefaultCellEditor: default_2.NamedExoticComponent<Omit<StringCellEditorProps, "ref"> & default_2.RefAttributes<ICellEditorElement>>;
161
143
 
162
144
  /**
163
145
  * Default cell component capable of rendering a value
164
146
  * @param props
165
147
  */
166
- export declare const DefaultCellRenderer: default_2.FC<CellRendererProps>;
148
+ export declare const DefaultCellRenderer: default_2.MemoExoticComponent<(props: CellRendererProps) => JSX.Element>;
167
149
 
168
- export declare const DefaultHeaderDivider: default_2.FC<HeaderDividerRendererProps & {
169
- ref?: default_2.Ref<IHeaderDividerElement>;
170
- }>;
150
+ export declare const DefaultHeaderDivider: default_2.NamedExoticComponent<Omit<HeaderDividerRendererProps, "ref"> & default_2.RefAttributes<IHeaderDividerElement>>;
171
151
 
172
152
  export declare const defaultSelectionRenderer: (props: SelectionProps) => JSX.Element;
173
153
 
@@ -175,7 +155,7 @@ export declare interface EditorOverlayResults {
175
155
  /**
176
156
  * Editor component to be injected.
177
157
  */
178
- overlay: <T>(view: GridView, ref: default_2.Ref<T>) => default_2.ReactNode;
158
+ renderOverlay: <T>(view: IGridView, ref?: default_2.Ref<T>) => default_2.ReactNode;
179
159
  /**
180
160
  * Bind to keyboard event
181
161
  */
@@ -219,11 +199,14 @@ export declare interface EditState<CT, DT> {
219
199
  /**
220
200
  * Fill handle component
221
201
  */
222
- export declare const FillHandle: default_2.FC<FillHandleProps & FillHandleRefAttribute>;
202
+ export declare const FillHandle: default_2.NamedExoticComponent<Omit<FillHandleProps, "ref"> & default_2.RefAttributes<FillHandleElement>>;
223
203
 
224
204
  export declare interface FillHandleAttributes {
225
205
  }
226
206
 
207
+ export declare interface FillHandleElement extends HTMLDivElement, FillHandleAttributes {
208
+ }
209
+
227
210
  export declare interface FillHandleProps extends default_2.HTMLAttributes<HTMLDivElement> {
228
211
  corner?: string;
229
212
  x?: number;
@@ -232,11 +215,11 @@ export declare interface FillHandleProps extends default_2.HTMLAttributes<HTMLDi
232
215
  borderWidth?: number;
233
216
  borderStroke?: string;
234
217
  background?: string;
235
- }
236
-
237
- export declare type FillHandleRefAttribute = {
218
+ /**
219
+ * Underlying element reference
220
+ */
238
221
  ref?: default_2.Ref<FillHandleAttributes>;
239
- };
222
+ }
240
223
 
241
224
  export declare interface FrozenEdge {
242
225
  /**
@@ -251,66 +234,7 @@ export declare interface FrozenEdge {
251
234
 
252
235
  export declare const getDefaultStringEditState: (clean?: string) => EditState<string, string> | undefined;
253
236
 
254
- export declare const Grid: default_2.FC<GridProps & GridRefAttribute>;
255
-
256
- export declare interface GridAttributes {
257
- /**
258
- * The stage element for the cells
259
- */
260
- readonly stage: HTMLDivElement | null;
261
- /**
262
- * The rowCount provided by the properties
263
- */
264
- readonly rowCount: number;
265
- /**
266
- * The columnCount provided by the properties
267
- */
268
- readonly columnCount: number;
269
- /**
270
- * Invalidate either a cell or a range of cells. If no arguments are provided then the entire grid is invalidated.
271
- * @param coords
272
- */
273
- invalidate: (coords?: CellCoords | RangeCoords) => void;
274
- handleWheel: (event: globalThis.WheelEvent) => void;
275
- getScrollPosition: () => TopLeft;
276
- getViewport: () => RangeCoords;
277
- getDimensions: () => {
278
- containerWidth: number;
279
- containerHeight: number;
280
- totalWidth: number;
281
- totalHeight: number;
282
- };
283
- /**
284
- * Scroll the cell into view. If the coord does not have an index it will only scroll in a single direction.
285
- */
286
- scrollCellCoordsIntoView: (coords: Partial<CellCoords>, options?: globalThis.ScrollIntoViewOptions | boolean) => Promise<Partial<TopLeft>>;
287
- /**
288
- * The grid coordinates relative to the containing div (includes any padding, margins)
289
- */
290
- getRelativePointFromClient: (x: number, y: number) => Point | null;
291
- /**
292
- * Returns the view for the given point. If point is
293
- * over a frozen pane it will return the frozen pane otherwise
294
- * it will return the center view.
295
- */
296
- getViewFromClient: (x: number, y: number) => GridView;
297
- /**
298
- * Returns the view for the given coords. If coord is
299
- * over a frozen pane it will return the frozen pane otherwise
300
- * it will return the center view.
301
- */
302
- getViewFromCellCoords: (coords: CellCoords) => GridView;
303
- /**
304
- * Returns null if the view does not exist.
305
- */
306
- getViewFromLocation: (anchor: AnchorLocation) => GridView | null;
307
- /**
308
- * Called when the view has been changed.
309
- * @remarks
310
- * This is only called once.
311
- */
312
- onViewChangeOnce: (callback: () => void) => void;
313
- }
237
+ export declare const Grid: default_2.NamedExoticComponent<GridProps & default_2.RefAttributes<IGridElement>>;
314
238
 
315
239
  export declare interface GridHeaderStyle extends GridSurfaceStyle {
316
240
  strokeFillShadow?: string;
@@ -355,7 +279,7 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
355
279
  /**
356
280
  * The layout for the cells
357
281
  */
358
- layout?: CellLayout;
282
+ layout?: ICellLayout;
359
283
  /**
360
284
  * Called on scroll, subject to debouncing. Used for programmatic changes. Called even on load
361
285
  */
@@ -392,11 +316,11 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
392
316
  /**
393
317
  * Allow for customization of freezeTopDivider
394
318
  */
395
- freezeLeftProps?: Partial<LineProps>;
319
+ propsFreezeLeft?: Partial<LineProps>;
396
320
  /**
397
321
  * Allow for customization of freezeTopDivider
398
322
  */
399
- freezeTopProps?: Partial<LineProps>;
323
+ propsFreezeTop?: Partial<LineProps>;
400
324
  /**
401
325
  * Called right before a row is being rendered.
402
326
  * Will be called for frozen cells and merged cells
@@ -415,7 +339,7 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
415
339
  * the pointerEvents are set to none. To enable interaction this should be
416
340
  * overwritten.
417
341
  */
418
- cellRenderer?: (props: CellRendererProps) => default_2.ReactNode;
342
+ renderCell?: (props: CellRendererProps) => default_2.ReactNode;
419
343
  /**
420
344
  * Allow for cells to be inset. This is a way to account for borders. By default this is 1, 1, 1,x.
421
345
  */
@@ -423,18 +347,18 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
423
347
  /**
424
348
  * Render elements for the view. This will be called whenever the viewport changes.
425
349
  */
426
- overlays?: ((view: GridView) => default_2.ReactNode)[];
350
+ renderOverlays?: ((view: IGridView) => default_2.ReactNode)[];
427
351
  /**
428
352
  * Props passed to all overlayRenderers
429
353
  */
430
- overlaysProps?: default_2.HTMLAttributes<HTMLDivElement>;
354
+ propsOverlays?: default_2.HTMLAttributes<HTMLDivElement>;
431
355
  /**
432
356
  * Used for rendering overlays. Similar to cell render but covers the entire area.
357
+ *
433
358
  * @param props
434
- * @returns
435
359
  */
436
- overlayRenderer?: <T = any>(props: OverlayRendererProps, ref: default_2.Ref<T>) => default_2.ReactNode;
437
- overlayProps?: default_2.HTMLAttributes<HTMLDivElement>;
360
+ renderOverlay?: <T extends HTMLDivElement = HTMLDivElement>(props: OverlayRendererProps<T>) => default_2.ReactNode;
361
+ propsOverlay?: default_2.HTMLAttributes<HTMLDivElement>;
438
362
  /**
439
363
  * Overlays are generally clipped to fit in the viewport but
440
364
  * this allows for the properties to be overridden.
@@ -443,11 +367,11 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
443
367
  /**
444
368
  * Allows users to Wrap stage children in Top level Context
445
369
  */
446
- stageWrapper?: (children: default_2.ReactNode) => default_2.ReactNode;
370
+ wrapperStage?: (children: default_2.ReactNode) => default_2.ReactNode;
447
371
  /**
448
372
  * Props that can be injected to stage
449
373
  */
450
- stageProps?: default_2.HTMLAttributes<HTMLDivElement>;
374
+ propsStage?: default_2.HTMLAttributes<HTMLDivElement>;
451
375
  /**
452
376
  * Show grid lines.
453
377
  * Useful for spreadsheets
@@ -463,11 +387,11 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
463
387
  /**
464
388
  * Gridline props for rows.
465
389
  */
466
- gridLineRowsProps?: default_2.SVGProps<SVGPathElement>;
390
+ propsGridLineRows?: default_2.SVGProps<SVGPathElement>;
467
391
  /**
468
392
  * Gridline props for columns.
469
393
  */
470
- gridLineColumnsProps?: default_2.SVGProps<SVGPathElement>;
394
+ propsGridLineColumns?: default_2.SVGProps<SVGPathElement>;
471
395
  /**
472
396
  * Will skip rendering for this row and the adjacent rows in the given direction.
473
397
  */
@@ -497,7 +421,7 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
497
421
  * iterated and if hiddenCellAt does not return false then cellRender will be
498
422
  * called.
499
423
  */
500
- getVisibleCells?: (view: GridView) => ({
424
+ getVisibleCells?: (view: IGridView) => ({
501
425
  coords: CellCoords;
502
426
  value?: any;
503
427
  range?: RangeCoords;
@@ -525,14 +449,6 @@ export declare interface GridProps extends default_2.HTMLAttributes<HTMLDivEleme
525
449
  clipCells?: boolean;
526
450
  }
527
451
 
528
- export declare type GridRefAttribute = {
529
- ref?: default_2.Ref<IGridElement>;
530
- };
531
-
532
- export declare interface GridRefProps extends GridProps {
533
- ref?: default_2.Ref<HTMLDivElement>;
534
- }
535
-
536
452
  export declare interface GridStyle extends GridSurfaceStyle {
537
453
  body?: GridSurfaceStyle;
538
454
  selection?: SelectionStyle;
@@ -560,151 +476,14 @@ export declare interface GridSurfaceStyle extends PaintStyle {
560
476
  darkMode?: boolean;
561
477
  }
562
478
 
563
- /**
564
- * Describes the view of a grid.
565
- *
566
- * @remarks
567
- * Useful for overlay rendering.
568
- */
569
- export declare interface GridView {
570
- /**
571
- * Returns the underlying stage element for the view.
572
- *
573
- * @remarks
574
- * Useful for capturing stage events.
575
- */
576
- getStage(): HTMLDivElement | null;
577
- /**
578
- * The anchor for the view.
579
- */
580
- getAnchor(): AnchorLocation;
581
- /**
582
- * Allow for dimensions to be determined for various cells.
583
- * The cellLayout is inclusive of the zoom
584
- */
585
- getLayout(): CellLayout;
586
- /**
587
- * Useful for internal rendering.
588
- *
589
- * @remarks
590
- * The cell layout will account for zoom factors already.
591
- */
592
- getZoom(): number;
593
- /**
594
- * This captures the total viewable range.
595
- *
596
- * @remarks
597
- * Will have the sames values as {@link getVisibleRows} and {@link getVisibleColumns}.
598
- */
599
- getVisibleRangeCoords(): RangeCoords;
600
- /**
601
- * Useful for scanning. Contains a list of row offsets that are visible.
602
- * Guaranteed to be non-null but may be zero length if no rows are visible.
603
- */
604
- getVisibleRows(): readonly number[];
605
- /**
606
- * Useful for scanning. Contains a list of column offsets that are visible.
607
- * Guaranteed to be non-null but may be zero length if no column are visible.
608
- */
609
- getVisibleColumns(): readonly number[];
610
- /**
611
- * Returns the SizedOffsets for columns.
612
- */
613
- getVisibleColumnOffsets(): SizedOffset;
614
- /**
615
- * Returns the SizedOffsets for rows.
616
- */
617
- getVisibleRowOffsets(): SizedOffset;
618
- /**
619
- * Returns the range coords that captures the entire view.
620
- */
621
- getTotalRangeCoords(): RangeCoords;
622
- /**
623
- * Clip a rectangle against the viewport.
624
- *
625
- * @remarks
626
- * * A negative inset will extend outside of the viewport;
627
- * * Useful when elements should visually 'flow' off of the viewport. (i.e. selection with borders)
628
- */
629
- toClipBounds(bounds?: Bounds, insets?: number | Bounds): Bounds;
630
- /**
631
- * Returns the viewport bounds for an absolute bounds.
632
- */
633
- toViewBounds(bounds: Bounds): Bounds;
634
- /**
635
- * Returns the absolute bounds for a viewport bounds.
636
- */
637
- toAbsoluteBounds(bounds: Bounds): Bounds;
638
- /**
639
- * The bounds of the the overlay relative to the total view.
640
- */
641
- getBounds(): Bounds;
642
- /**
643
- * Additional inside padding.
644
- */
645
- getInsets(): Rectangle;
646
- /**
647
- * Returns the cell as a range. If this cell is merged this will be reflected.
648
- * Note - This is slightly more sophisticated than rowSpan and colSpan
649
- * because it allows for queries that are not on the top/left.
650
- */
651
- getCellCoordsAsRangeCoords(coords: CellCoords): RangeCoords;
652
- /**
653
- * Returns a bounds for a given range.
654
- * If not specified then will return for the cellRange.
655
- *
656
- * @param adjustment This allows you to adjust the rect. Note - This is not like insets
657
- *
658
- * @remarks
659
- * The bounds are relative to the view.
660
- */
661
- getRangeCoordsBounds(range?: RangeCoords, adjustment?: Partial<Rectangle>): Bounds;
662
- /**
663
- * Scroll the cell coords into view.
664
- * If the coord does not have an index it will only scroll in a single direction.
665
- */
666
- scrollCellCoordsIntoView(coords: Partial<CellCoords>, options?: globalThis.ScrollIntoViewOptions | boolean): Promise<Partial<TopLeft>>;
667
- /**
668
- * Returns the coords at the offset.
669
- * @param x - The x offset relative to the view
670
- * @param y - The y offset relative to the view
671
- * @param actualCell - Don't return the topLeft of a merge. Default value `false`.
672
- */
673
- getCellCoordsFromClient(x: number, y: number, actualCell?: boolean): CellCoords | null;
674
- /**
675
- * Indicate the allowable scroll directions.
676
- */
677
- getScrollOrientation(): AxisOrientationFlags;
678
- getScrollTopLeft(): TopLeft;
679
- getFreezeTopLeft(): TopLeft;
680
- /**
681
- * Returns the total size of all rendered values in pixels.
682
- */
683
- getTotalSize(): Size;
684
- /**
685
- * This is the size for all views (but not including the headers)
686
- */
687
- getViewportSize(): Size;
688
- /**
689
- * Allows for access to all current views.
690
- */
691
- allViews(): Partial<Record<AnchorLocation, GridView>>;
692
- /**
693
- * Returns a point relative to the view.
694
- */
695
- getRelativePointFromClient(x: number, y: number): Point | null;
696
- }
697
-
698
479
  /**
699
480
  * A divider placed between headers to provider a visual cue for various actions.
700
481
  * Resize, hide/unhide, etc.
701
482
  */
702
- export declare const HeaderDivider: default_2.FC<HeaderDividerAnchorProps & {
703
- ref?: default_2.Ref<IHeaderDividerElement>;
704
- }>;
483
+ export declare const HeaderDivider: default_2.NamedExoticComponent<Omit<HeaderDividerAnchorProps, "ref"> & default_2.RefAttributes<IHeaderDividerElement>>;
705
484
 
706
485
  export declare interface HeaderDividerAnchorProps extends HeaderDividerProps {
707
- dividerRenderer?: (props: HeaderDividerRendererProps, refForward?: default_2.Ref<IHeaderDividerElement>) => default_2.ReactNode;
486
+ renderDivider?: (props: HeaderDividerRendererProps) => default_2.ReactNode;
708
487
  /**
709
488
  * The number of pixels to mouse before resizing starts.
710
489
  * If this number is less than 1 then it will be 1.
@@ -752,16 +531,13 @@ export declare interface HeaderDividerAnchorProps extends HeaderDividerProps {
752
531
  onDividerAutoFit?: (index: number) => void;
753
532
  }
754
533
 
755
- export declare interface HeaderDividerAttributes {
756
- }
757
-
758
534
  /**
759
535
  * HeaderDividers follow the header
760
536
  * // TODO - allow negative resizing (before the current) (easy to do I think)
761
537
  */
762
538
  export declare interface HeaderDividerProps extends default_2.HTMLAttributes<HTMLDivElement> {
763
539
  orientation: RangeOrientation;
764
- view: GridView;
540
+ view: IGridView;
765
541
  index: number;
766
542
  /**
767
543
  * This should disable interaction. This should also
@@ -800,6 +576,10 @@ export declare interface HeaderDividerProps extends default_2.HTMLAttributes<HTM
800
576
  headerStyleSelect: GridHeaderStyle;
801
577
  headerStyleSelectAll: GridHeaderStyle;
802
578
  headerStyleHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle);
579
+ /**
580
+ * The reference to the element.
581
+ */
582
+ ref?: default_2.Ref<IHeaderDividerElement>;
803
583
  }
804
584
 
805
585
  export declare interface HeaderDividerRendererProps extends HeaderDividerProps {
@@ -811,7 +591,7 @@ export declare interface HeaderDividerRendererProps extends HeaderDividerProps {
811
591
  onAutoFit: () => void;
812
592
  }
813
593
 
814
- export declare const HeaderRenderer: default_2.FC<HeaderRendererCellProps>;
594
+ export declare const HeaderRenderer: default_2.MemoExoticComponent<(props: HeaderRendererCellProps) => JSX.Element>;
815
595
 
816
596
  export declare interface HeaderRendererCellProps extends CellRendererProps {
817
597
  orientation: RangeOrientation;
@@ -840,36 +620,257 @@ export declare interface HeaderSelectionResults {
840
620
  getCellCoordsFromClient: (x: number, y: number) => CellCoords;
841
621
  }
842
622
 
843
- export declare interface ICellEditorElement extends HTMLDivElement, CellEditorAttributes {
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>;
844
706
  }
845
707
 
846
708
  /**
847
709
  * Type returned via ref property
848
710
  */
849
- export declare interface IGridElement extends HTMLDivElement, GridAttributes {
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;
850
847
  }
851
848
 
852
- export declare interface IHeaderDividerElement extends HTMLDivElement, HeaderDividerAttributes {
849
+ export declare interface IHeaderDividerAttributes {
850
+ }
851
+
852
+ export declare interface IHeaderDividerElement extends HTMLDivElement, IHeaderDividerAttributes {
853
853
  }
854
854
 
855
855
  export declare interface LineProps extends default_2.SVGProps<SVGSVGElement> {
856
856
  linePoints: number[];
857
857
  bounds: Bounds;
858
- pathProps?: default_2.SVGProps<SVGPathElement>;
858
+ propsPath?: default_2.SVGProps<SVGPathElement>;
859
859
  }
860
860
 
861
861
  export declare type NewHeaderSelectionMode = "clear" | "modify" | "append";
862
862
 
863
863
  export declare type NewSelectionMode = "clear" | "modify" | "append";
864
864
 
865
- export declare interface OverlayRendererProps extends React.HTMLAttributes<HTMLElement>, React.Attributes {
865
+ export declare interface OverlayRendererProps<T extends HTMLDivElement = any> extends React.HTMLAttributes<HTMLDivElement>, React.Attributes {
866
866
  /**
867
867
  * The view that is rendering a collection of cells
868
868
  */
869
- view: GridView;
869
+ view: IGridView;
870
870
  onStageKeyDown?: (e: React.KeyboardEvent<Element>) => void;
871
871
  onStagePointerDown?: (e: React.PointerEvent<Element>) => void;
872
872
  onStageDoubleClick?: (e: React.PointerEvent<Element>) => void;
873
+ ref?: React.Ref<T>;
873
874
  }
874
875
 
875
876
  export declare interface PaintStyle {
@@ -885,7 +886,7 @@ export declare const safeSelectionCoords: (prev?: SelectionCoords) => SelectionC
885
886
  /**
886
887
  * ScrollableGrid. This wraps BaseGrid and manages bounds to create consistent css behavior for consumers
887
888
  */
888
- export declare const ScrollableGrid: default_2.FC<ScrollableGridProps & ScrollableRefAttribute>;
889
+ export declare const ScrollableGrid: default_2.NamedExoticComponent<Omit<ScrollableGridProps, "ref"> & default_2.RefAttributes<IGridElement & IScrollPaneElement>>;
889
890
 
890
891
  export declare interface ScrollableGridProps extends GridProps, ScrollPaneProps {
891
892
  /**
@@ -893,20 +894,20 @@ export declare interface ScrollableGridProps extends GridProps, ScrollPaneProps
893
894
  * @param scrollPoint
894
895
  */
895
896
  onScrollViewport?: (scrollPoint: Partial<TopLeft>) => void;
897
+ /**
898
+ * Ref for the HTMLDivElement
899
+ */
900
+ ref?: default_2.Ref<IGridElement | IScrollPaneElement | any>;
896
901
  }
897
902
 
898
- export declare type ScrollableRefAttribute = {
899
- ref?: default_2.Ref<IGridElement | IScrollPaneElement>;
900
- };
901
-
902
903
  declare const Selection_2: default_2.FC<SelectionProps>;
903
904
  export { Selection_2 as Selection }
904
905
 
905
906
  export declare const SELECTION_CLIP_INSETS = -10;
906
907
 
907
908
  export declare interface SelectionPointerHandlerOptions extends Omit<PointerHandlerOptions, "onPointerDown" | "onPointerMoveOrWait"> {
908
- onSelectionPointerDown: (event: default_2.PointerEvent<Element>, modifiers: PointerModifiers, view?: GridView, coords?: CellCoords, pivotCoords?: CellCoords, extendSelection?: boolean, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => boolean | void;
909
- onSelectionPointerMoveOrWait?: (event: default_2.PointerEvent<Element>, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent<Element>, view?: GridView, coords?: CellCoords, pivotCoords?: CellCoords, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => void;
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;
910
911
  }
911
912
 
912
913
  export declare type SelectionPolicy = "single" | "range" | "multiple";
@@ -916,7 +917,13 @@ export declare interface SelectionProps extends SVGRectProps {
916
917
  * @defaultValue false unless props are set
917
918
  */
918
919
  isAnimatedStroke?: boolean;
919
- animatedStrokeProps?: AnimatedStrokeProps;
920
+ /**
921
+ * Customize props for Animated Stroke
922
+ */
923
+ propsAnimatedStroke?: AnimatedStrokeProps;
924
+ /**
925
+ * The range that this selection represents.
926
+ */
920
927
  range: RangeCoords;
921
928
  /**
922
929
  * An area may or may not contain an anchor cell.
@@ -954,7 +961,7 @@ export declare interface SelectionResults {
954
961
  * // TODO - make this a function that takes props and received onMouse, onKeyboard
955
962
  * (we can then make selection overlays a function that doesn't rerender the table (or sheet on move))
956
963
  */
957
- overlay: (view: GridView) => default_2.ReactNode;
964
+ renderOverlay: (view: IGridView) => default_2.ReactNode;
958
965
  /**
959
966
  * Navigate left/right/up/down
960
967
  * @param direction The direction to navigate.
@@ -1049,8 +1056,8 @@ declare const SVGRect_2: (props: SVGRectProps) => JSX.Element;
1049
1056
  export { SVGRect_2 as SVGRect }
1050
1057
 
1051
1058
  export declare interface SVGRectProps extends default_2.SVGProps<SVGSVGElement> {
1052
- pathBounds?: Bounds;
1053
- pathProps?: default_2.SVGProps<SVGPathElement>;
1059
+ boundsPath?: Bounds;
1060
+ propsPath?: default_2.SVGProps<SVGPathElement>;
1054
1061
  }
1055
1062
 
1056
1063
  export declare interface TextStyle extends PaintStyle {
@@ -1063,7 +1070,7 @@ export declare interface TextStyle extends PaintStyle {
1063
1070
  /**
1064
1071
  * TouchSelectHandle component
1065
1072
  */
1066
- export declare const TouchSelectHandle: default_2.NamedExoticComponent<TouchSelectHandleProps & default_2.RefAttributes<TouchSelectHandleElement>>;
1073
+ export declare const TouchSelectHandle: default_2.NamedExoticComponent<Omit<TouchSelectHandleProps, "ref"> & default_2.RefAttributes<TouchSelectHandleElement>>;
1067
1074
 
1068
1075
  export declare interface TouchSelectHandleAttributes {
1069
1076
  }
@@ -1080,7 +1087,7 @@ export declare interface TouchSelectHandleProps extends default_2.HTMLAttributes
1080
1087
  */
1081
1088
  anchor: 'tl' | 'br' | 'l' | 't' | 'r' | 'b';
1082
1089
  range: RangeCoords;
1083
- view: GridView;
1090
+ view: IGridView;
1084
1091
  size?: number;
1085
1092
  borderWidth?: number;
1086
1093
  borderStroke?: string;
@@ -1102,16 +1109,16 @@ export declare interface TouchSelectHandleProps extends default_2.HTMLAttributes
1102
1109
  * @defaultValue document.body
1103
1110
  */
1104
1111
  scrollableRoot?: HTMLElement;
1105
- }
1106
-
1107
- export declare type TouchSelectHandleRefAttribute = {
1112
+ /**
1113
+ * Reference to the underling element
1114
+ */
1108
1115
  ref?: default_2.Ref<TouchSelectHandleElement>;
1109
- };
1110
-
1111
- export declare interface TouchSelectHandleRefProps extends TouchSelectHandleProps, TouchSelectHandleRefAttribute {
1112
1116
  }
1113
1117
 
1114
- export declare const useCellLayout: (props: UseCellLayoutProps | null) => CellLayout;
1118
+ /**
1119
+ * Hook to manage cell layout
1120
+ */
1121
+ export declare const useCellLayout: (props: UseCellLayoutProps | null) => ICellLayout;
1115
1122
 
1116
1123
  export declare interface UseCellLayoutProps {
1117
1124
  /**
@@ -1249,7 +1256,7 @@ export declare interface useKeyboardEditorOverlayOptions {
1249
1256
  /**
1250
1257
  * The view that is being used for rendering
1251
1258
  */
1252
- view: GridView;
1259
+ view: IGridView;
1253
1260
  /**
1254
1261
  * Active selected cell. This is required to enable
1255
1262
  * the editor to activate when a key is pressed
@@ -1260,7 +1267,7 @@ export declare interface useKeyboardEditorOverlayOptions {
1260
1267
  * This should not return null but rather can canEdit.
1261
1268
  * This is called during placement after scrolling and other bookkeeping has occurred
1262
1269
  */
1263
- getCellEditor: (props: CellEditorProps<any, any> & CellEditorRefAttribute, coords: CellCoords) => default_2.ReactElement<CellEditorProps<any, any> & CellEditorRefAttribute>;
1270
+ getCellEditor: (props: CellEditorProps<any, any>, coords: CellCoords) => default_2.ReactElement<CellEditorProps<any, any>>;
1264
1271
  /**
1265
1272
  * Callback fired before editing. Can be used to prevent editing.
1266
1273
  */
@@ -1298,7 +1305,7 @@ export declare interface useKeyboardEditorOverlayOptions {
1298
1305
  * @returns Either `true` or an `StartEditEvent`
1299
1306
  */
1300
1307
  isEditorStartPointerEvent?: (e: PointerEvent, coords: CellCoords) => boolean | StartEditEvent;
1301
- containerProps?: default_2.HTMLAttributes<HTMLDivElement>;
1308
+ propsContainer?: default_2.HTMLAttributes<HTMLDivElement>;
1302
1309
  borderStrokeFill?: string;
1303
1310
  borderStrokeWidth?: number;
1304
1311
  /**
@@ -1307,7 +1314,10 @@ export declare interface useKeyboardEditorOverlayOptions {
1307
1314
  alignment?: HorizontalAlignment;
1308
1315
  }
1309
1316
 
1310
- 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, selectionRenderer: propSelectionRenderer, disableMoveDrag, getCellCoordsAsRangeCoords, moveDragHitSize, moveDragOutlineSize, selectionBackgroundColor, selectionBorderColor, selectionRemoveBorderColor, selectionRemoveBackgroundColor, disableTouchSelection, touchSelectHandleProps, }: UseSelectionOptions) => SelectionResults;
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;
1311
1321
 
1312
1322
  export declare interface UseSelectionOptions {
1313
1323
  /**
@@ -1318,7 +1328,7 @@ export declare interface UseSelectionOptions {
1318
1328
  /**
1319
1329
  * This is used for pageUp/pageDown and getHiddenAuto.
1320
1330
  */
1321
- layout?: CellLayout;
1331
+ layout?: ICellLayout;
1322
1332
  /**
1323
1333
  * selections
1324
1334
  */
@@ -1453,11 +1463,11 @@ export declare interface UseSelectionOptions {
1453
1463
  /**
1454
1464
  * If touch is enabled.
1455
1465
  */
1456
- touchSelectHandleProps?: TouchSelectHandleProps;
1466
+ propsTouchSelectHandle?: TouchSelectHandleProps;
1457
1467
  /**
1458
1468
  * Allow users to customize selected cells design
1459
1469
  */
1460
- selectionRenderer?: (props: SelectionProps) => default_2.ReactNode;
1470
+ renderSelection?: (props: SelectionProps) => default_2.ReactNode;
1461
1471
  /**
1462
1472
  * Border color of selected area
1463
1473
  */