@react-spectrum/table 3.5.1-nightly.3617 → 3.5.1-nightly.3621

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/Nubbin.tsx CHANGED
@@ -17,14 +17,12 @@ import React from 'react';
17
17
  export function Nubbin() {
18
18
  return (
19
19
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
20
- <g id="Group_175838" data-name="Group 175838">
21
- <g id="Ellipse_10104" data-name="Ellipse 10104" fill="var(--spectrum-global-color-blue-600)" stroke="var(--spectrum-global-color-blue-600)" strokeWidth="2">
22
- <circle cx="8" cy="8" r="8" stroke="none" />
23
- <circle cx="8" cy="8" r="7" fill="none" />
24
- </g>
20
+ <g fill="var(--spectrum-global-color-blue-600)" stroke="var(--spectrum-global-color-blue-600)" strokeWidth="2">
21
+ <circle cx="8" cy="8" r="8" stroke="none" />
22
+ <circle cx="8" cy="8" r="7" fill="none" />
25
23
  </g>
26
- <path id="Path_104166" data-name="Path 104166" d="M-2106-7380.263v5l2.5-2.551Z" transform="translate(2116 7385.763)" fill="#fff" stroke="#fff" strokeLinejoin="round" strokeWidth="2" />
27
- <path id="Path_104167" data-name="Path 104167" d="M-2106-7380.263v5l2.5-2.551Z" transform="translate(-2100 -7369.763) rotate(180)" fill="#fff" stroke="#fff" strokeLinejoin="round" strokeWidth="2" />
24
+ <path d="M-2106-7380.263v5l2.5-2.551Z" transform="translate(2116 7385.763)" fill="#fff" stroke="#fff" strokeLinejoin="round" strokeWidth="2" />
25
+ <path d="M-2106-7380.263v5l2.5-2.551Z" transform="translate(-2100 -7369.763) rotate(180)" fill="#fff" stroke="#fff" strokeLinejoin="round" strokeWidth="2" />
28
26
  </svg>
29
27
  );
30
28
  }
package/src/Resizer.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable jsx-a11y/role-supports-aria-props */
2
2
  import {classNames} from '@react-spectrum/utils';
3
+ import {ColumnSize} from '@react-types/table';
3
4
  import {FocusRing} from '@react-aria/focus';
4
5
  import {GridNode} from '@react-types/grid';
5
6
  // @ts-ignore
@@ -16,9 +17,9 @@ interface ResizerProps<T> {
16
17
  column: GridNode<T>,
17
18
  showResizer: boolean,
18
19
  triggerRef: RefObject<HTMLDivElement>,
19
- onResizeStart: (key: Key) => void,
20
- onResize: (widths: Map<Key, number | string>) => void,
21
- onResizeEnd: (key: Key) => void,
20
+ onResizeStart: (widths: Map<Key, ColumnSize>) => void,
21
+ onResize: (widths: Map<Key, ColumnSize>) => void,
22
+ onResizeEnd: (widths: Map<Key, ColumnSize>) => void,
22
23
  onMoveResizer: (e: MoveMoveEvent) => void
23
24
  }
24
25
 
package/src/TableView.tsx CHANGED
@@ -94,9 +94,9 @@ interface TableContextValue<T> {
94
94
  setIsInResizeMode: (val: boolean) => void,
95
95
  isEmpty: boolean,
96
96
  onFocusedResizer: () => void,
97
- onResizeStart: (key: Key) => void,
97
+ onResizeStart: (widths: Map<Key, ColumnSize>) => void,
98
98
  onResize: (widths: Map<Key, ColumnSize>) => void,
99
- onResizeEnd: (key: Key) => void,
99
+ onResizeEnd: (widths: Map<Key, ColumnSize>) => void,
100
100
  onMoveResizer: (e: MoveMoveEvent) => void,
101
101
  headerMenuOpen: boolean,
102
102
  setHeaderMenuOpen: (val: boolean) => void
@@ -114,7 +114,7 @@ export function useVirtualizerContext() {
114
114
 
115
115
  function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<HTMLDivElement>) {
116
116
  props = useProviderProps(props);
117
- let {isQuiet, onAction, onResizeEnd: propsOnResizeEnd} = props;
117
+ let {isQuiet, onAction, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd} = props;
118
118
  let {styleProps} = useStyleProps(props);
119
119
 
120
120
  let [showSelectionCheckboxes, setShowSelectionCheckboxes] = useState(props.selectionStyle !== 'highlight');
@@ -369,9 +369,10 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
369
369
  lastResizeInteractionModality.current = undefined;
370
370
  }
371
371
  };
372
- let onResizeStart = useCallback(() => {
372
+ let onResizeStart = useCallback((widths) => {
373
373
  setIsResizing(true);
374
- }, [setIsResizing]);
374
+ propsOnResizeStart?.(widths);
375
+ }, [setIsResizing, propsOnResizeStart]);
375
376
  let onResizeEnd = useCallback((widths) => {
376
377
  setIsInResizeMode(false);
377
378
  setIsResizing(false);
@@ -504,7 +505,7 @@ function TableVirtualizer({layout, collection, lastResizeInteractionModality, fo
504
505
  let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
505
506
  // this should be fine, every movement of the resizer causes a rerender
506
507
  // scrolling can cause it to lag for a moment, but it's always updated
507
- let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.width + (isNaN(bodyRef.current?.scrollLeft) ? 0 : bodyRef.current?.scrollLeft);
508
+ let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.maxX;
508
509
  let shouldHardCornerResizeCorner = resizerAtEdge && resizerInVisibleRegion;
509
510
 
510
511
  // minimize re-render caused on Resizers by memoing this