@react-spectrum/table 3.12.11-nightly.4698 → 3.12.11-nightly.4700
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/TableViewBase.main.js +21 -10
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +21 -10
- package/dist/TableViewBase.module.js +21 -10
- package/dist/TableViewBase.module.js.map +1 -1
- package/dist/TableViewLayout.main.js +1 -1
- package/dist/TableViewLayout.main.js.map +1 -1
- package/dist/TableViewLayout.mjs +1 -1
- package/dist/TableViewLayout.module.js +1 -1
- package/dist/TableViewLayout.module.js.map +1 -1
- package/package.json +30 -30
- package/src/TableViewBase.tsx +17 -7
- package/src/TableViewLayout.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/table",
|
|
3
|
-
"version": "3.12.11-nightly.
|
|
3
|
+
"version": "3.12.11-nightly.4700+81abb2185",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,37 +36,37 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/button": "3.0.0-nightly.
|
|
40
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
41
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
42
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
43
|
-
"@react-aria/overlays": "3.0.0-nightly.
|
|
44
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
45
|
-
"@react-aria/table": "3.14.2-nightly.
|
|
46
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
47
|
-
"@react-aria/virtualizer": "3.10.2-nightly.
|
|
48
|
-
"@react-aria/visually-hidden": "3.0.0-nightly.
|
|
49
|
-
"@react-spectrum/checkbox": "3.0.0-nightly.
|
|
50
|
-
"@react-spectrum/dnd": "3.3.11-nightly.
|
|
51
|
-
"@react-spectrum/layout": "3.6.6-nightly.
|
|
52
|
-
"@react-spectrum/menu": "3.19.2-nightly.
|
|
53
|
-
"@react-spectrum/progress": "3.0.0-nightly.
|
|
54
|
-
"@react-spectrum/tooltip": "3.0.0-nightly.
|
|
55
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
56
|
-
"@react-stately/flags": "3.0.4-nightly.
|
|
57
|
-
"@react-stately/layout": "3.13.10-nightly.
|
|
58
|
-
"@react-stately/table": "3.11.9-nightly.
|
|
59
|
-
"@react-stately/virtualizer": "3.7.2-nightly.
|
|
60
|
-
"@react-types/grid": "3.2.7-nightly.
|
|
61
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
62
|
-
"@react-types/table": "3.9.6-nightly.
|
|
63
|
-
"@spectrum-icons/ui": "3.0.0-nightly.
|
|
39
|
+
"@react-aria/button": "3.0.0-nightly.2988+81abb2185",
|
|
40
|
+
"@react-aria/focus": "3.0.0-nightly.2988+81abb2185",
|
|
41
|
+
"@react-aria/i18n": "3.0.0-nightly.2988+81abb2185",
|
|
42
|
+
"@react-aria/interactions": "3.0.0-nightly.2988+81abb2185",
|
|
43
|
+
"@react-aria/overlays": "3.0.0-nightly.2988+81abb2185",
|
|
44
|
+
"@react-aria/selection": "3.0.0-nightly.2988+81abb2185",
|
|
45
|
+
"@react-aria/table": "3.14.2-nightly.4700+81abb2185",
|
|
46
|
+
"@react-aria/utils": "3.0.0-nightly.2988+81abb2185",
|
|
47
|
+
"@react-aria/virtualizer": "3.10.2-nightly.4700+81abb2185",
|
|
48
|
+
"@react-aria/visually-hidden": "3.0.0-nightly.2988+81abb2185",
|
|
49
|
+
"@react-spectrum/checkbox": "3.0.0-nightly.2988+81abb2185",
|
|
50
|
+
"@react-spectrum/dnd": "3.3.11-nightly.4700+81abb2185",
|
|
51
|
+
"@react-spectrum/layout": "3.6.6-nightly.4700+81abb2185",
|
|
52
|
+
"@react-spectrum/menu": "3.19.2-nightly.4700+81abb2185",
|
|
53
|
+
"@react-spectrum/progress": "3.0.0-nightly.2988+81abb2185",
|
|
54
|
+
"@react-spectrum/tooltip": "3.0.0-nightly.2988+81abb2185",
|
|
55
|
+
"@react-spectrum/utils": "3.0.0-nightly.2988+81abb2185",
|
|
56
|
+
"@react-stately/flags": "3.0.4-nightly.4700+81abb2185",
|
|
57
|
+
"@react-stately/layout": "3.13.10-nightly.4700+81abb2185",
|
|
58
|
+
"@react-stately/table": "3.11.9-nightly.4700+81abb2185",
|
|
59
|
+
"@react-stately/virtualizer": "3.7.2-nightly.4700+81abb2185",
|
|
60
|
+
"@react-types/grid": "3.2.7-nightly.4700+81abb2185",
|
|
61
|
+
"@react-types/shared": "3.0.0-nightly.2988+81abb2185",
|
|
62
|
+
"@react-types/table": "3.9.6-nightly.4700+81abb2185",
|
|
63
|
+
"@spectrum-icons/ui": "3.0.0-nightly.2988+81abb2185",
|
|
64
64
|
"@swc/helpers": "^0.5.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
68
|
-
"@react-aria/dnd": "3.6.2-nightly.
|
|
69
|
-
"@react-stately/dnd": "3.3.2-nightly.
|
|
67
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2988+81abb2185",
|
|
68
|
+
"@react-aria/dnd": "3.6.2-nightly.4700+81abb2185",
|
|
69
|
+
"@react-stately/dnd": "3.3.2-nightly.4700+81abb2185"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "81abb2185cb3a9c52a8feaf76a136c64852aea13"
|
|
80
80
|
}
|
package/src/TableViewBase.tsx
CHANGED
|
@@ -404,10 +404,20 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
|
|
|
404
404
|
}, [propsOnResizeEnd, setIsInResizeMode, setIsResizing]);
|
|
405
405
|
|
|
406
406
|
let focusedKey = state.selectionManager.focusedKey;
|
|
407
|
+
let dropTargetKey: Key | null = null;
|
|
407
408
|
if (dropState?.target?.type === 'item') {
|
|
408
|
-
|
|
409
|
+
dropTargetKey = dropState.target.key;
|
|
410
|
+
if (dropState.target.dropPosition === 'before' && dropTargetKey !== state.collection.getFirstKey()) {
|
|
411
|
+
// Normalize to the "after" drop position since we only render those in the DOM.
|
|
412
|
+
// The exception to this is for the first row in the table, where we also render the "before" position.
|
|
413
|
+
dropTargetKey = state.collection.getKeyBefore(dropTargetKey);
|
|
414
|
+
}
|
|
409
415
|
}
|
|
410
416
|
|
|
417
|
+
let persistedKeys = useMemo(() => {
|
|
418
|
+
return new Set([focusedKey, dropTargetKey].filter(k => k !== null));
|
|
419
|
+
}, [focusedKey, dropTargetKey]);
|
|
420
|
+
|
|
411
421
|
let mergedProps = mergeProps(
|
|
412
422
|
isTableDroppable && droppableCollection?.collectionProps,
|
|
413
423
|
gridProps,
|
|
@@ -462,7 +472,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
|
|
|
462
472
|
tableState={state}
|
|
463
473
|
layout={layout}
|
|
464
474
|
collection={state.collection}
|
|
465
|
-
|
|
475
|
+
persistedKeys={persistedKeys}
|
|
466
476
|
renderView={renderView}
|
|
467
477
|
renderWrapper={renderWrapper}
|
|
468
478
|
onVisibleRectChange={onVisibleRectChange}
|
|
@@ -494,7 +504,7 @@ interface TableVirtualizerProps<T> extends HTMLAttributes<HTMLElement> {
|
|
|
494
504
|
tableState: TableState<T>,
|
|
495
505
|
layout: TableViewLayout<T>,
|
|
496
506
|
collection: TableCollection<T>,
|
|
497
|
-
|
|
507
|
+
persistedKeys: Set<Key> | null,
|
|
498
508
|
renderView: (type: string, content: GridNode<T>) => ReactElement,
|
|
499
509
|
renderWrapper?: (
|
|
500
510
|
parent: View | null,
|
|
@@ -513,7 +523,7 @@ interface TableVirtualizerProps<T> extends HTMLAttributes<HTMLElement> {
|
|
|
513
523
|
|
|
514
524
|
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
515
525
|
function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
|
|
516
|
-
let {tableState, layout, collection,
|
|
526
|
+
let {tableState, layout, collection, persistedKeys, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible, isVirtualDragging, isRootDropTarget, ...otherProps} = props;
|
|
517
527
|
let {direction} = useLocale();
|
|
518
528
|
let loadingState = collection.body.props.loadingState;
|
|
519
529
|
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
@@ -558,7 +568,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
|
|
|
558
568
|
bodyRef.current.scrollTop = rect.y;
|
|
559
569
|
setScrollLeft(bodyRef.current, direction, rect.x);
|
|
560
570
|
},
|
|
561
|
-
persistedKeys
|
|
571
|
+
persistedKeys,
|
|
562
572
|
layoutOptions: useMemo(() => ({
|
|
563
573
|
columnWidths: columnResizeState.columnWidths
|
|
564
574
|
}), [columnResizeState.columnWidths])
|
|
@@ -566,10 +576,10 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
|
|
|
566
576
|
|
|
567
577
|
let memoedVirtualizerProps = useMemo(() => ({
|
|
568
578
|
tabIndex: otherProps.tabIndex,
|
|
569
|
-
|
|
579
|
+
persistedKeys,
|
|
570
580
|
isLoading,
|
|
571
581
|
onLoadMore
|
|
572
|
-
}), [otherProps.tabIndex,
|
|
582
|
+
}), [otherProps.tabIndex, persistedKeys, isLoading, onLoadMore]);
|
|
573
583
|
|
|
574
584
|
let {virtualizerProps, scrollViewProps: {onVisibleRectChange}} = useVirtualizer(memoedVirtualizerProps, state, domRef);
|
|
575
585
|
let onVisibleRectChangeMemo = useCallback(rect => {
|
package/src/TableViewLayout.ts
CHANGED
|
@@ -36,7 +36,7 @@ export class TableViewLayout<T> extends TableLayout<T> {
|
|
|
36
36
|
|
|
37
37
|
if (this.isLoading) {
|
|
38
38
|
// Add some margin around the loader to ensure that scrollbars don't flicker in and out.
|
|
39
|
-
let rect = new Rect(40, 40, (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
|
|
39
|
+
let rect = new Rect(40, Math.max(layoutInfo.rect.maxY, 40), (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
|
|
40
40
|
let loader = new LayoutInfo('loader', 'loader', rect);
|
|
41
41
|
loader.parentKey = layoutInfo.key;
|
|
42
42
|
loader.isSticky = children.length === 0;
|