@cfxlabsinc/b2b-services
    Preparing search index...

    A table's selection, shared with its actions through context. Adds a cross-page "select all matching" mode to useMultiRowSelection: the header checkbox selects every row matching the current filters (count = total) when more match than the page shows.

    type TableSelection<T> = {
        allSelected: boolean;
        clear: () => void;
        count: number;
        deselectWhere: (predicate: (item: T) => boolean) => void;
        isSelected: (key: string) => boolean;
        selectAllMatching: boolean;
        selectedItems: T[];
        someSelected: boolean;
        toggle: (key: string, index: number, range?: boolean) => void;
        toggleAll: () => void;
        total: number;
    }

    Type Parameters

    • T
    Index
    allSelected: boolean
    clear: () => void
    count: number
    deselectWhere: (predicate: (item: T) => boolean) => void

    Drop every ticked row the predicate matches. Over items, not keys, because a caller holds selectedItems. A no-op under selectAllMatching.

    isSelected: (key: string) => boolean
    selectAllMatching: boolean
    selectedItems: T[]

    Concretely-ticked rows; empty while selectAllMatching.

    someSelected: boolean
    toggle: (key: string, index: number, range?: boolean) => void
    toggleAll: () => void
    total: number