@elliemae/ds-drag-and-drop 3.16.0 → 3.16.1
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/cjs/hierarchy/customCollisionDetection.js +4 -0
- package/dist/cjs/hierarchy/customCollisionDetection.js.map +2 -2
- package/dist/cjs/hierarchy/getHierarchyKeyboardCoordinates.js +4 -0
- package/dist/cjs/hierarchy/getHierarchyKeyboardCoordinates.js.map +2 -2
- package/dist/cjs/hierarchy/index.js +6 -2
- package/dist/cjs/hierarchy/index.js.map +2 -2
- package/dist/cjs/hierarchy/types.js +4 -0
- package/dist/cjs/hierarchy/types.js.map +1 -1
- package/dist/cjs/hierarchy/useHierarchyActionHandlers.js +4 -0
- package/dist/cjs/hierarchy/useHierarchyActionHandlers.js.map +2 -2
- package/dist/cjs/hierarchy/useHierarchyAnnouncements.js +4 -0
- package/dist/cjs/hierarchy/useHierarchyAnnouncements.js.map +2 -2
- package/dist/cjs/hierarchy/useHierarchyDndkitConfig.js +9 -5
- package/dist/cjs/hierarchy/useHierarchyDndkitConfig.js.map +2 -2
- package/dist/cjs/hierarchy/useHierarchyPreviewHandlers.js +4 -0
- package/dist/cjs/hierarchy/useHierarchyPreviewHandlers.js.map +2 -2
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/tree/constants.js +4 -0
- package/dist/cjs/tree/constants.js.map +1 -1
- package/dist/cjs/tree/customCollisionDetection.js +5 -1
- package/dist/cjs/tree/customCollisionDetection.js.map +2 -2
- package/dist/cjs/tree/getTreeKeyboardCoordinates.js +5 -1
- package/dist/cjs/tree/getTreeKeyboardCoordinates.js.map +2 -2
- package/dist/cjs/tree/index.js +7 -3
- package/dist/cjs/tree/index.js.map +2 -2
- package/dist/cjs/tree/types.js +4 -0
- package/dist/cjs/tree/types.js.map +2 -2
- package/dist/cjs/tree/useTreeActionHandlers.js +5 -1
- package/dist/cjs/tree/useTreeActionHandlers.js.map +2 -2
- package/dist/cjs/tree/useTreeAnnouncements.js +5 -1
- package/dist/cjs/tree/useTreeAnnouncements.js.map +2 -2
- package/dist/cjs/tree/useTreeDndkitConfig.js +11 -7
- package/dist/cjs/tree/useTreeDndkitConfig.js.map +2 -2
- package/dist/cjs/tree/useTreePreviewHandlers.js +4 -0
- package/dist/cjs/tree/useTreePreviewHandlers.js.map +2 -2
- package/dist/cjs/tree/utilities.js +5 -1
- package/dist/cjs/tree/utilities.js.map +2 -2
- package/dist/esm/hierarchy/customCollisionDetection.js.map +2 -2
- package/dist/esm/hierarchy/getHierarchyKeyboardCoordinates.js.map +2 -2
- package/dist/esm/hierarchy/index.js +2 -2
- package/dist/esm/hierarchy/index.js.map +1 -1
- package/dist/esm/hierarchy/useHierarchyActionHandlers.js.map +2 -2
- package/dist/esm/hierarchy/useHierarchyAnnouncements.js.map +2 -2
- package/dist/esm/hierarchy/useHierarchyDndkitConfig.js +5 -5
- package/dist/esm/hierarchy/useHierarchyDndkitConfig.js.map +2 -2
- package/dist/esm/hierarchy/useHierarchyPreviewHandlers.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/tree/customCollisionDetection.js +1 -1
- package/dist/esm/tree/customCollisionDetection.js.map +2 -2
- package/dist/esm/tree/getTreeKeyboardCoordinates.js +1 -1
- package/dist/esm/tree/getTreeKeyboardCoordinates.js.map +2 -2
- package/dist/esm/tree/index.js +3 -3
- package/dist/esm/tree/index.js.map +1 -1
- package/dist/esm/tree/useTreeActionHandlers.js +1 -1
- package/dist/esm/tree/useTreeActionHandlers.js.map +2 -2
- package/dist/esm/tree/useTreeAnnouncements.js +1 -1
- package/dist/esm/tree/useTreeAnnouncements.js.map +2 -2
- package/dist/esm/tree/useTreeDndkitConfig.js +7 -7
- package/dist/esm/tree/useTreeDndkitConfig.js.map +2 -2
- package/dist/esm/tree/useTreePreviewHandlers.js.map +2 -2
- package/dist/esm/tree/utilities.js +1 -1
- package/dist/esm/tree/utilities.js.map +2 -2
- package/dist/types/hierarchy/customCollisionDetection.d.ts +1 -1
- package/dist/types/hierarchy/getHierarchyKeyboardCoordinates.d.ts +1 -1
- package/dist/types/hierarchy/index.d.ts +2 -2
- package/dist/types/hierarchy/useHierarchyActionHandlers.d.ts +1 -1
- package/dist/types/hierarchy/useHierarchyAnnouncements.d.ts +1 -1
- package/dist/types/hierarchy/useHierarchyDndkitConfig.d.ts +1 -1
- package/dist/types/hierarchy/useHierarchyPreviewHandlers.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/tree/customCollisionDetection.d.ts +1 -1
- package/dist/types/tree/getTreeKeyboardCoordinates.d.ts +1 -1
- package/dist/types/tree/index.d.ts +3 -3
- package/dist/types/tree/types.d.ts +1 -1
- package/dist/types/tree/useTreeActionHandlers.d.ts +1 -1
- package/dist/types/tree/useTreeAnnouncements.d.ts +2 -2
- package/dist/types/tree/useTreeDndkitConfig.d.ts +1 -1
- package/dist/types/tree/useTreePreviewHandlers.d.ts +1 -1
- package/dist/types/tree/utilities.d.ts +2 -2
- package/package.json +4 -3
package/dist/esm/tree/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export * from "./useTreeDndkitConfig";
|
|
3
|
-
export * from "./types";
|
|
4
|
-
import { removeChildrenOf } from "./utilities";
|
|
2
|
+
export * from "./useTreeDndkitConfig.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
|
+
import { removeChildrenOf } from "./utilities.js";
|
|
5
5
|
export {
|
|
6
6
|
removeChildrenOf
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useTreeDndkitConfig';\nexport * from './types';\nexport { removeChildrenOf } from './utilities';\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useTreeDndkitConfig.js';\nexport * from './types.js';\nexport { removeChildrenOf } from './utilities.js';\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,SAAS,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { arrayMove } from "@dnd-kit/sortable";
|
|
3
3
|
import { cloneDeep } from "lodash";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
|
-
import { DropIndicatorPosition } from "./constants";
|
|
5
|
+
import { DropIndicatorPosition } from "./constants.js";
|
|
6
6
|
const useTreeActionHandlers = ({
|
|
7
7
|
handlePreviewDragStart,
|
|
8
8
|
handlePreviewDragMove,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/useTreeActionHandlers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { arrayMove } from '@dnd-kit/sortable';\nimport { cloneDeep } from 'lodash';\nimport { useCallback } from 'react';\nimport type { DragStartEvent, DragMoveEvent, DragEndEvent, DragOverEvent, DragCancelEvent } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants';\nimport type { DnDKitTree } from './types';\n\nexport const useTreeActionHandlers = <T,>({\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragOver,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n onReorder,\n flattenedItems,\n projected,\n dropIndicatorPosition,\n isDropValid,\n}: DnDKitTree.UseTreeActionHandlersArgs<T>): DnDKitTree.UseTreeActionHandlersReturn => {\n const onDragStart = useCallback(\n (e: DragStartEvent) => {\n handlePreviewDragStart(e);\n },\n [handlePreviewDragStart],\n );\n\n const onDragMove = useCallback(\n (e: DragMoveEvent) => {\n handlePreviewDragMove(e);\n },\n [handlePreviewDragMove],\n );\n\n const onDragOver = useCallback(\n (e: DragOverEvent) => {\n handlePreviewDragOver(e);\n },\n [handlePreviewDragOver],\n );\n\n const onDragEnd = useCallback(\n (e: DragEndEvent) => {\n handlePreviewDragEnd(e);\n const { active, over } = e;\n\n if (over === null || !isDropValid) return;\n\n const activeIndex = flattenedItems.findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems.findIndex((item) => item.uid === over.id);\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n considerExpanding = over.id;\n overIndex = flattenedItems[overIndex].realIndex + flattenedItems[overIndex].childrenCount + 1;\n }\n\n // If we are dropping the item in a new position, or new depth\n if (projected && (activeIndex !== overIndex || flattenedItems[activeIndex].depth !== projected.depth)) {\n // Change parent and depth from projected data\n flattenedItems[activeIndex].parentId = projected.parentId;\n flattenedItems[activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n const newFlattenedData =\n activeIndex !== overIndex ? arrayMove(flattenedItems, activeIndex, overIndex) : cloneDeep(flattenedItems);\n\n onReorder(flattenedItems[activeIndex], overIndex, {\n over: flattenedItems[overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n });\n }\n },\n [handlePreviewDragEnd, isDropValid, dropIndicatorPosition, projected, flattenedItems, onReorder],\n );\n\n const onDragCancel = useCallback(\n (e: DragCancelEvent) => {\n handlePreviewDragCancel(e);\n },\n [handlePreviewDragCancel],\n );\n\n return { onDragStart, onDragMove, onDragOver, onDragEnd, onDragCancel };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,SAAS,6BAA6B;AAG/B,MAAM,wBAAwB,CAAK;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuF;AACrF,QAAM,cAAc;AAAA,IAClB,CAAC,MAAsB;AACrB,6BAAuB,CAAC;AAAA,IAC1B;AAAA,IACA,CAAC,sBAAsB;AAAA,EACzB;AAEA,QAAM,aAAa;AAAA,IACjB,CAAC,MAAqB;AACpB,4BAAsB,CAAC;AAAA,IACzB;AAAA,IACA,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,aAAa;AAAA,IACjB,CAAC,MAAqB;AACpB,4BAAsB,CAAC;AAAA,IACzB;AAAA,IACA,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,YAAY;AAAA,IAChB,CAAC,MAAoB;AACnB,2BAAqB,CAAC;AACtB,YAAM,EAAE,QAAQ,KAAK,IAAI;AAEzB,UAAI,SAAS,QAAQ,CAAC;AAAa;AAEnC,YAAM,cAAc,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,OAAO,EAAE;AAE7E,UAAI,oBAAoB;AAExB,UAAI,YAAY,eAAe,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAGvE,UAAI,0BAA0B,sBAAsB,QAAQ;AAC1D,4BAAoB,KAAK;AACzB,oBAAY,eAAe,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { arrayMove } from '@dnd-kit/sortable';\nimport { cloneDeep } from 'lodash';\nimport { useCallback } from 'react';\nimport type { DragStartEvent, DragMoveEvent, DragEndEvent, DragOverEvent, DragCancelEvent } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeActionHandlers = <T,>({\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragOver,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n onReorder,\n flattenedItems,\n projected,\n dropIndicatorPosition,\n isDropValid,\n}: DnDKitTree.UseTreeActionHandlersArgs<T>): DnDKitTree.UseTreeActionHandlersReturn => {\n const onDragStart = useCallback(\n (e: DragStartEvent) => {\n handlePreviewDragStart(e);\n },\n [handlePreviewDragStart],\n );\n\n const onDragMove = useCallback(\n (e: DragMoveEvent) => {\n handlePreviewDragMove(e);\n },\n [handlePreviewDragMove],\n );\n\n const onDragOver = useCallback(\n (e: DragOverEvent) => {\n handlePreviewDragOver(e);\n },\n [handlePreviewDragOver],\n );\n\n const onDragEnd = useCallback(\n (e: DragEndEvent) => {\n handlePreviewDragEnd(e);\n const { active, over } = e;\n\n if (over === null || !isDropValid) return;\n\n const activeIndex = flattenedItems.findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems.findIndex((item) => item.uid === over.id);\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n considerExpanding = over.id;\n overIndex = flattenedItems[overIndex].realIndex + flattenedItems[overIndex].childrenCount + 1;\n }\n\n // If we are dropping the item in a new position, or new depth\n if (projected && (activeIndex !== overIndex || flattenedItems[activeIndex].depth !== projected.depth)) {\n // Change parent and depth from projected data\n flattenedItems[activeIndex].parentId = projected.parentId;\n flattenedItems[activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n const newFlattenedData =\n activeIndex !== overIndex ? arrayMove(flattenedItems, activeIndex, overIndex) : cloneDeep(flattenedItems);\n\n onReorder(flattenedItems[activeIndex], overIndex, {\n over: flattenedItems[overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n });\n }\n },\n [handlePreviewDragEnd, isDropValid, dropIndicatorPosition, projected, flattenedItems, onReorder],\n );\n\n const onDragCancel = useCallback(\n (e: DragCancelEvent) => {\n handlePreviewDragCancel(e);\n },\n [handlePreviewDragCancel],\n );\n\n return { onDragStart, onDragMove, onDragOver, onDragEnd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gBAAgB,YAAY,UAAU,gBAAgB,aAAa,SAAS,IAAI,UAAU,cAAc;AAE1G,kBAAU,eAAe,WAAW,GAAG,WAAW;AAAA,UAChD,MAAM,eAAe,SAAS;AAAA,UAC9B,WAAW;AAAA,UACX;AAAA,UACA,WAAW;AAAA,UACX;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,CAAC,sBAAsB,aAAa,uBAAuB,WAAW,gBAAgB,SAAS;AAAA,EACjG;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAuB;AACtB,8BAAwB,CAAC;AAAA,IAC3B;AAAA,IACA,CAAC,uBAAuB;AAAA,EAC1B;AAEA,SAAO,EAAE,aAAa,YAAY,YAAY,WAAW,aAAa;AACxE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { DropIndicatorPosition } from "./constants";
|
|
3
|
+
import { DropIndicatorPosition } from "./constants.js";
|
|
4
4
|
const useTreeAnnouncements = (visibleItemsDictionary, dropIndicatorPosition) => {
|
|
5
5
|
const onDragStart = useCallback(
|
|
6
6
|
({ active: { id } }) => `Picked up draggable item from position ${visibleItemsDictionary[id].realIndex + 1}.`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/useTreeAnnouncements.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';\nimport { useCallback } from 'react';\nimport { DropIndicatorPosition } from './constants';\nimport type { DnDKitTree } from './types';\n\nexport const useTreeAnnouncements = <T,>(\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n dropIndicatorPosition: DropIndicatorPosition,\n): Announcements => {\n const onDragStart: Announcements['onDragStart'] = useCallback(\n ({ active: { id } }) => `Picked up draggable item from position ${visibleItemsDictionary[id].realIndex + 1}.`,\n [visibleItemsDictionary],\n );\n\n const onDragMove: Announcements['onDragOver'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n return `Draggable item was moved inside the item at position ${overIndex}.`;\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return `Draggable item was moved to position ${overIndex - 1}.`;\n }\n return `Draggable item was moved to position ${overIndex}.`;\n }\n\n return `Draggable item is no longer over a droppable area.`;\n },\n [visibleItemsDictionary, dropIndicatorPosition],\n );\n\n const onDragOver: Announcements['onDragOver'] = onDragMove;\n\n const onDragEnd: Announcements['onDragEnd'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n return `Draggable item was dropped inside the item at position ${overIndex}.`;\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return `Draggable item was dropped over position ${overIndex - 1}.`;\n }\n return `Draggable item was dropped over position ${overIndex}.`;\n }\n\n return `Draggable item was dropped at it's original position.`;\n },\n [dropIndicatorPosition, visibleItemsDictionary],\n );\n\n const onDragCancel: Announcements['onDragCancel'] = useCallback(\n ({ active: { id } }) =>\n `Dragging was cancelled. Draggable item from position ${\n visibleItemsDictionary[id].realIndex + 1\n } was dropped at it's initial position.`,\n [visibleItemsDictionary],\n );\n\n return { onDragStart, onDragOver, onDragMove, onDragEnd, onDragCancel };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAG/B,MAAM,uBAAuB,CAClC,wBACA,0BACkB;AAClB,QAAM,cAA4C;AAAA,IAChD,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,0CAA0C,uBAAuB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';\nimport { useCallback } from 'react';\nimport { DropIndicatorPosition } from './constants.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeAnnouncements = <T,>(\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n dropIndicatorPosition: DropIndicatorPosition,\n): Announcements => {\n const onDragStart: Announcements['onDragStart'] = useCallback(\n ({ active: { id } }) => `Picked up draggable item from position ${visibleItemsDictionary[id].realIndex + 1}.`,\n [visibleItemsDictionary],\n );\n\n const onDragMove: Announcements['onDragOver'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n return `Draggable item was moved inside the item at position ${overIndex}.`;\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return `Draggable item was moved to position ${overIndex - 1}.`;\n }\n return `Draggable item was moved to position ${overIndex}.`;\n }\n\n return `Draggable item is no longer over a droppable area.`;\n },\n [visibleItemsDictionary, dropIndicatorPosition],\n );\n\n const onDragOver: Announcements['onDragOver'] = onDragMove;\n\n const onDragEnd: Announcements['onDragEnd'] = useCallback(\n ({ over }) => {\n if (over) {\n const overIndex = visibleItemsDictionary[over.id].realIndex + 1;\n if (dropIndicatorPosition === DropIndicatorPosition.Inside) {\n return `Draggable item was dropped inside the item at position ${overIndex}.`;\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return `Draggable item was dropped over position ${overIndex - 1}.`;\n }\n return `Draggable item was dropped over position ${overIndex}.`;\n }\n\n return `Draggable item was dropped at it's original position.`;\n },\n [dropIndicatorPosition, visibleItemsDictionary],\n );\n\n const onDragCancel: Announcements['onDragCancel'] = useCallback(\n ({ active: { id } }) =>\n `Dragging was cancelled. Draggable item from position ${\n visibleItemsDictionary[id].realIndex + 1\n } was dropped at it's initial position.`,\n [visibleItemsD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;AAAA,EACzB;AAEA,SAAO,EAAE,aAAa,YAAY,YAAY,WAAW,aAAa;AACxE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useState, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { useSensor, useSensors, KeyboardSensor, PointerSensor, MeasuringStrategy } from "@dnd-kit/core";
|
|
4
|
-
import { useTreePreviewHandlers } from "./useTreePreviewHandlers";
|
|
5
|
-
import { getTreeKeyboardCoordinates } from "./getTreeKeyboardCoordinates";
|
|
6
|
-
import { getProjection } from "./utilities";
|
|
7
|
-
import { useTreeActionHandlers } from "./useTreeActionHandlers";
|
|
8
|
-
import { DropIndicatorPosition } from "./constants";
|
|
9
|
-
import { customCollisionDetection } from "./customCollisionDetection";
|
|
10
|
-
import { useTreeAnnouncements } from "./useTreeAnnouncements";
|
|
4
|
+
import { useTreePreviewHandlers } from "./useTreePreviewHandlers.js";
|
|
5
|
+
import { getTreeKeyboardCoordinates } from "./getTreeKeyboardCoordinates.js";
|
|
6
|
+
import { getProjection } from "./utilities.js";
|
|
7
|
+
import { useTreeActionHandlers } from "./useTreeActionHandlers.js";
|
|
8
|
+
import { DropIndicatorPosition } from "./constants.js";
|
|
9
|
+
import { customCollisionDetection } from "./customCollisionDetection.js";
|
|
10
|
+
import { useTreeAnnouncements } from "./useTreeAnnouncements.js";
|
|
11
11
|
const adjustTranslate = (isHorizontalDnD, sortedIds) => {
|
|
12
12
|
const func = ({ transform, activatorEvent, active }) => {
|
|
13
13
|
const newTransform = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/useTreeDndkitConfig.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useState, useEffect, useMemo, useRef } from 'react';\nimport type { Active, MeasuringConfiguration, Modifier, Over, UniqueIdentifier } from '@dnd-kit/core';\nimport { useSensor, useSensors, KeyboardSensor, PointerSensor, MeasuringStrategy } from '@dnd-kit/core';\nimport { useTreePreviewHandlers } from './useTreePreviewHandlers';\nimport { getTreeKeyboardCoordinates } from './getTreeKeyboardCoordinates';\nimport { getProjection } from './utilities';\nimport { useTreeActionHandlers } from './useTreeActionHandlers';\nimport type { DnDKitTree } from './types';\nimport { DropIndicatorPosition } from './constants';\nimport { customCollisionDetection } from './customCollisionDetection';\nimport { useTreeAnnouncements } from './useTreeAnnouncements';\n\n// we make space for the drop indicator\n// if second parameter is true, the space will be done on the horizontal axis\nconst adjustTranslate = (isHorizontalDnD: boolean, sortedIds: UniqueIdentifier[]): Modifier => {\n const func: Modifier = ({ transform, activatorEvent, active }) => {\n const newTransform = {\n ...transform,\n };\n if (isHorizontalDnD) {\n newTransform.x = transform.x + 25;\n } else {\n newTransform.x = transform.x + 15;\n if (['Enter', 'Space'].includes((activatorEvent as KeyboardEvent)?.code)) {\n const isLast = active?.id === sortedIds[sortedIds.length - 1];\n const keyboardTranslate = ((isLast ? -1 : 1) * (active?.rect?.current?.initial?.height ?? 0)) / 2;\n newTransform.y = transform.y + keyboardTranslate;\n }\n }\n return newTransform;\n };\n return func;\n};\n\nconst measuring: Partial<MeasuringConfiguration> = {\n droppable: {\n strategy: MeasuringStrategy.Always,\n },\n};\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const [active, setActive] = useState<Active | null>(null);\n const [over, setOver] = useState<Over | null>(null);\n const [dropIndicatorPosition, setDropIndicatorPosition] = useState<DropIndicatorPosition>(DropIndicatorPosition.None);\n const lastPositionRef = useRef<string>('');\n\n // Sorted ids for the library\n const sortedIds = useMemo(() => flattenedItems.map((item) => item.uid), [flattenedItems]);\n\n /**\n * Dictionary from UID to ITEM\n * This dictionary is computed since on every DnD move, I need to know the\n * depth of a particular item, so O(1) per DnD move instead of O(#ITEMS)\n */\n const flattenedItemsDictionary = useMemo(() => {\n // Using plain for to achieve O(#ITEMS) performance\n const dictionary: Record<UniqueIdentifier, (typeof flattenedItems)[0]> = {};\n flattenedItems.forEach((item) => {\n dictionary[item.uid] = item;\n });\n return dictionary;\n }, [flattenedItems]);\n\n const isDropValid = useMemo(() => {\n if (!active || !over) return true;\n return getIsDropValid(\n flattenedItemsDictionary[active.id],\n flattenedItemsDictionary[over.id],\n ['none', 'before', 'after', 'inside'][dropIndicatorPosition] as Parameters<typeof getIsDropValid>[2],\n );\n }, [getIsDropValid, flattenedItemsDictionary, active, over, dropIndicatorPosition]);\n\n const modifiers: Modifier[] = useMemo(\n () => [adjustTranslate(isHorizontalDnD, sortedIds)],\n [isHorizontalDnD, sortedIds],\n );\n\n const sensorContext: DnDKitTree.SensorContext<T> = useRef({\n items: flattenedItems,\n dropIndicatorPosition,\n setDropIndicatorPosition,\n isHorizontalDnD,\n maxDragAndDropLevel,\n active,\n flattenedItemsDictionary,\n lastPositionRef,\n });\n\n useEffect(() => {\n sensorContext.current = {\n items: flattenedItems,\n dropIndicatorPosition,\n isHorizontalDnD,\n maxDragAndDropLevel,\n active,\n flattenedItemsDictionary,\n lastPositionRef,\n };\n }, [flattenedItems, dropIndicatorPosition, isHorizontalDnD, maxDragAndDropLevel, active, flattenedItemsDictionary]);\n\n const coordinateGetter = useMemo(() => getTreeKeyboardCoordinates(sensorContext), []);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter }));\n\n // where is the activeItem being positioned (depth and parent)\n const projected = useMemo(\n () =>\n over ? getProjection(flattenedItems, flattenedItemsDictionary, over, dropIndicatorPosition, isExpandable) : null,\n [over, flattenedItems, flattenedItemsDictionary, dropIndicatorPosition, isExpandable],\n );\n\n const dragPreviewHandlers = useTreePreviewHandlers({\n setActive,\n setOver,\n setDropIndicatorPosition,\n });\n\n const dragActionHandlers = useTreeActionHandlers({\n ...dragPreviewHandlers,\n onReorder,\n projected,\n flattenedItems,\n dropIndicatorPosition,\n isDropValid,\n });\n\n const announcements = useTreeAnnouncements(flattenedItemsDictionary, dropIndicatorPosition);\n\n const collisionDetection = customCollisionDetection(sensorContext);\n\n const dndContextProps = useMemo(\n () => ({\n accessibility: {\n announcements,\n container: document.body,\n },\n modifiers,\n sensors,\n measuring,\n collisionDetection,\n ...dragActionHandlers,\n }),\n [announcements, modifiers, sensors, collisionDetection, dragActionHandlers],\n );\n\n const sortableContextProps = useMemo(\n () => ({\n items: sortedIds,\n strategy: () => null,\n }),\n [sortedIds],\n );\n\n const activeItem = useMemo(() => {\n if (!active) return null;\n return flattenedItemsDictionary[active.id];\n }, [active, flattenedItemsDictionary]);\n\n const overItem = useMemo(() => {\n if (!over) return null;\n return flattenedItemsDictionary[over.id];\n }, [flattenedItemsDictionary, over]);\n\n return {\n dndContextProps,\n sortableContextProps,\n isDropValid,\n active,\n activeItem,\n over,\n overItem,\n dropIndicatorPosition,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,UAAU,WAAW,SAAS,cAAc;AAErD,SAAS,WAAW,YAAY,gBAAgB,eAAe,yBAAyB;AACxF,SAAS,8BAA8B;AACvC,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;AACtC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AAIrC,MAAM,kBAAkB,CAAC,iBAA0B,cAA4C;AAC7F,QAAM,OAAiB,CAAC,EAAE,WAAW,gBAAgB,OAAO,MAAM;AAChE,UAAM,eAAe;AAAA,MACnB,GAAG;AAAA,IACL;AACA,QAAI,iBAAiB;AACnB,mBAAa,IAAI,UAAU,IAAI;AAAA,IACjC,OAAO;AACL,mBAAa,IAAI,UAAU,IAAI;AAC/B,UAAI,CAAC,SAAS,OAAO,EAAE,SAAU,gBAAkC,IAAI,GAAG;AACxE,cAAM,SAAS,QAAQ,OAAO,UAAU,UAAU,SAAS;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useState, useEffect, useMemo, useRef } from 'react';\nimport type { Active, MeasuringConfiguration, Modifier, Over, UniqueIdentifier } from '@dnd-kit/core';\nimport { useSensor, useSensors, KeyboardSensor, PointerSensor, MeasuringStrategy } from '@dnd-kit/core';\nimport { useTreePreviewHandlers } from './useTreePreviewHandlers.js';\nimport { getTreeKeyboardCoordinates } from './getTreeKeyboardCoordinates.js';\nimport { getProjection } from './utilities.js';\nimport { useTreeActionHandlers } from './useTreeActionHandlers.js';\nimport type { DnDKitTree } from './types.js';\nimport { DropIndicatorPosition } from './constants.js';\nimport { customCollisionDetection } from './customCollisionDetection.js';\nimport { useTreeAnnouncements } from './useTreeAnnouncements.js';\n\n// we make space for the drop indicator\n// if second parameter is true, the space will be done on the horizontal axis\nconst adjustTranslate = (isHorizontalDnD: boolean, sortedIds: UniqueIdentifier[]): Modifier => {\n const func: Modifier = ({ transform, activatorEvent, active }) => {\n const newTransform = {\n ...transform,\n };\n if (isHorizontalDnD) {\n newTransform.x = transform.x + 25;\n } else {\n newTransform.x = transform.x + 15;\n if (['Enter', 'Space'].includes((activatorEvent as KeyboardEvent)?.code)) {\n const isLast = active?.id === sortedIds[sortedIds.length - 1];\n const keyboardTranslate = ((isLast ? -1 : 1) * (active?.rect?.current?.initial?.height ?? 0)) / 2;\n newTransform.y = transform.y + keyboardTranslate;\n }\n }\n return newTransform;\n };\n return func;\n};\n\nconst measuring: Partial<MeasuringConfiguration> = {\n droppable: {\n strategy: MeasuringStrategy.Always,\n },\n};\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const [active, setActive] = useState<Active | null>(null);\n const [over, setOver] = useState<Over | null>(null);\n const [dropIndicatorPosition, setDropIndicatorPosition] = useState<DropIndicatorPosition>(DropIndicatorPosition.None);\n const lastPositionRef = useRef<string>('');\n\n // Sorted ids for the library\n const sortedIds = useMemo(() => flattenedItems.map((item) => item.uid), [flattenedItems]);\n\n /**\n * Dictionary from UID to ITEM\n * This dictionary is computed since on every DnD move, I need to know the\n * depth of a particular item, so O(1) per DnD move instead of O(#ITEMS)\n */\n const flattenedItemsDictionary = useMemo(() => {\n // Using plain for to achieve O(#ITEMS) performance\n const dictionary: Record<UniqueIdentifier, (typeof flattenedItems)[0]> = {};\n flattenedItems.forEach((item) => {\n dictionary[item.uid] = item;\n });\n return dictionary;\n }, [flattenedItems]);\n\n const isDropValid = useMemo(() => {\n if (!active || !over) return true;\n return getIsDropValid(\n flattenedItemsDictionary[active.id],\n flattenedItemsDictionary[over.id],\n ['none', 'before', 'after', 'inside'][dropIndicatorPosition] as Parameters<typeof getIsDropValid>[2],\n );\n }, [getIsDropValid, flattenedItemsDictionary, active, over, dropIndicatorPosition]);\n\n const modifiers: Modifier[] = useMemo(\n () => [adjustTranslate(isHorizontalDnD, sortedIds)],\n [isHorizontalDnD, sortedIds],\n );\n\n const sensorContext: DnDKitTree.SensorContext<T> = useRef({\n items: flattenedItems,\n dropIndicatorPosition,\n setDropIndicatorPosition,\n isHorizontalDnD,\n maxDragAndDropLevel,\n active,\n flattenedItemsDictionary,\n lastPositionRef,\n });\n\n useEffect(() => {\n sensorContext.current = {\n items: flattenedItems,\n dropIndicatorPosition,\n isHorizontalDnD,\n maxDragAndDropLevel,\n active,\n flattenedItemsDictionary,\n lastPositionRef,\n };\n }, [flattenedItems, dropIndicatorPosition, isHorizontalDnD, maxDragAndDropLevel, active, flattenedItemsDictionary]);\n\n const coordinateGetter = useMemo(() => getTreeKeyboardCoordinates(sensorContext), []);\n\n const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, { coordinateGetter }));\n\n // where is the activeItem being positioned (depth and parent)\n const projected = useMemo(\n () =>\n over ? getProjection(flattenedItems, flattenedItemsDictionary, over, dropIndicatorPosition, isExpandable) : null,\n [over, flattenedItems, flattenedItemsDictionary, dropIndicatorPosition, isExpandable],\n );\n\n const dragPreviewHandlers = useTreePreviewHandlers({\n setActive,\n setOver,\n setDropIndicatorPosition,\n });\n\n const dragActionHandlers = useTreeActionHandlers({\n ...dragPreviewHandlers,\n onReorder,\n projected,\n flattenedItems,\n dropIndicatorPosition,\n isDropValid,\n });\n\n const announcements = useTreeAnnouncements(flattenedItemsDictionary, dropIndicatorPosition);\n\n const collisionDetection = customCollisionDetection(sensorContext);\n\n const dndContextProps = useMemo(\n () => ({\n accessibility: {\n announcements,\n container: document.body,\n },\n modifiers,\n sensors,\n measuring,\n collisionDetection,\n ...dragActionHandlers,\n }),\n [announcements, modifiers, sensors, collisionDetection, dragActionHandlers],\n );\n\n const sortableContextProps = useMemo(\n () => ({\n items: sortedIds,\n strategy: () => null,\n }),\n [sortedIds],\n );\n\n const activeItem = useMemo(() => {\n if (!active) return null;\n return flattenedItemsDictionary[active.id];\n }, [active, flattenedItemsDictionary]);\n\n const overItem = useMemo(() => {\n if (!over) return null;\n return flattenedItemsDictionary[over.id];\n }, [flattenedItemsDictionary, over]);\n\n return {\n dndContextProps,\n sortableContextProps,\n isDropValid,\n active,\n activeItem,\n over,\n overItem,\n dropIndicatorPosition,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,UAAU,WAAW,SAAS,cAAc;AAErD,SAAS,WAAW,YAAY,gBAAgB,eAAe,yBAAyB;AACxF,SAAS,8BAA8B;AACvC,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AAEtC,SAAS,6BAA6B;A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,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,gBAAgB,qBAAqB,0BAA0B,qBAAqB;AAE1F,QAAM,qBAAqB,yBAAyB,aAAa;AAEjE,QAAM,kBAAkB;AAAA,IACtB,OAAO;AAAA,MACL,eAAe;AAAA,QACb;AAAA,QACA,WAAW,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL;AAAA,IACA,CAAC,eAAe,WAAW,SAAS,oBAAoB,kBAAkB;AAAA,EAC5E;AAEA,QAAM,uBAAuB;AAAA,IAC3B,OAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU,MAAM;AAAA,IAClB;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AAEA,QAAM,aAAa,QAAQ,MAAM;AAC/B,QAAI,CAAC;AAAQ,aAAO;AACpB,WAAO,yBAAyB,OAAO,EAAE;AAAA,EAC3C,GAAG,CAAC,QAAQ,wBAAwB,CAAC;AAErC,QAAM,WAAW,QAAQ,MAAM;AAC7B,QAAI,CAAC;AAAM,aAAO;AAClB,WAAO,yBAAyB,KAAK,EAAE;AAAA,EACzC,GAAG,CAAC,0BAA0B,IAAI,CAAC;AAEnC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/useTreePreviewHandlers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback } from 'react';\nimport type { DragStartEvent, DragOverEvent, DragMoveEvent } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types';\n\nexport const useTreePreviewHandlers = ({\n setActive,\n setOver,\n setDropIndicatorPosition,\n}: DnDKitTree.UseTreePreviewHandlersArgs): DnDKitTree.UseTreePreviewHandlersReturn => {\n const resetState = useCallback(() => {\n setOver(null);\n setActive(null);\n\n document.body.style.setProperty('cursor', '');\n }, [setOver, setActive]);\n\n const handlePreviewDragStart = useCallback(\n ({ active }: DragStartEvent) => {\n setActive(active);\n document.body.style.setProperty('cursor', 'grabbing');\n },\n [setActive, setOver],\n );\n\n const handlePreviewDragMove = useCallback(({ collisions }: DragMoveEvent) => {\n if (collisions === null || collisions.length === 0) return;\n\n const firstCollision = collisions[0];\n\n const dropIndicatorPosition = (firstCollision.data as DnDKitTree.DragEventData)?.dropIndicatorPosition;\n\n setDropIndicatorPosition(dropIndicatorPosition);\n }, []);\n\n const handlePreviewDragOver = useCallback(({ over }: DragOverEvent) => {\n setOver(over);\n }, []);\n\n const handlePreviewDragEnd = useCallback(() => {\n resetState();\n }, [resetState]);\n\n const handlePreviewDragCancel = useCallback(() => {\n resetState();\n }, [resetState]);\n\n return {\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragOver,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,mBAAmB;AAIrB,MAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,MAAsF;AACpF,QAAM,aAAa,YAAY,MAAM;AACnC,YAAQ,IAAI;AACZ,cAAU,IAAI;AAEd,aAAS,KAAK,MAAM,YAAY,UAAU,EAAE;AAAA,EAC9C,GAAG,CAAC,SAAS,SAAS,CAAC;AAEvB,QAAM,yBAAyB;AAAA,IAC7B,CAAC,EAAE,OAAO,MAAsB;AAC9B,gBAAU,MAAM;AAChB,eAAS,KAAK,MAAM,YAAY,UAAU,UAAU;AAAA,IACtD;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,QAAM,wBAAwB,YAAY,CAAC,EAAE,WAAW,MAAqB;AAC3E,QAAI,eAAe,QAAQ,WAAW,WAAW;AAAG;AAEpD,UAAM,iBAAiB,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback } from 'react';\nimport type { DragStartEvent, DragOverEvent, DragMoveEvent } from '@dnd-kit/core';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreePreviewHandlers = ({\n setActive,\n setOver,\n setDropIndicatorPosition,\n}: DnDKitTree.UseTreePreviewHandlersArgs): DnDKitTree.UseTreePreviewHandlersReturn => {\n const resetState = useCallback(() => {\n setOver(null);\n setActive(null);\n\n document.body.style.setProperty('cursor', '');\n }, [setOver, setActive]);\n\n const handlePreviewDragStart = useCallback(\n ({ active }: DragStartEvent) => {\n setActive(active);\n document.body.style.setProperty('cursor', 'grabbing');\n },\n [setActive, setOver],\n );\n\n const handlePreviewDragMove = useCallback(({ collisions }: DragMoveEvent) => {\n if (collisions === null || collisions.length === 0) return;\n\n const firstCollision = collisions[0];\n\n const dropIndicatorPosition = (firstCollision.data as DnDKitTree.DragEventData)?.dropIndicatorPosition;\n\n setDropIndicatorPosition(dropIndicatorPosition);\n }, []);\n\n const handlePreviewDragOver = useCallback(({ over }: DragOverEvent) => {\n setOver(over);\n }, []);\n\n const handlePreviewDragEnd = useCallback(() => {\n resetState();\n }, [resetState]);\n\n const handlePreviewDragCancel = useCallback(() => {\n resetState();\n }, [resetState]);\n\n return {\n handlePreviewDragStart,\n handlePreviewDragMove,\n handlePreviewDragOver,\n handlePreviewDragEnd,\n handlePreviewDragCancel,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,mBAAmB;AAIrB,MAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,MAAsF;AACpF,QAAM,aAAa,YAAY,MAAM;AACnC,YAAQ,IAAI;AACZ,cAAU,IAAI;AAEd,aAAS,KAAK,MAAM,YAAY,UAAU,EAAE;AAAA,EAC9C,GAAG,CAAC,SAAS,SAAS,CAAC;AAEvB,QAAM,yBAAyB;AAAA,IAC7B,CAAC,EAAE,OAAO,MAAsB;AAC9B,gBAAU,MAAM;AAChB,eAAS,KAAK,MAAM,YAAY,UAAU,UAAU;AAAA,IACtD;AAAA,IACA,CAAC,WAAW,OAAO;AAAA,EACrB;AAEA,QAAM,wBAAwB,YAAY,CAAC,EAAE,WAAW,MAAqB;AAC3E,QAAI,eAAe,QAAQ,WAAW,WAAW;AAAG;AAEpD,UAAM,iBAAiB,WAAW,CAAC;AAEnC,UAAM,wBAAyB,eAAe,MAAmC;AAEjF,6BAAyB,qBAAqB;AAAA,EAChD,GAAG,CAAC,CAAC;AAEL,QAAM,wBAAwB,YAAY,CAAC,EAAE,KAAK,MAAqB;AACrE,YAAQ,IAAI;AAAA,EACd,GAAG,CAAC,CAAC;AAEL,QAAM,uBAAuB,YAAY,MAAM;AAC7C,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,0BAA0B,YAAY,MAAM;AAChD,eAAW;AAAA,EACb,GAAG,CAAC,UAAU,CAAC;AAEf,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/tree/utilities.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport type { Over, UniqueIdentifier } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants';\nimport type { DnDKitTree } from './types';\n\nconst getMinDepth = <T,>(item: DnDKitTree.Item<T>) => {\n if (item) return item.depth;\n return 0;\n};\n\nexport const getProjection = <T,>(\n items: DnDKitTree.Item<T>[],\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DropIndicatorPosition,\n isExpandable: boolean,\n): { depth: number; parentId: UniqueIdentifier | null } => {\n const overItemIndex = visibleItemsDictionary[over.id].realIndex;\n\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return { depth: visibleItemsDictionary[over.id].depth, parentId: visibleItemsDictionary[over.id].parentId };\n }\n\n const previousItem = items[overItemIndex];\n const nextItem = items[overItemIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: visibleItemsDictionary[over.id].depth + 1,\n parentId: over.id,\n };\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return { depth: getMinDepth(previousItem), parentId: previousItem.parentId };\n }\n return { depth: getMinDepth(nextItem), parentId: nextItem?.parentId };\n};\n\nexport const removeChildrenOf = <T,>(items: DnDKitTree.Item<T>[], id: UniqueIdentifier): DnDKitTree.Item<T>[] => {\n const excludeParentIds = [id];\n\n return items.filter((item) => {\n if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {\n excludeParentIds.push(item.uid);\n return false;\n }\n return true;\n });\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,6BAA6B;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI;AAAM,WAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,OACA,wBACA,MACA,uBACA,iBACyD;AACzD,QAAM,gBAAgB,uBAAuB,KAAK,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport type { Over, UniqueIdentifier } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants.js';\nimport type { DnDKitTree } from './types.js';\n\nconst getMinDepth = <T,>(item: DnDKitTree.Item<T>) => {\n if (item) return item.depth;\n return 0;\n};\n\nexport const getProjection = <T,>(\n items: DnDKitTree.Item<T>[],\n visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DropIndicatorPosition,\n isExpandable: boolean,\n): { depth: number; parentId: UniqueIdentifier | null } => {\n const overItemIndex = visibleItemsDictionary[over.id].realIndex;\n\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return { depth: visibleItemsDictionary[over.id].depth, parentId: visibleItemsDictionary[over.id].parentId };\n }\n\n const previousItem = items[overItemIndex];\n const nextItem = items[overItemIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: visibleItemsDictionary[over.id].depth + 1,\n parentId: over.id,\n };\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return { depth: getMinDepth(previousItem), parentId: previousItem.parentId };\n }\n return { depth: getMinDepth(nextItem), parentId: nextItem?.parentId };\n};\n\nexport const removeChildrenOf = <T,>(items: DnDKitTree.Item<T>[], id: UniqueIdentifier): DnDKitTree.Item<T>[] => {\n const excludeParentIds = [id];\n\n return items.filter((item) => {\n if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {\n excludeParentIds.push(item.uid);\n return false;\n }\n return true;\n });\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,6BAA6B;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI;AAAM,WAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,OACA,wBACA,MACA,uBACA,iBACyD;AACzD,QAAM,gBAAgB,uBAAuB,KAAK,EAAE,EAAE;AAEtD,MAAI,0BAA0B,sBAAsB,MAAM;AACxD,WAAO,EAAE,OAAO,uBAAuB,KAAK,EAAE,EAAE,OAAO,UAAU,uBAAuB,KAAK,EAAE,EAAE,SAAS;AAAA,EAC5G;AAEA,QAAM,eAAe,MAAM,aAAa;AACxC,QAAM,WAAW,MAAM,gBAAgB,CAAC;AAExC,MAAI,0BAA0B,sBAAsB,UAAU,cAAc;AAC1E,WAAO;AAAA,MACL,OAAO,uBAAuB,KAAK,EAAE,EAAE,QAAQ;AAAA,MAC/C,UAAU,KAAK;AAAA,IACjB;AAAA,EACF;AACA,MAAI,0BAA0B,sBAAsB,QAAQ;AAC1D,WAAO,EAAE,OAAO,YAAY,YAAY,GAAG,UAAU,aAAa,SAAS;AAAA,EAC7E;AACA,SAAO,EAAE,OAAO,YAAY,QAAQ,GAAG,UAAU,UAAU,SAAS;AACtE;AAEO,MAAM,mBAAmB,CAAK,OAA6B,OAA+C;AAC/G,QAAM,mBAAmB,CAAC,EAAE;AAE5B,SAAO,MAAM,OAAO,CAAC,SAAS;AAC5B,QAAI,KAAK,aAAa,QAAQ,iBAAiB,SAAS,KAAK,QAAQ,GAAG;AACtE,uBAAiB,KAAK,KAAK,GAAG;AAC9B,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type CollisionDetection } from '@dnd-kit/core';
|
|
2
|
-
import type { DnDKitHierarchy } from './types';
|
|
2
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
3
3
|
export declare const customCollisionDetection: <T>(sensorContext: DnDKitHierarchy.SensorContext<T>) => CollisionDetection;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { KeyboardCoordinateGetter } from '@dnd-kit/core';
|
|
2
|
-
import type { DnDKitHierarchy } from './types';
|
|
2
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
3
3
|
export declare const getHierarchyKeyboardCoordinates: <T>(context: DnDKitHierarchy.SensorContext<T>) => KeyboardCoordinateGetter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './useHierarchyDndkitConfig';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './useHierarchyDndkitConfig.js';
|
|
2
|
+
export * from './types.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitHierarchy } from './types';
|
|
1
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
2
2
|
export declare const useHierarchyActionHandlers: <T>({ handlePreviewDragStart, handlePreviewDragMove, handlePreviewDragEnd, handlePreviewDragCancel, onReorder, flattenedItems, }: DnDKitHierarchy.UseHierarchyActionHandlersArgs<T>) => DnDKitHierarchy.UseHierarchyActionHandlersReturn;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
-
import type { DnDKitHierarchy } from './types';
|
|
2
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
3
3
|
export declare const useHierarchyAnnouncements: <T>(visibleItemsDictionary: Record<UniqueIdentifier, DnDKitHierarchy.Item<T>>) => Announcements;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitHierarchy } from './types';
|
|
1
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
2
2
|
export declare const useHierarchyDndkitConfig: <T>({ flattenedItems, onReorder, isHorizontalDnD, onPreviewResetState, onPreviewDragStart, }: DnDKitHierarchy.UseHierarchyDndkitConfigArgs<T>) => DnDKitHierarchy.UseHierarchyDndkitConfigReturn;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitHierarchy } from './types';
|
|
1
|
+
import type { DnDKitHierarchy } from './types.js';
|
|
2
2
|
export declare const useHierarchyPreviewHandlers: ({ setActive, onPreviewResetState, onPreviewDragStart, }: DnDKitHierarchy.UseHierarchyPreviewHandlersArgs) => DnDKitHierarchy.UseHierarchyPreviewHandlersReturn;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { KeyboardCoordinateGetter } from '@dnd-kit/core';
|
|
2
|
-
import type { DnDKitTree } from './types';
|
|
2
|
+
import type { DnDKitTree } from './types.js';
|
|
3
3
|
export declare const getTreeKeyboardCoordinates: <T>(context: DnDKitTree.SensorContext<T>) => KeyboardCoordinateGetter;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './useTreeDndkitConfig';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export { removeChildrenOf } from './utilities';
|
|
1
|
+
export * from './useTreeDndkitConfig.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export { removeChildrenOf } from './utilities.js';
|
|
@@ -3,7 +3,7 @@ import type { SortingStrategy } from '@dnd-kit/sortable';
|
|
|
3
3
|
import type { RectMap } from '@dnd-kit/core/dist/store';
|
|
4
4
|
import type { Coordinates } from '@dnd-kit/core/dist/types';
|
|
5
5
|
import type { Dispatch, SetStateAction, MutableRefObject } from 'react';
|
|
6
|
-
import type { DropIndicatorPosition } from './constants';
|
|
6
|
+
import type { DropIndicatorPosition } from './constants.js';
|
|
7
7
|
export declare namespace DnDKitTree {
|
|
8
8
|
export type Item<T> = {
|
|
9
9
|
uid: UniqueIdentifier;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitTree } from './types';
|
|
1
|
+
import type { DnDKitTree } from './types.js';
|
|
2
2
|
export declare const useTreeActionHandlers: <T>({ handlePreviewDragStart, handlePreviewDragMove, handlePreviewDragOver, handlePreviewDragEnd, handlePreviewDragCancel, onReorder, flattenedItems, projected, dropIndicatorPosition, isDropValid, }: DnDKitTree.UseTreeActionHandlersArgs<T>) => DnDKitTree.UseTreeActionHandlersReturn;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Announcements, UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
-
import { DropIndicatorPosition } from './constants';
|
|
3
|
-
import type { DnDKitTree } from './types';
|
|
2
|
+
import { DropIndicatorPosition } from './constants.js';
|
|
3
|
+
import type { DnDKitTree } from './types.js';
|
|
4
4
|
export declare const useTreeAnnouncements: <T>(visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>, dropIndicatorPosition: DropIndicatorPosition) => Announcements;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitTree } from './types';
|
|
1
|
+
import type { DnDKitTree } from './types.js';
|
|
2
2
|
export declare const useTreeDndkitConfig: <T>({ flattenedItems, onReorder, isHorizontalDnD, isExpandable, getIsDropValid, maxDragAndDropLevel, }: DnDKitTree.UseTreeConfigArgs<T>) => DnDKitTree.UseTreeConfigReturn<T>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DnDKitTree } from './types';
|
|
1
|
+
import type { DnDKitTree } from './types.js';
|
|
2
2
|
export declare const useTreePreviewHandlers: ({ setActive, setOver, setDropIndicatorPosition, }: DnDKitTree.UseTreePreviewHandlersArgs) => DnDKitTree.UseTreePreviewHandlersReturn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Over, UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
-
import { DropIndicatorPosition } from './constants';
|
|
3
|
-
import type { DnDKitTree } from './types';
|
|
2
|
+
import { DropIndicatorPosition } from './constants.js';
|
|
3
|
+
import type { DnDKitTree } from './types.js';
|
|
4
4
|
export declare const getProjection: <T>(items: DnDKitTree.Item<T>[], visibleItemsDictionary: Record<UniqueIdentifier, DnDKitTree.Item<T>>, over: Over, dropIndicatorPosition: DropIndicatorPosition, isExpandable: boolean) => {
|
|
5
5
|
depth: number;
|
|
6
6
|
parentId: UniqueIdentifier | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-drag-and-drop",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Drag And Drop",
|
|
6
6
|
"files": [
|
|
@@ -107,9 +107,10 @@
|
|
|
107
107
|
"indent": 4
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@dnd-kit/core": "~6.0.
|
|
110
|
+
"@dnd-kit/core": "~6.0.8",
|
|
111
111
|
"@dnd-kit/modifiers": "~6.0.1",
|
|
112
|
-
"@dnd-kit/sortable": "~7.0.
|
|
112
|
+
"@dnd-kit/sortable": "~7.0.2",
|
|
113
|
+
"@elliemae/ds-props-helpers": "3.16.1"
|
|
113
114
|
},
|
|
114
115
|
"peerDependencies": {
|
|
115
116
|
"lodash": "^4.17.21",
|