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

Function TableInner

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

Source from the content-addressed store, hash-verified

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