@ui5/webcomponents-react
Version:
React Wrapper for UI5 Web Components and additional components
20 lines (19 loc) • 1.04 kB
TypeScript
import type { ReactTableHooks } from '../types/index.js';
/**
* UI5WCR optimized version of react-table v7's useRowSelect hook.
* Original source: https://github.com/TanStack/table/blob/v7/src/plugin-hooks/useRowSelect.js
*
* This is a fork of react-table's `useRowSelect` with performance optimizations:
* - Early exit when `selectionMode` is 'None'
* - Skips `selectedFlatRows` computation, `isAllRowsSelected` checks, and `prepareRow` overhead when selection is disabled
* - `selectedFlatRows` computation is memoized
* - Uses stable noop references when disabled
* - Fixes select-all indeterminate state considering filtered-out rows (now only visible rows are considered)
* - Removed `manualRowSelectedKey` display override from `defaultGetToggleRowSelectedProps` (`row.isSelected` is the single source of truth)
*
* _Pagination specific implementation where adjusted as well, although they are currently not being used_
*/
export declare const useRowSelect: {
(hooks: ReactTableHooks): void;
pluginName: string;
};