@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/dist/Resizer.main.js.map +1 -1
- package/dist/Resizer.module.js.map +1 -1
- package/dist/TableViewBase.main.js +10 -12
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +12 -14
- package/dist/TableViewBase.module.js +12 -14
- package/dist/TableViewBase.module.js.map +1 -1
- package/package.json +30 -30
- package/src/Resizer.tsx +2 -2
- package/src/TableViewBase.tsx +8 -12
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,
|
|
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';
|
package/src/TableViewBase.tsx
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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
|
|