@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
72 lines (71 loc) • 2.82 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { RowHeightService } from '@progress/kendo-react-common';
import { GroupState } from '@progress/kendo-react-data-tools';
import { DataItemWrapper } from '../utils/index.js';
import * as React from 'react';
/**
* @hidden
* Represents the range of a group within the flat data array.
*/
export interface GroupRange {
headerIndex: number;
footerIndex: number | null;
firstChildIndex: number;
lastChildIndex: number;
level: number;
}
/**
* @hidden
* Builds a map of group ranges from the flat data array.
* Each group header maps to its footer and child range.
*/
export declare function buildGroupRangeMap(flatDataArray: DataItemWrapper[]): Map<number, GroupRange>;
/**
* @hidden
* Pairs a DataItemWrapper with its flat-data index.
*/
export interface StickyGroupItem {
item: DataItemWrapper;
flatIndex: number;
}
/**
* @hidden
*/
export declare function computeStickyItems(flatDataArray: DataItemWrapper[], groupRanges: Map<number, GroupRange>, firstVisibleIndex: number, lastVisibleIndex: number, rawFirstVisibleIndex?: number): StickyGroupItem[];
/**
* @hidden
* Computes which group footers should be sticky at the bottom of the viewport.
* A footer is sticky when it is scrolled below the viewport but its group's
* header (or first child) is still visible above.
*/
export declare function computeStickyFooterItems(flatDataArray: DataItemWrapper[], groupRanges: Map<number, GroupRange>, firstVisibleIndex: number, lastVisibleIndex: number): StickyGroupItem[];
/**
* @hidden
* Hook that computes which group header/footer should be sticky
* based on the scroll position and the flat data array.
* Uses refs + direct DOM manipulation to avoid render-cycle flicker.
*/
export declare function useStickyGroups(options: {
enabled: boolean;
enabledFooters?: boolean;
flatData: DataItemWrapper[];
containerRef: React.RefObject<HTMLDivElement | null>;
tableBodyRef: React.RefObject<HTMLTableSectionElement | null>;
rowHeight?: number;
isGrouped: boolean;
virtualSkipRef?: React.RefObject<number>;
rowHeightServiceRef?: React.RefObject<RowHeightService | undefined>;
}): {
stickyHeaderItems: StickyGroupItem[];
stickyHeaderRef: React.RefObject<HTMLDivElement | null>;
stickyFooterItems: StickyGroupItem[];
stickyFooterRef: React.RefObject<HTMLDivElement | null>;
scrollToStickyGroup: (group: GroupState) => void;
update: () => void;
};