From 545a41c27c6919e4ca22a58a67f3fa02a7caab8a Mon Sep 17 00:00:00 2001 From: Anil Anar Date: Fri, 26 May 2023 12:48:55 +0200 Subject: [PATCH] Add activatorEvent to DragStartEvent --- .changeset/smart-spies-peel.md | 5 +++++ packages/core/src/components/DndContext/DndContext.tsx | 1 + packages/core/src/types/events.ts | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/smart-spies-peel.md diff --git a/.changeset/smart-spies-peel.md b/.changeset/smart-spies-peel.md new file mode 100644 index 00000000..2269bd1c --- /dev/null +++ b/.changeset/smart-spies-peel.md @@ -0,0 +1,5 @@ +--- +'@dnd-kit/core': minor +--- + +Add `activatorEvent` to `DragStartEvent` diff --git a/packages/core/src/components/DndContext/DndContext.tsx b/packages/core/src/components/DndContext/DndContext.tsx index 9d5df10d..89cec202 100644 --- a/packages/core/src/components/DndContext/DndContext.tsx +++ b/packages/core/src/components/DndContext/DndContext.tsx @@ -359,6 +359,7 @@ export const DndContext = memo(function DndContext({ const {onDragStart} = latestProps.current; const event: DragStartEvent = { + activatorEvent, active: {id, data: draggableNode.data, rect: activeRects}, }; diff --git a/packages/core/src/types/events.ts b/packages/core/src/types/events.ts index 5c7c2aae..5ed62c54 100644 --- a/packages/core/src/types/events.ts +++ b/packages/core/src/types/events.ts @@ -11,7 +11,8 @@ interface DragEvent { over: Over | null; } -export interface DragStartEvent extends Pick {} +export interface DragStartEvent + extends Pick {} export interface DragMoveEvent extends DragEvent {}