MCPcopy Create free account
hub / github.com/adobe/react-spectrum / TableInner

Function TableInner

packages/react-aria-components/src/Table.tsx:698–934  ·  view source on GitHub ↗
({props, forwardedRef: ref, selectionState, collection}: TableInnerProps)

Source from the content-addressed store, hash-verified

696};
697
698function TableInner({props, forwardedRef: ref, selectionState, collection}: TableInnerProps) {
699 // oxlint-disable-next-line react/react-compiler
700 [props, ref] = useContextProps(props, ref, SelectableCollectionContext);
701 // eslint-disable-next-line @typescript-eslint/no-unused-vars
702 let {shouldUseVirtualFocus, disallowTypeAhead, filter, ...DOMCollectionProps} = props;
703 let tableContainerContext = useContext(ResizableTableContainerContext);
704 ref = useObjectRef(
705 useMemo(
706 () => mergeRefs(ref, tableContainerContext?.tableRef),
707 [ref, tableContainerContext?.tableRef]
708 )
709 );
710 let [expandedKeys, setExpandedKeys] = useControlledState(
711 props.expandedKeys ? new Set(props.expandedKeys) : undefined,
712 props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : new Set(),
713 props.onExpandedChange
714 );
715 // oxlint-disable-next-line react/react-compiler
716 collection = useMemo(() => collection.withExpandedKeys(expandedKeys), [collection, expandedKeys]);
717
718 let tableState = useTableState({
719 ...DOMCollectionProps,
720 collection,
721 children: undefined,
722 UNSAFE_selectionState: selectionState,
723 expandedKeys,
724 onExpandedChange: setExpandedKeys
725 });
726
727 // oxlint-disable-next-line react/react-compiler
728 let filteredState = UNSTABLE_useFilteredTableState(tableState, filter);
729 let {
730 isVirtualized,
731 layoutDelegate,
732 dropTargetDelegate: ctxDropTargetDelegate,
733 CollectionRoot
734 } = useContext(CollectionRendererContext);
735 let {dragAndDropHooks} = props;
736 let {gridProps} = useTable(
737 {
738 ...DOMCollectionProps,
739 layoutDelegate,
740 isVirtualized
741 },
742 filteredState,
743 ref
744 );
745 let selectionManager = filteredState.selectionManager;
746 let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;
747 let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;
748 let dragHooksProvided = useRef(hasDragHooks);
749 let dropHooksProvided = useRef(hasDropHooks);
750 useEffect(() => {
751 if (process.env.NODE_ENV === 'production') {
752 return;
753 }
754 if (dragHooksProvided.current !== hasDragHooks) {
755 console.warn(

Callers

nothing calls this directly

Calls 15

useContextPropsFunction · 0.90
useObjectRefFunction · 0.90
mergeRefsFunction · 0.90
useControlledStateFunction · 0.90
useTableStateFunction · 0.90
useTableFunction · 0.90
useLocaleFunction · 0.90
useFocusRingFunction · 0.90
useRenderPropsFunction · 0.90
filterDOMPropsFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected