///
import { WixPatternsContainer, FiltersMap, KeyedItem, ReportBI, ActionMove, ComputedQueryFull, QueryState, ActionMoveBase } from '@wix/bex-core';
import { DragAndDropSubmit, DragAndDropCancel, CollectionDragEndEvent, DragAndDropBulkSubmit } from './DragAndDrop';
import { HTMLAttributes, MutableRefObject } from 'react';
import { Announcements } from '@wix/wix-style-react-incubator/drag-and-drop';
import { ClientRect, DragStartEvent } from '@wix/wix-style-react-incubator/dnd-kit/core';
import { TypedEmitter } from '@wix/bex-core/events';
import { RectState } from '../../state/RectState';
import { ReorderModeState } from './ReorderModeState';
export interface DragAndDropParentState {
readonly reportBi: ReportBI;
readonly dragAndDropCategories?: (keyof F)[][] | null | undefined;
forceRenderIndexes?: {
rowIndex: number;
columnIndex: number;
}[];
readonly containerRect?: ClientRect;
_dnd?: DragAndDropState | null;
}
export interface DragAndDropCollection {
getKeyedItem: (key: string) => KeyedItem | undefined | null;
getKeyedItemByIndex: (ind: number) => KeyedItem | null;
keyedItems: KeyedItem[];
originQuery: ComputedQueryFull;
query: QueryState;
total: number;
}
interface DragAndDropBaseBI {
onDragStart: () => void;
onDragEnd: (overId: string) => void;
onDragCancel: (params: {
endType: 'clicked ESC' | 'drop outside';
}) => void;
onMoveCancelled: (move: ActionMoveBase) => void;
onAttemptDragStart: (itemId: string) => () => void;
}
export interface DragAndDropStateParams extends DragAndDropBaseStateParams {
move: (ev: {
over: DragItemOver | null;
}) => void;
announcements?: Partial;
bi?: DragAndDropBaseBI;
}
export interface DragAndDropBaseStateParams {
container: WixPatternsContainer;
collection: DragAndDropCollection;
state: DragAndDropParentState;
a11yContainer: HTMLElement | undefined | null;
}
interface DragItemActive {
id: string | number;
rect?: MutableRefObject<{
initial: ClientRect | null;
translated: ClientRect | null;
}>;
}
export interface DragItemOver {
id: string | number;
rect?: ClientRect;
disabled?: boolean;
}
export declare class DragAndDropState {
readonly state: DragAndDropParentState;
readonly container: WixPatternsContainer;
readonly collection: DragAndDropCollection;
readonly events: TypedEmitter<{
dropAnimationEnd: () => unknown;
}>;
status: 'start' | 'over' | 'end' | 'cancel' | null;
activeId: string | null | undefined;
overlayRect: RectState;
overId: string | null | undefined;
droppingId: string | null | undefined;
droppedId: string | null | undefined;
_dropAnimationId: string | null | undefined;
scheduleDropEnd: import("lodash").DebouncedFunc<() => void>;
scheduleIdle: import("lodash").DebouncedFunc<() => void>;
move: (ev: {
over: DragItemOver | null;
}) => void;
onSubmit?: DragAndDropSubmit;
onBulkSubmit?: DragAndDropBulkSubmit;
onCancel?: DragAndDropCancel;
reorderModeState?: ReorderModeState | null;
readonly bi: DragAndDropBaseBI | undefined;
_isHandleActive: boolean;
_isKeyboardDragging: boolean;
_moveId: string;
a11yContainer: HTMLElement | null | undefined;
private readonly _baseAnimation;
readonly sortableAnimation: {
duration: number;
easing: string;
};
readonly dropAnimation: {
duration: number;
easing: string;
sideEffects: () => () => void;
};
readonly activationConstraint: {
distance: number;
};
readonly keyboardCodes: {
start: string[];
cancel: string[];
end: string[];
move: string[];
};
readonly nullAnnouncements: Announcements;
readonly handleEvents: Partial>;
readonly containerEvents: Partial>;
constructor(params: DragAndDropStateParams);
onDropAnimationEnd: () => void;
get active(): KeyedItem | null | undefined;
get over(): KeyedItem | null | undefined;
get isDropping(): boolean;
get activeIndex(): number | undefined;
get isActive(): boolean;
_onGlobalKeydown: (e: KeyboardEvent) => void;
onDragMove(event: {
active: {
id: DragStartEvent['active']['id'];
rect?: DragStartEvent['active']['rect'];
};
}): void;
onDragStart(event: {
active: {
id: DragStartEvent['active']['id'];
rect?: DragStartEvent['active']['rect'];
};
}): void;
attachDisabledDragAttempt: (itemId: string, downEvent: MouseEvent, axis: 'x' | 'y' | 'all') => void;
get isActiveRectOutsideContainer(): boolean;
_maybeCancelDropAndShowErrorToast(event: {
active: DragItemActive | null;
over: DragItemOver | null;
}): boolean;
beforeDrop(event: {
active: DragItemActive | null;
over: DragItemOver | null;
}): boolean;
_createDragEndEvent(ev: {
over: DragItemOver | null;
}): {
moveId: string;
from: KeyedItem;
over: KeyedItem;
after: KeyedItem | null;
query: ComputedQueryFull;
filtersKeyHash: string;
isFromHandle: boolean;
} | null | undefined;
_createSimpleDragEndEvent(event: ActionMove): CollectionDragEndEvent;
onDragCancel(): void;
onDragOver(event: {
over: DragItemOver | null;
}): void;
onDragEnd(event: {
over: DragItemOver | null;
}): void;
get isDisabled(): boolean;
init({ a11yContainer }: {
a11yContainer?: HTMLElement | null | undefined;
}): () => void;
focusDragHandleIfDropped(id: string | number, element: HTMLElement | null | undefined): void;
get reportBi(): ReportBI;
}
export {};
//# sourceMappingURL=DragAndDropState.d.ts.map