mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-13 14:10:04 +02:00
fix list select all hotkey (#2195)
This commit is contained in:
@@ -343,6 +343,7 @@ export interface ItemGridListProps {
|
||||
gap?: 'lg' | 'md' | 'sm' | 'xl' | 'xs';
|
||||
getItem?: (index: number) => ItemCardProps['data'];
|
||||
getItemIndex?: (rowId: string) => number | undefined;
|
||||
getLoadedItems?: () => unknown[];
|
||||
getRowId?: ((item: unknown) => string) | string;
|
||||
initialTop?: {
|
||||
to: number;
|
||||
@@ -372,6 +373,7 @@ const BaseItemGridList = ({
|
||||
gap = 'sm',
|
||||
getItem,
|
||||
getItemIndex,
|
||||
getLoadedItems,
|
||||
getRowId,
|
||||
initialTop,
|
||||
itemCount,
|
||||
@@ -401,9 +403,18 @@ const BaseItemGridList = ({
|
||||
[data, getItem],
|
||||
);
|
||||
|
||||
const dataRef = useRef(data);
|
||||
const getLoadedItemsRef = useRef(getLoadedItems);
|
||||
dataRef.current = data;
|
||||
getLoadedItemsRef.current = getLoadedItems;
|
||||
|
||||
const getDataFn = useCallback(() => {
|
||||
return data;
|
||||
}, [data]);
|
||||
const loadedItems = getLoadedItemsRef.current?.();
|
||||
if (loadedItems?.length) {
|
||||
return loadedItems;
|
||||
}
|
||||
return dataRef.current ?? [];
|
||||
}, []);
|
||||
|
||||
const extractRowId = useMemo(() => createExtractRowId(getRowId), [getRowId]);
|
||||
|
||||
@@ -782,6 +793,7 @@ const BaseItemGridList = ({
|
||||
|
||||
useListHotkeys({
|
||||
controls,
|
||||
focusContainerRef: rootRef,
|
||||
focused,
|
||||
internalState,
|
||||
itemType,
|
||||
|
||||
Reference in New Issue
Block a user