beautiful-grid 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beautiful-grid",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A beautiful, powerful, open-source React Data Grid.",
5
5
  "homepage": "https://bgrid.axisj.com",
6
6
  "bugs": {
package/types/BGrid.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { BGridProps } from './types';
3
- export declare function BGrid<T = Record<string, any>>({ width, height, headerHeight, footerHeight, summaryHeight, itemHeight, itemPadding, columns, columnsGroup, columnGroups, onChangeColumns, frozenColumnIndex, frozenRowCount, data, page, scrollbar, status, pagination, bottomBarHeight, scrollTop, scrollLeft, className, style, rowChecked, sort, onClick, loading, spinning, rowKey, selectedRowKey, editable, onChangeData, showLineNumber, msg, getRowClassName, editTrigger, cellMergeOptions, cellSelectionOptions, cellNavigationOptions, variant, summary, columnSortable, reorder, pivot, dataControl, icons, searchOptions, contextMenuOptions, }: BGridProps<T>): React.JSX.Element;
3
+ export declare function BGrid<T = Record<string, any>>({ ref, width, height, headerHeight, footerHeight, summaryHeight, itemHeight, itemPadding, columns, columnsGroup, columnGroups, onChangeColumns, frozenColumnIndex, frozenRowCount, data, page, scrollbar, status, pagination, bottomBarHeight, scrollTop, scrollLeft, className, style, rowChecked, sort, onClick, loading, spinning, rowKey, selectedRowKey, editable, onChangeData, showLineNumber, msg, getRowClassName, editTrigger, cellMergeOptions, cellSelectionOptions, cellNavigationOptions, variant, summary, columnSortable, reorder, pivot, dataControl, icons, searchOptions, contextMenuOptions, }: BGridProps<T>): React.JSX.Element;
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { Key } from 'react';
3
3
  import { BGridCellNavigationOptions, AppModelColumn, BGridColumnGroup, BGridColumnGroupNode, BGridDataControl, BGridDataItem, BGridDataQuery, BGridPage, BGridProps, BGridRowChecked, BGridSortInfo, BGridSortParam, BGridResolvedScrollbarOptions, BGridResolvedStatusOptions, BGridResolvedPaginationViewOptions } from '../types';
4
4
  interface Props<T> {
5
+ ref?: BGridProps<T>['ref'];
5
6
  width?: number;
6
7
  height?: number;
7
8
  headerHeight?: number;
@@ -12,6 +12,7 @@ interface Props {
12
12
  width: number;
13
13
  height: number;
14
14
  };
15
+ offsetTop?: number;
15
16
  }
16
17
  export declare function CellSelectionOverlay(props: Props): React.JSX.Element;
17
18
  export {};
@@ -13,6 +13,7 @@ interface Props {
13
13
  activeFill: boolean;
14
14
  activeRing: boolean;
15
15
  viewport: SelectionViewport;
16
+ offsetTop?: number;
16
17
  }
17
- export declare function CellSelectionOverlayLayer({ quadrant, selectionFragments, activeFragments, activeFill, activeRing, viewport, }: Props): React.JSX.Element | null;
18
+ export declare function CellSelectionOverlayLayer({ quadrant, selectionFragments, activeFragments, activeFill, activeRing, viewport, offsetTop, }: Props): React.JSX.Element | null;
18
19
  export {};
package/types/types.d.ts CHANGED
@@ -619,7 +619,20 @@ export interface BGridResolvedStatusOptions extends BGridStatusOptions {
619
619
  configured: boolean;
620
620
  }
621
621
  export type BGridResolvedPaginationViewOptions = Required<Pick<BGridPaginationViewOptions, 'visible'>> & Omit<BGridPaginationViewOptions, 'visible'>;
622
+ export interface BGridScrollToRowOptions {
623
+ /** Defaults to nearest: scroll only as far as needed to reveal the row. */
624
+ align?: 'start' | 'center' | 'end' | 'nearest';
625
+ }
626
+ export interface BGridRef {
627
+ /**
628
+ * Reveal a zero-based row in the displayed (sorted/filtered) data on the current page.
629
+ * Runs after pending data updates. Invalid indexes and frozen rows are ignored.
630
+ * Preserves horizontal scroll, cell focus and selection; does not load other pages.
631
+ */
632
+ scrollToRow: (rowIndex: number, options?: BGridScrollToRowOptions) => void;
633
+ }
622
634
  export interface BGridProps<T> {
635
+ ref?: React.Ref<BGridRef>;
623
636
  width: number;
624
637
  height: number;
625
638
  headerHeight?: number;
@@ -12,6 +12,10 @@ export interface EnsureCellVisibleParams {
12
12
  frozenRowCount?: number;
13
13
  columns: AppModelColumn<any>[];
14
14
  rowHeight: number;
15
+ verticalScrollState?: {
16
+ scrollTop: number;
17
+ scrollHeight: number;
18
+ };
15
19
  viewportInsets?: {
16
20
  top?: number;
17
21
  right?: number;
@@ -26,4 +30,4 @@ export interface EnsureCellVisibleResult {
26
30
  didScrollTop: boolean;
27
31
  didScrollLeft: boolean;
28
32
  }
29
- export declare function ensureCellVisible({ cell, scrollContainer, frozenColumnCount, frozenRowCount, columns, rowHeight, viewportInsets, }: EnsureCellVisibleParams): EnsureCellVisibleResult;
33
+ export declare function ensureCellVisible({ cell, scrollContainer, frozenColumnCount, frozenRowCount, columns, rowHeight, verticalScrollState, viewportInsets, }: EnsureCellVisibleParams): EnsureCellVisibleResult;
@@ -15,6 +15,7 @@ export * from './scrollbar';
15
15
  export * from './number';
16
16
  export * from './buildHeaderMatrix';
17
17
  export * from './getVisibleScrollableRowRange';
18
+ export * from './virtualScrollWindow';
18
19
  export * from './cellEditState';
19
20
  export * from './getCellSelectionAxisState';
20
21
  export * from './mergedCells';
@@ -0,0 +1,24 @@
1
+ export declare const BGRID_MAX_PHYSICAL_SCROLL_HEIGHT = 1000000;
2
+ export interface VirtualScrollWindowMetrics {
3
+ enabled: boolean;
4
+ logicalContentHeight: number;
5
+ physicalContentHeight: number;
6
+ logicalMaxScroll: number;
7
+ physicalMaxScroll: number;
8
+ }
9
+ interface GetVirtualScrollWindowMetricsParams {
10
+ logicalContentHeight: number;
11
+ viewportHeight: number;
12
+ enabled: boolean;
13
+ maxPhysicalHeight?: number;
14
+ }
15
+ export interface VirtualScrollWindowPosition {
16
+ base: number;
17
+ physicalScrollTop: number;
18
+ logicalScrollTop: number;
19
+ }
20
+ export declare function getVirtualScrollWindowMetrics({ logicalContentHeight, viewportHeight, enabled, maxPhysicalHeight, }: GetVirtualScrollWindowMetricsParams): VirtualScrollWindowMetrics;
21
+ export declare function getLogicalScrollTop(base: number, physicalScrollTop: number, metrics: VirtualScrollWindowMetrics): number;
22
+ export declare function getVirtualScrollWindowPosition(logicalScrollTop: number, metrics: VirtualScrollWindowMetrics): VirtualScrollWindowPosition;
23
+ export declare function rebaseVirtualScrollWindow(base: number, physicalScrollTop: number, metrics: VirtualScrollWindowMetrics): VirtualScrollWindowPosition;
24
+ export {};