import React, { useCallback } from 'react'; import { observer } from 'mobx-react-lite'; import { Box } from '@wix/design-system'; import { FiltersMap } from '@wix/bex-core'; import { MultiLevelSortingState, SortableColumn } from '../../state'; import { ListDragAndDropContext } from '../ListDragAndDrop/ListDragAndDropContext'; import { DraggableListItem } from '../ListDragAndDrop/DraggableListItem'; import { MultiLevelSortingTableListItem } from './MultiLevelSortingTableListItem'; import { DraggableCardOverlay } from '../GridDragAndDropDndKit/DraggableCardOverlay'; export interface MultiLevelSortingListProps { state: MultiLevelSortingState; } export function _MultiLevelSortingList( props: MultiLevelSortingListProps, ) { const { state } = props; const { dragAndDrop } = state; const renderItem = useCallback( ( sortableColumn: SortableColumn, index: number, { length }: { length: number }, ) => { return ( ); }, [], ); return ( { dragAndDrop._onSortReorder(from.item.columnId, over.item.columnId); }} > <> {state.sortingCollection.result.items.map(renderItem)} { const item = state.sortingCollection.result.items[index]; return item ? renderItem(item, index, { length: 0 }) : null; }} /> ); } export const MultiLevelSortingList = observer(_MultiLevelSortingList);