feat(core): guard service (#9816)

This commit is contained in:
EYHN
2025-02-10 07:26:38 +08:00
committed by GitHub
parent 879157b938
commit 92f4f0c2d9
89 changed files with 1520 additions and 522 deletions
@@ -316,7 +316,11 @@ export const useDropTarget = <D extends DNDData = DNDData>(
// external data is only available in drop event thus
// this is the only case for getAdaptedEventArgs
const args = getAdaptedEventArgs(_args, options.fromExternalData, true);
const args = {
...getAdaptedEventArgs(_args, options.fromExternalData, true),
treeInstruction: extractInstruction(_args.self.data),
closestEdge: extractClosestEdge(_args.self.data),
};
if (
isExternalDrag(_args) &&
options.fromExternalData &&
@@ -329,11 +333,7 @@ export const useDropTarget = <D extends DNDData = DNDData>(
}
if (args.location.current.dropTargets[0]?.element === element) {
options.onDrop?.({
...args,
treeInstruction: extractInstruction(args.self.data),
closestEdge: extractClosestEdge(args.self.data),
} as DropTargetDropEvent<D>);
options.onDrop?.(args as DropTargetDropEvent<D>);
}
},
getData: (args: DropTargetGetFeedback<D>) => {