@nocobase/flow-engine 2.1.0-beta.23 → 2.1.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/dnd/gridDragPlanner.d.ts +59 -2
- package/lib/components/dnd/gridDragPlanner.js +595 -19
- package/lib/components/dnd/index.js +7 -5
- package/package.json +4 -4
- package/src/components/__tests__/gridDragPlanner.test.ts +426 -5
- package/src/components/dnd/__tests__/DndProvider.test.tsx +98 -0
- package/src/components/dnd/gridDragPlanner.ts +735 -17
- package/src/components/dnd/index.tsx +7 -3
|
@@ -73,7 +73,7 @@ const resolveDraggableHostNode = (activatorNode: HTMLElement | null) => {
|
|
|
73
73
|
`[data-has-float-menu="true"][data-float-menu-model-uid="${toolbarModelUid}"]`,
|
|
74
74
|
),
|
|
75
75
|
);
|
|
76
|
-
const popupRoot = floatToolbarContainer
|
|
76
|
+
const popupRoot = floatToolbarContainer?.closest<HTMLElement>(MENU_SUBMENU_POPUP_SELECTOR);
|
|
77
77
|
|
|
78
78
|
if (popupRoot) {
|
|
79
79
|
return (
|
|
@@ -287,7 +287,9 @@ export const Droppable: FC<{ model: FlowModel<any>; children: React.ReactNode }>
|
|
|
287
287
|
export const DndProvider: FC<DndContextProps & PersistOptions> = ({
|
|
288
288
|
persist = true,
|
|
289
289
|
children,
|
|
290
|
+
onDragStart,
|
|
290
291
|
onDragEnd,
|
|
292
|
+
onDragCancel,
|
|
291
293
|
...restProps
|
|
292
294
|
}) => {
|
|
293
295
|
const [activeId, setActiveId] = useState<string | null>(null);
|
|
@@ -327,9 +329,10 @@ export const DndProvider: FC<DndContextProps & PersistOptions> = ({
|
|
|
327
329
|
|
|
328
330
|
return (
|
|
329
331
|
<DndContext
|
|
332
|
+
{...restProps}
|
|
330
333
|
onDragStart={(event) => {
|
|
331
334
|
setActiveId(event.active.id as string);
|
|
332
|
-
|
|
335
|
+
onDragStart?.(event);
|
|
333
336
|
}}
|
|
334
337
|
onDragEnd={(event) => {
|
|
335
338
|
setActiveId(null);
|
|
@@ -347,7 +350,7 @@ export const DndProvider: FC<DndContextProps & PersistOptions> = ({
|
|
|
347
350
|
onDragCancel={(event) => {
|
|
348
351
|
setActiveId(null);
|
|
349
352
|
setDragAnchorPoint(null);
|
|
350
|
-
|
|
353
|
+
onDragCancel?.(event);
|
|
351
354
|
}}
|
|
352
355
|
{...restProps}
|
|
353
356
|
>
|
|
@@ -362,6 +365,7 @@ export const DndProvider: FC<DndContextProps & PersistOptions> = ({
|
|
|
362
365
|
>
|
|
363
366
|
{activeId && (
|
|
364
367
|
<span
|
|
368
|
+
data-testid="flow-drag-preview"
|
|
365
369
|
style={{
|
|
366
370
|
display: 'inline-flex',
|
|
367
371
|
alignItems: 'center',
|