@elliemae/ds-drag-and-drop 3.52.0-rc.9 → 3.52.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.
|
@@ -33,7 +33,7 @@ __export(useTreeActionHandlers_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useTreeActionHandlers_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_sortable = require("@dnd-kit/sortable");
|
|
36
|
-
var
|
|
36
|
+
var import_lodash_es = require("lodash-es");
|
|
37
37
|
var import_react = require("react");
|
|
38
38
|
var import_constants = require("./constants.js");
|
|
39
39
|
const useTreeActionHandlers = ({
|
|
@@ -89,7 +89,7 @@ const useTreeActionHandlers = ({
|
|
|
89
89
|
if (projected && (activeIndex !== overIndex || flattenedItems[activeContainer][activeIndex].depth !== projected.depth || activeContainer !== overContainer)) {
|
|
90
90
|
flattenedItems[activeContainer][activeIndex].parentId = projected.parentId;
|
|
91
91
|
flattenedItems[activeContainer][activeIndex].depth = projected.depth;
|
|
92
|
-
const newFlattenedData = (0,
|
|
92
|
+
const newFlattenedData = (0, import_lodash_es.cloneDeep)(flattenedItems);
|
|
93
93
|
if (isOverContainerOfContainer) {
|
|
94
94
|
if (newFlattenedData[overContainer].length === 0) {
|
|
95
95
|
newFlattenedData[overContainer][0] = { ...flattenedItems[activeContainer][activeIndex] };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tree/useTreeActionHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { 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 flattenedItemsDictionary,\n containersRef,\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 if (over.id === active.id) return;\n\n const isOverContainerOfContainer = containersRef.current.includes(over.id);\n const overContainer = isOverContainerOfContainer\n ? over.id\n : flattenedItemsDictionary[over.id]?.container || 'root';\n const activeContainer = flattenedItemsDictionary[active.id].container || 'root';\n\n const activeIndex = flattenedItems[activeContainer].findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems[overContainer].findIndex((item) => item.uid === over.id);\n const isUp = overIndex < activeIndex;\n\n if (dropIndicatorPosition === 'after' && (isUp || activeContainer !== overContainer)) overIndex += 1;\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && !isOverContainerOfContainer) {\n considerExpanding = over.id;\n overIndex =\n flattenedItems[overContainer][overIndex].realIndex +\n flattenedItems[overContainer][overIndex].childrenCount +\n 1;\n }\n\n // If we are dropping the item in a new position, or new depth or new container\n if (\n projected &&\n (activeIndex !== overIndex ||\n flattenedItems[activeContainer][activeIndex].depth !== projected.depth ||\n activeContainer !== overContainer)\n ) {\n // Change parent and depth from projected data\n flattenedItems[activeContainer][activeIndex].parentId = projected.parentId;\n flattenedItems[activeContainer][activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n\n // not deep cloning here would break data-table\n const newFlattenedData = cloneDeep(flattenedItems);\n\n if (isOverContainerOfContainer) {\n if (newFlattenedData[overContainer].length === 0) {\n newFlattenedData[overContainer][0] = { ...flattenedItems[activeContainer][activeIndex] };\n } else {\n newFlattenedData[overContainer].push({ ...flattenedItems[activeContainer][activeIndex] });\n }\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else if (activeContainer !== overContainer) {\n newFlattenedData[overContainer].splice(overIndex, 0, newFlattenedData[activeContainer][activeIndex]);\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else {\n newFlattenedData[activeContainer] = arrayMove(flattenedItems[activeContainer], activeIndex, overIndex);\n }\n\n onReorder(flattenedItems[activeContainer][activeIndex], overIndex, {\n over: flattenedItems[activeContainer][overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n overContainer,\n projectedMove: projected,\n });\n }\n },\n [\n handlePreviewDragEnd,\n isDropValid,\n containersRef,\n flattenedItemsDictionary,\n flattenedItems,\n dropIndicatorPosition,\n projected,\n onReorder,\n ],\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,sBAA0B;AAC1B,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { arrayMove } from '@dnd-kit/sortable';\nimport { cloneDeep } from 'lodash-es';\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 flattenedItemsDictionary,\n containersRef,\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 if (over.id === active.id) return;\n\n const isOverContainerOfContainer = containersRef.current.includes(over.id);\n const overContainer = isOverContainerOfContainer\n ? over.id\n : flattenedItemsDictionary[over.id]?.container || 'root';\n const activeContainer = flattenedItemsDictionary[active.id].container || 'root';\n\n const activeIndex = flattenedItems[activeContainer].findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems[overContainer].findIndex((item) => item.uid === over.id);\n const isUp = overIndex < activeIndex;\n\n if (dropIndicatorPosition === 'after' && (isUp || activeContainer !== overContainer)) overIndex += 1;\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && !isOverContainerOfContainer) {\n considerExpanding = over.id;\n overIndex =\n flattenedItems[overContainer][overIndex].realIndex +\n flattenedItems[overContainer][overIndex].childrenCount +\n 1;\n }\n\n // If we are dropping the item in a new position, or new depth or new container\n if (\n projected &&\n (activeIndex !== overIndex ||\n flattenedItems[activeContainer][activeIndex].depth !== projected.depth ||\n activeContainer !== overContainer)\n ) {\n // Change parent and depth from projected data\n flattenedItems[activeContainer][activeIndex].parentId = projected.parentId;\n flattenedItems[activeContainer][activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n\n // not deep cloning here would break data-table\n const newFlattenedData = cloneDeep(flattenedItems);\n\n if (isOverContainerOfContainer) {\n if (newFlattenedData[overContainer].length === 0) {\n newFlattenedData[overContainer][0] = { ...flattenedItems[activeContainer][activeIndex] };\n } else {\n newFlattenedData[overContainer].push({ ...flattenedItems[activeContainer][activeIndex] });\n }\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else if (activeContainer !== overContainer) {\n newFlattenedData[overContainer].splice(overIndex, 0, newFlattenedData[activeContainer][activeIndex]);\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else {\n newFlattenedData[activeContainer] = arrayMove(flattenedItems[activeContainer], activeIndex, overIndex);\n }\n\n onReorder(flattenedItems[activeContainer][activeIndex], overIndex, {\n over: flattenedItems[activeContainer][overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n overContainer,\n projectedMove: projected,\n });\n }\n },\n [\n handlePreviewDragEnd,\n isDropValid,\n containersRef,\n flattenedItemsDictionary,\n flattenedItems,\n dropIndicatorPosition,\n projected,\n onReorder,\n ],\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,sBAA0B;AAC1B,uBAA0B;AAC1B,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nB,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 { arrayMove } from "@dnd-kit/sortable";
|
|
3
|
-
import { cloneDeep } from "lodash";
|
|
3
|
+
import { cloneDeep } from "lodash-es";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
import { DropIndicatorPosition } from "./constants.js";
|
|
6
6
|
const useTreeActionHandlers = ({
|
|
@@ -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", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { 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 flattenedItemsDictionary,\n containersRef,\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 if (over.id === active.id) return;\n\n const isOverContainerOfContainer = containersRef.current.includes(over.id);\n const overContainer = isOverContainerOfContainer\n ? over.id\n : flattenedItemsDictionary[over.id]?.container || 'root';\n const activeContainer = flattenedItemsDictionary[active.id].container || 'root';\n\n const activeIndex = flattenedItems[activeContainer].findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems[overContainer].findIndex((item) => item.uid === over.id);\n const isUp = overIndex < activeIndex;\n\n if (dropIndicatorPosition === 'after' && (isUp || activeContainer !== overContainer)) overIndex += 1;\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && !isOverContainerOfContainer) {\n considerExpanding = over.id;\n overIndex =\n flattenedItems[overContainer][overIndex].realIndex +\n flattenedItems[overContainer][overIndex].childrenCount +\n 1;\n }\n\n // If we are dropping the item in a new position, or new depth or new container\n if (\n projected &&\n (activeIndex !== overIndex ||\n flattenedItems[activeContainer][activeIndex].depth !== projected.depth ||\n activeContainer !== overContainer)\n ) {\n // Change parent and depth from projected data\n flattenedItems[activeContainer][activeIndex].parentId = projected.parentId;\n flattenedItems[activeContainer][activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n\n // not deep cloning here would break data-table\n const newFlattenedData = cloneDeep(flattenedItems);\n\n if (isOverContainerOfContainer) {\n if (newFlattenedData[overContainer].length === 0) {\n newFlattenedData[overContainer][0] = { ...flattenedItems[activeContainer][activeIndex] };\n } else {\n newFlattenedData[overContainer].push({ ...flattenedItems[activeContainer][activeIndex] });\n }\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else if (activeContainer !== overContainer) {\n newFlattenedData[overContainer].splice(overIndex, 0, newFlattenedData[activeContainer][activeIndex]);\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else {\n newFlattenedData[activeContainer] = arrayMove(flattenedItems[activeContainer], activeIndex, overIndex);\n }\n\n onReorder(flattenedItems[activeContainer][activeIndex], overIndex, {\n over: flattenedItems[activeContainer][overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n overContainer,\n projectedMove: projected,\n });\n }\n },\n [\n handlePreviewDragEnd,\n isDropValid,\n containersRef,\n flattenedItemsDictionary,\n flattenedItems,\n dropIndicatorPosition,\n projected,\n onReorder,\n ],\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"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { arrayMove } from '@dnd-kit/sortable';\nimport { cloneDeep } from 'lodash-es';\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 flattenedItemsDictionary,\n containersRef,\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 if (over.id === active.id) return;\n\n const isOverContainerOfContainer = containersRef.current.includes(over.id);\n const overContainer = isOverContainerOfContainer\n ? over.id\n : flattenedItemsDictionary[over.id]?.container || 'root';\n const activeContainer = flattenedItemsDictionary[active.id].container || 'root';\n\n const activeIndex = flattenedItems[activeContainer].findIndex((item) => item.uid === active.id);\n\n let considerExpanding = null;\n\n let overIndex = flattenedItems[overContainer].findIndex((item) => item.uid === over.id);\n const isUp = overIndex < activeIndex;\n\n if (dropIndicatorPosition === 'after' && (isUp || activeContainer !== overContainer)) overIndex += 1;\n // If drop indicator is inside, then put it last,\n // It will be reconstructed well later\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && !isOverContainerOfContainer) {\n considerExpanding = over.id;\n overIndex =\n flattenedItems[overContainer][overIndex].realIndex +\n flattenedItems[overContainer][overIndex].childrenCount +\n 1;\n }\n\n // If we are dropping the item in a new position, or new depth or new container\n if (\n projected &&\n (activeIndex !== overIndex ||\n flattenedItems[activeContainer][activeIndex].depth !== projected.depth ||\n activeContainer !== overContainer)\n ) {\n // Change parent and depth from projected data\n flattenedItems[activeContainer][activeIndex].parentId = projected.parentId;\n flattenedItems[activeContainer][activeIndex].depth = projected.depth;\n\n // If same index, don't move the array, just copy it\n\n // not deep cloning here would break data-table\n const newFlattenedData = cloneDeep(flattenedItems);\n\n if (isOverContainerOfContainer) {\n if (newFlattenedData[overContainer].length === 0) {\n newFlattenedData[overContainer][0] = { ...flattenedItems[activeContainer][activeIndex] };\n } else {\n newFlattenedData[overContainer].push({ ...flattenedItems[activeContainer][activeIndex] });\n }\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else if (activeContainer !== overContainer) {\n newFlattenedData[overContainer].splice(overIndex, 0, newFlattenedData[activeContainer][activeIndex]);\n newFlattenedData[activeContainer].splice(activeIndex, 1);\n } else {\n newFlattenedData[activeContainer] = arrayMove(flattenedItems[activeContainer], activeIndex, overIndex);\n }\n\n onReorder(flattenedItems[activeContainer][activeIndex], overIndex, {\n over: flattenedItems[activeContainer][overIndex],\n fromIndex: activeIndex,\n considerExpanding: considerExpanding,\n movedData: newFlattenedData,\n flattenedItems,\n overContainer,\n projectedMove: projected,\n });\n }\n },\n [\n handlePreviewDragEnd,\n isDropValid,\n containersRef,\n flattenedItemsDictionary,\n flattenedItems,\n dropIndicatorPosition,\n projected,\n onReorder,\n ],\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
5
|
"mappings": "AAAA,YAAY,WAAW;ACEvB,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;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,2B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Ae,EAAE,OAAO,aAAa,CAAC;AAAA,QACzD,WAAW,oBAAoB,eAAe;AAC5C,2BAAiB,aAAa,EAAE,OAAO,WAAW,GAAG,iBAAiB,eAAe,EAAE,WAAW,CAAC;AACnG,2BAAiB,eAAe,EAAE,OAAO,aAAa,CAAC;AAAA,QACzD,OAAO;AACL,2BAAiB,eAAe,IAAI,UAAU,eAAe,eAAe,GAAG,aAAa,SAAS;AAAA,QACvG;AAEA,kBAAU,eAAe,eAAe,EAAE,WAAW,GAAG,WAAW;AAAA,UACjE,MAAM,eAAe,eAAe,EAAE,SAAS;AAAA,UAC/C,WAAW;AAAA,UACX;AAAA,UACA,WAAW;AAAA,UACX;AAAA,UACA;AAAA,UACA,eAAe;AAAA,QACjB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-drag-and-drop",
|
|
3
|
-
"version": "3.52.
|
|
3
|
+
"version": "3.52.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Drag And Drop",
|
|
6
6
|
"files": [
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"@dnd-kit/core": "~6.0.8",
|
|
40
40
|
"@dnd-kit/modifiers": "~6.0.1",
|
|
41
41
|
"@dnd-kit/sortable": "~7.0.2",
|
|
42
|
-
"@elliemae/ds-fast-list": "3.52.
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-
|
|
46
|
-
"@elliemae/ds-
|
|
42
|
+
"@elliemae/ds-fast-list": "3.52.1",
|
|
43
|
+
"@elliemae/ds-system": "3.52.1",
|
|
44
|
+
"@elliemae/ds-props-helpers": "3.52.1",
|
|
45
|
+
"@elliemae/ds-tree-model": "3.52.1",
|
|
46
|
+
"@elliemae/ds-typescript-helpers": "3.52.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@elliemae/pui-cli": "9.0.0-next.
|
|
49
|
+
"@elliemae/pui-cli": "9.0.0-next.63",
|
|
50
50
|
"jest": "~29.7.0",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.52.
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.52.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"lodash": "^4.17.21",
|
|
55
|
+
"lodash-es": "^4.17.21",
|
|
56
56
|
"react": "^18.3.1",
|
|
57
57
|
"react-dom": "^18.3.1",
|
|
58
58
|
"styled-components": "~5.3.9"
|