import { FiltersMap } from '@wix/bex-core'; import { TableState } from '../../state'; import { action, makeObservable } from 'mobx'; import { CollectionDragAndDropState } from './CollectionDragAndDropState'; import { DragAndDropCancel } from './DragAndDrop'; export interface TableDragAndDropStateParams { readonly tableState: TableState; readonly modalsContainerRef: { current: HTMLElement | null | undefined; }; readonly dragAndDropCancel?: DragAndDropCancel; } export class TableDragAndDropState { readonly tableState; readonly dragAndDrop; constructor(params: TableDragAndDropStateParams) { this.tableState = params.tableState; this.dragAndDrop = new CollectionDragAndDropState({ state: params.tableState.toolbar, container: params.tableState.toolbar.container, a11yContainer: params.modalsContainerRef, }); makeObservable(this, { init: action, }); } get dnd() { return this.dragAndDrop.dnd; } getStickyColumnsCount({ stickyColumns, horizontalScroll, }: { stickyColumns: number; showSelection?: boolean; horizontalScroll?: boolean; }) { const { dragAndDrop } = this; return horizontalScroll && !dragAndDrop.dnd.isDisabled ? stickyColumns + 1 : stickyColumns; } init() { const { dragAndDrop } = this; return dragAndDrop.init(); } }