@progress/kendo-vue-grid
Version:
73 lines (72 loc) • 2.88 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 { Ref } from 'vue';
import { RowHeightService } from '@progress/kendo-vue-common';
import { GroupState } from '@progress/kendo-vue-data-tools';
import { DataItemWrapper } from '../utils/main';
import { StickyGroupTable } from '../components/StickyGroupTable';
/**
* @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
* Composable 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: Ref<DataItemWrapper[]>;
stickyHeaderRef: Ref<InstanceType<typeof StickyGroupTable> | null>;
stickyFooterRef: Ref<InstanceType<typeof StickyGroupTable> | null>;
containerRef: Ref<HTMLDivElement | null>;
tableBodyRef: Ref<HTMLTableSectionElement | null>;
rowHeight?: number;
isGrouped: Ref<boolean>;
virtualSkipRef?: Ref<number>;
rowHeightServiceRef?: Ref<RowHeightService | undefined>;
}): {
stickyHeaderItems: Ref<StickyGroupItem[]>;
stickyFooterItems: Ref<StickyGroupItem[]>;
scrollToStickyGroup: (group: GroupState) => void;
update: () => void;
};