@react-spectrum/table 3.12.11-nightly.4701 → 3.12.11-nightly.4709

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Resizer.tsx CHANGED
@@ -10,8 +10,8 @@ import {GridNode} from '@react-types/grid';
10
10
  // @ts-ignore
11
11
  import intlMessages from '../intl/*.json';
12
12
  import {isWebKit, mergeProps} from '@react-aria/utils';
13
- import {Key} from '@react-types/shared';
14
- import React, {createContext, RefObject, useContext, useEffect, useState} from 'react';
13
+ import {Key, RefObject} from '@react-types/shared';
14
+ import React, {createContext, useContext, useEffect, useState} from 'react';
15
15
  import ReactDOM from 'react-dom';
16
16
  import styles from '@adobe/spectrum-css-temp/components/table/vars.css';
17
17
  import {TableColumnResizeState} from '@react-stately/table';
@@ -23,7 +23,7 @@ import {
23
23
  useUnwrapDOMRef
24
24
  } from '@react-spectrum/utils';
25
25
  import {ColumnSize, SpectrumColumnProps, TableCollection} from '@react-types/table';
26
- import {DOMRef, DropTarget, FocusableElement, FocusableRef, Key} from '@react-types/shared';
26
+ import {DOMRef, DropTarget, FocusableElement, FocusableRef, Key, RefObject} from '@react-types/shared';
27
27
  import type {DragAndDropHooks} from '@react-spectrum/dnd';
28
28
  import type {DraggableCollectionState, DroppableCollectionState} from '@react-stately/dnd';
29
29
  import type {DraggableItemResult, DropIndicatorAria, DroppableCollectionResult, DroppableItemResult} from '@react-aria/dnd';
@@ -33,15 +33,15 @@ import {GridNode} from '@react-types/grid';
33
33
  import {InsertionIndicator} from './InsertionIndicator';
34
34
  // @ts-ignore
35
35
  import intlMessages from '../intl/*.json';
36
- import {isAndroid, mergeProps, scrollIntoView, scrollIntoViewport} from '@react-aria/utils';
36
+ import {isAndroid, mergeProps, scrollIntoView, scrollIntoViewport, useLoadMore} from '@react-aria/utils';
37
37
  import {Item, Menu, MenuTrigger} from '@react-spectrum/menu';
38
38
  import {LayoutInfo, Rect, ReusableView, useVirtualizerState} from '@react-stately/virtualizer';
39
- import {layoutInfoToStyle, ScrollView, setScrollLeft, useVirtualizer, VirtualizerItem} from '@react-aria/virtualizer';
39
+ import {layoutInfoToStyle, ScrollView, setScrollLeft, VirtualizerItem} from '@react-aria/virtualizer';
40
40
  import ListGripper from '@spectrum-icons/ui/ListGripper';
41
41
  import {ListKeyboardDelegate} from '@react-aria/selection';
42
42
  import {Nubbin} from './Nubbin';
43
43
  import {ProgressCircle} from '@react-spectrum/progress';
44
- import React, {DOMAttributes, HTMLAttributes, ReactElement, ReactNode, RefObject, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
44
+ import React, {DOMAttributes, HTMLAttributes, ReactElement, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
45
45
  import {Resizer, ResizeStateContext} from './Resizer';
46
46
  import {RootDropIndicator} from './RootDropIndicator';
47
47
  import {DragPreview as SpectrumDragPreview} from './DragPreview';
@@ -574,14 +574,11 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
574
574
  }), [columnResizeState.columnWidths])
575
575
  });
576
576
 
577
- let memoedVirtualizerProps = useMemo(() => ({
578
- tabIndex: otherProps.tabIndex,
579
- persistedKeys,
580
- isLoading,
581
- onLoadMore
582
- }), [otherProps.tabIndex, persistedKeys, isLoading, onLoadMore]);
577
+ useLoadMore({isLoading, onLoadMore, scrollOffset: 1}, bodyRef);
578
+ let onVisibleRectChange = useCallback((rect: Rect) => {
579
+ state.setVisibleRect(rect);
580
+ }, [state]);
583
581
 
584
- let {virtualizerProps, scrollViewProps: {onVisibleRectChange}} = useVirtualizer(memoedVirtualizerProps, state, domRef);
585
582
  let onVisibleRectChangeMemo = useCallback(rect => {
586
583
  setTableWidth(rect.width);
587
584
  onVisibleRectChange(rect);
@@ -622,7 +619,6 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
622
619
  }), [resizingColumnWidth, columnResizeState.resizingColumn]);
623
620
  let mergedProps = mergeProps(
624
621
  otherProps,
625
- virtualizerProps,
626
622
  isVirtualDragging && {tabIndex: null}
627
623
  );
628
624