@principal-ade/dynamic-file-tree 0.2.31 → 0.2.32
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/dist/index.mjs +42 -0
- package/dist/src/components/CanvasListTree/CanvasListTreeCore.d.ts.map +1 -1
- package/dist/src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.d.ts.map +1 -1
- package/dist/src/components/TreeNode.d.ts.map +1 -1
- package/dist/src/hooks/useNativeDragInterceptor.d.ts +16 -0
- package/dist/src/hooks/useNativeDragInterceptor.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -363,6 +363,15 @@ function TreeNode({
|
|
|
363
363
|
},
|
|
364
364
|
ref: isDraggable ? undefined : dragHandle,
|
|
365
365
|
draggable: isDraggable,
|
|
366
|
+
"data-native-drag": isDraggable ? "true" : undefined,
|
|
367
|
+
"data-drag-data": dragConfig ? JSON.stringify({
|
|
368
|
+
dataType: dragConfig.dataType,
|
|
369
|
+
primaryData: dragConfig.primaryData,
|
|
370
|
+
metadata: dragConfig.metadata,
|
|
371
|
+
suggestedActions: dragConfig.suggestedActions,
|
|
372
|
+
sourcePanel: dragConfig.sourcePanel
|
|
373
|
+
}) : undefined,
|
|
374
|
+
"data-drag-text": dragConfig?.primaryData,
|
|
366
375
|
onDragStart: isDraggable ? handleDragStart : undefined,
|
|
367
376
|
onDragEnd: isDraggable ? handleDragEnd : undefined,
|
|
368
377
|
onClick: (e) => {
|
|
@@ -1966,6 +1975,37 @@ import { Package, FolderKanban, LayoutDashboard, Workflow, BookOpen, FolderOpen,
|
|
|
1966
1975
|
import React13, { useMemo as useMemo9, useRef as useRef5 } from "react";
|
|
1967
1976
|
import { Tree as Tree3 } from "react-arborist";
|
|
1968
1977
|
|
|
1978
|
+
// src/hooks/useNativeDragInterceptor.ts
|
|
1979
|
+
import { useLayoutEffect } from "react";
|
|
1980
|
+
var useNativeDragInterceptor = (containerRef) => {
|
|
1981
|
+
useLayoutEffect(() => {
|
|
1982
|
+
const container = containerRef.current;
|
|
1983
|
+
if (!container)
|
|
1984
|
+
return;
|
|
1985
|
+
const handler = (e) => {
|
|
1986
|
+
const target = e.target;
|
|
1987
|
+
const nativeDragElement = target.closest('[data-native-drag="true"]');
|
|
1988
|
+
if (nativeDragElement) {
|
|
1989
|
+
e.stopImmediatePropagation();
|
|
1990
|
+
const dragEvent = e;
|
|
1991
|
+
if (dragEvent.dataTransfer) {
|
|
1992
|
+
const dragData = nativeDragElement.getAttribute("data-drag-data");
|
|
1993
|
+
const dragText = nativeDragElement.getAttribute("data-drag-text");
|
|
1994
|
+
if (dragData) {
|
|
1995
|
+
dragEvent.dataTransfer.setData("application/x-panel-data", dragData);
|
|
1996
|
+
}
|
|
1997
|
+
if (dragText) {
|
|
1998
|
+
dragEvent.dataTransfer.setData("text/plain", dragText);
|
|
1999
|
+
}
|
|
2000
|
+
dragEvent.dataTransfer.effectAllowed = "copyMove";
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
container.addEventListener("dragstart", handler, true);
|
|
2005
|
+
return () => container.removeEventListener("dragstart", handler, true);
|
|
2006
|
+
}, [containerRef]);
|
|
2007
|
+
};
|
|
2008
|
+
|
|
1969
2009
|
// src/utils/gitStatus.tsx
|
|
1970
2010
|
import {
|
|
1971
2011
|
Plus as Plus3,
|
|
@@ -2798,6 +2838,7 @@ var StoryboardWorkflowsTreeCoreInner = ({
|
|
|
2798
2838
|
};
|
|
2799
2839
|
const initialHeight = 600;
|
|
2800
2840
|
const [containerRef, containerHeight, isContainerReady] = useContainerHeight(initialHeight);
|
|
2841
|
+
useNativeDragInterceptor(containerRef);
|
|
2801
2842
|
const treeRef = useRef5(null);
|
|
2802
2843
|
return /* @__PURE__ */ React13.createElement("div", {
|
|
2803
2844
|
ref: containerRef,
|
|
@@ -3379,6 +3420,7 @@ var CanvasListTreeCore = ({
|
|
|
3379
3420
|
};
|
|
3380
3421
|
const initialHeight = 600;
|
|
3381
3422
|
const [containerRef, containerHeight, isContainerReady] = useContainerHeight(initialHeight);
|
|
3423
|
+
useNativeDragInterceptor(containerRef);
|
|
3382
3424
|
const treeRef = useRef6(null);
|
|
3383
3425
|
const handleToggle = (id) => {
|
|
3384
3426
|
if (onToggle && treeRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasListTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/CanvasListTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CanvasListTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/CanvasListTree/CanvasListTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAS/C,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAuRjB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4N5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAU/C,OAAO,KAAK,EAEV,4BAA4B,EAQ7B,MAAM,SAAS,CAAC;AAq9BjB,eAAO,MAAM,2BAA2B,0DAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../../../src/components/TreeNode.tsx"],"names":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AC3B,SAAS,EACT,qBAA6B,EAC7B,mBAA2B,EAC3B,aAAa,EACb,OAAO,EACP,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE,aAAa,CAAC,CAAC,CAAC,qBAyKlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Intercepts dragstart events for elements with data-native-drag="true"
|
|
4
|
+
* and prevents react-dnd's HTML5Backend from interfering.
|
|
5
|
+
*
|
|
6
|
+
* HTML5Backend attaches capture-phase listeners to the dndRootElement.
|
|
7
|
+
* By attaching our own capture-phase listener first (via useLayoutEffect),
|
|
8
|
+
* we can call stopImmediatePropagation() to prevent HTML5Backend from
|
|
9
|
+
* processing native drag events.
|
|
10
|
+
*
|
|
11
|
+
* Since stopImmediatePropagation prevents the event from reaching TreeNode's
|
|
12
|
+
* onDragStart handler, we also set the drag data here by reading from
|
|
13
|
+
* data attributes on the element.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useNativeDragInterceptor: (containerRef: RefObject<HTMLElement | null>) => void;
|
|
16
|
+
//# sourceMappingURL=useNativeDragInterceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNativeDragInterceptor.d.ts","sourceRoot":"","sources":["../../../src/hooks/useNativeDragInterceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GACnC,cAAc,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,KAC1C,IAmCF,CAAC"}
|
package/package.json
CHANGED