@elliemae/ds-drag-and-drop 3.55.0-next.9 → 3.55.2
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/parts/DSDropIndicator/typescript-testing/typescript-dialog-valid.js.map +2 -2
- package/dist/cjs/tree/useTreeActionHandlers.js.map +1 -1
- package/dist/cjs/tree/useTreeDndkitConfig.js +1 -2
- package/dist/cjs/tree/useTreeDndkitConfig.js.map +2 -2
- package/dist/cjs/tree/utilities.js.map +2 -2
- package/dist/esm/parts/DSDropIndicator/typescript-testing/typescript-dialog-valid.js.map +2 -2
- package/dist/esm/tree/useTreeActionHandlers.js.map +1 -1
- package/dist/esm/tree/useTreeDndkitConfig.js +1 -2
- package/dist/esm/tree/useTreeDndkitConfig.js.map +2 -2
- package/dist/esm/tree/utilities.js.map +2 -2
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSDropIndicator/typescript-testing/typescript-dialog-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DropIndicator } from '../index.js';\nimport type { DSDropIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\n\ntype ComponentPropsForApp = DSDropIndicatorT.Props;\ntype ComponentPropsInternals = DSDropIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSDropIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSDropIndicatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSDropIndicatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n isLast: true,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n isDropValid: true,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DropIndicator {...testExplicitDefinition} />\n <DropIndicator {...testInferedTypeCompatibility} />\n <DropIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DropIndicator vertical dropIndicatorPosition=\"before\" isDropValid isLast={false} />\n </>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACoFrB;AAnFF,eAA8B;AAW9B,MAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AACf;AAEA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,aAAa;AACf;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,0BAAe,GAAG,wBAAwB;AAAA,EAC3C,4CAAC,0BAAe,GAAG,8BAA8B;AAAA,EACjD,4CAAC,0BAAe,GAAG,uBAAuB;AAAA,EAE1C,4CAAC,0BAAc,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DropIndicator } from '../index.js';\nimport type { DSDropIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\n\ntype ComponentPropsForApp = DSDropIndicatorT.Props;\ntype ComponentPropsInternals = DSDropIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSDropIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSDropIndicatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSDropIndicatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n isLast: true,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n isDropValid: true,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DropIndicator {...testExplicitDefinition} />\n <DropIndicator {...testInferedTypeCompatibility} />\n <DropIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DropIndicator vertical={true} dropIndicatorPosition=\"before\" isDropValid={true} isLast={false} />\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACoFrB;AAnFF,eAA8B;AAW9B,MAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AACf;AAEA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,aAAa;AACf;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,0BAAe,GAAG,wBAAwB;AAAA,EAC3C,4CAAC,0BAAe,GAAG,8BAA8B;AAAA,EACjD,4CAAC,0BAAe,GAAG,uBAAuB;AAAA,EAE1C,4CAAC,0BAAc,UAAU,MAAM,uBAAsB,UAAS,aAAa,MAAM,QAAQ,OAAO;AAAA,GAClG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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-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,\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"],
|
|
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
5
|
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -47,8 +47,7 @@ const useTreeDndkitConfig = ({
|
|
|
47
47
|
return {
|
|
48
48
|
root: flattenedItemsProp
|
|
49
49
|
};
|
|
50
|
-
}
|
|
51
|
-
return flattenedItemsProp;
|
|
50
|
+
} else return flattenedItemsProp;
|
|
52
51
|
}, [flattenedItemsProp]);
|
|
53
52
|
return (0, import_useMultiTreeDndkitConfig.useMultiTreeDndkitConfig)({
|
|
54
53
|
flattenedItems,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tree/useTreeDndkitConfig.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo } from 'react';\nimport { useMultiTreeDndkitConfig } from './useMultiTreeDndkitConfig.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems: flattenedItemsProp,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const flattenedItems: Record<string, DnDKitTree.Item<T>[]> = useMemo(() => {\n if (Array.isArray(flattenedItemsProp)) {\n return {\n root: flattenedItemsProp,\n } as Record<string, DnDKitTree.Item<T>[]>;\n }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AACxB,sCAAyC;AAGlC,MAAM,sBAAsB,CAAK;AAAA,EACtC,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB,MAAM;AAAA,EACvB,sBAAsB;AACxB,MAA0E;AACxE,QAAM,qBAAuD,sBAAQ,MAAM;AACzE,QAAI,MAAM,QAAQ,kBAAkB,GAAG;AACrC,aAAO;AAAA,QACL,MAAM;AAAA,MACR;AAAA,IACF
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo } from 'react';\nimport { useMultiTreeDndkitConfig } from './useMultiTreeDndkitConfig.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems: flattenedItemsProp,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const flattenedItems: Record<string, DnDKitTree.Item<T>[]> = useMemo(() => {\n if (Array.isArray(flattenedItemsProp)) {\n return {\n root: flattenedItemsProp,\n } as Record<string, DnDKitTree.Item<T>[]>;\n } else return flattenedItemsProp;\n }, [flattenedItemsProp]);\n\n return useMultiTreeDndkitConfig({\n flattenedItems,\n onReorder,\n isHorizontalDnD,\n isExpandable,\n getIsDropValid,\n maxDragAndDropLevel,\n });\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AACxB,sCAAyC;AAGlC,MAAM,sBAAsB,CAAK;AAAA,EACtC,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB,MAAM;AAAA,EACvB,sBAAsB;AACxB,MAA0E;AACxE,QAAM,qBAAuD,sBAAQ,MAAM;AACzE,QAAI,MAAM,QAAQ,kBAAkB,GAAG;AACrC,aAAO;AAAA,QACL,MAAM;AAAA,MACR;AAAA,IACF,MAAO,QAAO;AAAA,EAChB,GAAG,CAAC,kBAAkB,CAAC;AAEvB,aAAO,0DAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tree/utilities.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\nimport type { Over, Active, 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 visibleItems: Record<string, DnDKitTree.Item<T>[]>,\n itemsDictonary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues,\n isExpandable: boolean,\n active: Active,\n): { depth: number; parentId: UniqueIdentifier | null; position?: number } | null => {\n if (!itemsDictonary[over.id]) {\n return { depth: 0, parentId: null };\n }\n\n const overElement = itemsDictonary[over.id];\n const overContainer = itemsDictonary[over.id].container || 'root';\n const activeElement = itemsDictonary[active.id];\n const activeContainer = itemsDictonary[active.id].container || 'root';\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return null;\n }\n\n const visibleItemsByContainer = visibleItems[overContainer];\n\n const overIndex = visibleItemsByContainer.findIndex((item) => item.uid === over.id);\n\n const previousItem = visibleItemsByContainer[overIndex];\n const nextItem = visibleItemsByContainer[overIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: itemsDictonary[over.id].depth + 1,\n parentId: over.id,\n position: over.id === activeElement.parentId ? 0 :
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,uBAAsC;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI,KAAM,QAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,cACA,gBACA,MACA,uBACA,cACA,WACmF;AACnF,MAAI,CAAC,eAAe,KAAK,EAAE,GAAG;AAC5B,WAAO,EAAE,OAAO,GAAG,UAAU,KAAK;AAAA,EACpC;AAEA,QAAM,cAAc,eAAe,KAAK,EAAE;AAC1C,QAAM,gBAAgB,eAAe,KAAK,EAAE,EAAE,aAAa;AAC3D,QAAM,gBAAgB,eAAe,OAAO,EAAE;AAC9C,QAAM,kBAAkB,eAAe,OAAO,EAAE,EAAE,aAAa;AAC/D,MAAI,0BAA0B,uCAAsB,MAAM;AACxD,WAAO;AAAA,EACT;AAEA,QAAM,0BAA0B,aAAa,aAAa;AAE1D,QAAM,YAAY,wBAAwB,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAElF,QAAM,eAAe,wBAAwB,SAAS;AACtD,QAAM,WAAW,wBAAwB,YAAY,CAAC;AAEtD,MAAI,0BAA0B,uCAAsB,UAAU,cAAc;AAC1E,WAAO;AAAA,MACL,OAAO,eAAe,KAAK,EAAE,EAAE,QAAQ;AAAA,MACvC,UAAU,KAAK;AAAA,MACf,UAAU,KAAK,OAAO,cAAc,WAAW,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\nimport type { Over, Active, 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 visibleItems: Record<string, DnDKitTree.Item<T>[]>,\n itemsDictonary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues,\n isExpandable: boolean,\n active: Active,\n): { depth: number; parentId: UniqueIdentifier | null; position?: number } | null => {\n if (!itemsDictonary[over.id]) {\n return { depth: 0, parentId: null };\n }\n\n const overElement = itemsDictonary[over.id];\n const overContainer = itemsDictonary[over.id].container || 'root';\n const activeElement = itemsDictonary[active.id];\n const activeContainer = itemsDictonary[active.id].container || 'root';\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return null;\n }\n\n const visibleItemsByContainer = visibleItems[overContainer];\n\n const overIndex = visibleItemsByContainer.findIndex((item) => item.uid === over.id);\n\n const previousItem = visibleItemsByContainer[overIndex];\n const nextItem = visibleItemsByContainer[overIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: itemsDictonary[over.id].depth + 1,\n parentId: over.id,\n position: over.id === activeElement.parentId ? 0 : previousItem?.childrenCount ?? 0,\n };\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return { depth: getMinDepth(previousItem), parentId: previousItem.parentId, position: 0 };\n }\n\n const isUp = previousItem?.realIndex < activeElement.realIndex;\n let position =\n nextItem === undefined || (activeContainer === overContainer && !isUp) ? previousItem?.index : nextItem.index;\n\n if (\n (activeContainer !== overContainer || activeElement.parentId !== overElement.parentId) &&\n nextItem === undefined\n ) {\n position += 1;\n }\n\n return { depth: getMinDepth(nextItem), parentId: nextItem?.parentId, position };\n};\n\nexport const removeChildrenOf = <T, S extends Pick<DnDKitTree.Item<T>, 'uid' | 'parentId'>>(\n items: S[],\n id: UniqueIdentifier | null | undefined,\n): S[] => {\n if (id === null || id === undefined) return items;\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,uBAAsC;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI,KAAM,QAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,cACA,gBACA,MACA,uBACA,cACA,WACmF;AACnF,MAAI,CAAC,eAAe,KAAK,EAAE,GAAG;AAC5B,WAAO,EAAE,OAAO,GAAG,UAAU,KAAK;AAAA,EACpC;AAEA,QAAM,cAAc,eAAe,KAAK,EAAE;AAC1C,QAAM,gBAAgB,eAAe,KAAK,EAAE,EAAE,aAAa;AAC3D,QAAM,gBAAgB,eAAe,OAAO,EAAE;AAC9C,QAAM,kBAAkB,eAAe,OAAO,EAAE,EAAE,aAAa;AAC/D,MAAI,0BAA0B,uCAAsB,MAAM;AACxD,WAAO;AAAA,EACT;AAEA,QAAM,0BAA0B,aAAa,aAAa;AAE1D,QAAM,YAAY,wBAAwB,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAElF,QAAM,eAAe,wBAAwB,SAAS;AACtD,QAAM,WAAW,wBAAwB,YAAY,CAAC;AAEtD,MAAI,0BAA0B,uCAAsB,UAAU,cAAc;AAC1E,WAAO;AAAA,MACL,OAAO,eAAe,KAAK,EAAE,EAAE,QAAQ;AAAA,MACvC,UAAU,KAAK;AAAA,MACf,UAAU,KAAK,OAAO,cAAc,WAAW,IAAI,cAAc,iBAAiB;AAAA,IACpF;AAAA,EACF;AACA,MAAI,0BAA0B,uCAAsB,QAAQ;AAC1D,WAAO,EAAE,OAAO,YAAY,YAAY,GAAG,UAAU,aAAa,UAAU,UAAU,EAAE;AAAA,EAC1F;AAEA,QAAM,OAAO,cAAc,YAAY,cAAc;AACrD,MAAI,WACF,aAAa,UAAc,oBAAoB,iBAAiB,CAAC,OAAQ,cAAc,QAAQ,SAAS;AAE1G,OACG,oBAAoB,iBAAiB,cAAc,aAAa,YAAY,aAC7E,aAAa,QACb;AACA,gBAAY;AAAA,EACd;AAEA,SAAO,EAAE,OAAO,YAAY,QAAQ,GAAG,UAAU,UAAU,UAAU,SAAS;AAChF;AAEO,MAAM,mBAAmB,CAC9B,OACA,OACQ;AACR,MAAI,OAAO,QAAQ,OAAO,OAAW,QAAO;AAC5C,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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSDropIndicator/typescript-testing/typescript-dialog-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DropIndicator } from '../index.js';\nimport type { DSDropIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\n\ntype ComponentPropsForApp = DSDropIndicatorT.Props;\ntype ComponentPropsInternals = DSDropIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSDropIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSDropIndicatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSDropIndicatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n isLast: true,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n isDropValid: true,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DropIndicator {...testExplicitDefinition} />\n <DropIndicator {...testInferedTypeCompatibility} />\n <DropIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DropIndicator vertical dropIndicatorPosition=\"before\" isDropValid isLast={false} />\n </>\n);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACoFrB,mBAEE,KAFF;AAnFF,SAAS,qBAAqB;AAW9B,MAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AACf;AAEA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,aAAa;AACf;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,iBAAe,GAAG,wBAAwB;AAAA,EAC3C,oBAAC,iBAAe,GAAG,8BAA8B;AAAA,EACjD,oBAAC,iBAAe,GAAG,uBAAuB;AAAA,EAE1C,oBAAC,iBAAc,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DropIndicator } from '../index.js';\nimport type { DSDropIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\n\ntype ComponentPropsForApp = DSDropIndicatorT.Props;\ntype ComponentPropsInternals = DSDropIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSDropIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSDropIndicatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSDropIndicatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n isLast: true,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n isDropValid: true,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n vertical: true,\n dropIndicatorPosition: 'before',\n isDropValid: true,\n isLast: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DropIndicator {...testExplicitDefinition} />\n <DropIndicator {...testInferedTypeCompatibility} />\n <DropIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DropIndicator vertical={true} dropIndicatorPosition=\"before\" isDropValid={true} isLast={false} />\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoFrB,mBAEE,KAFF;AAnFF,SAAS,qBAAqB;AAW9B,MAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AACf;AAEA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AACV;AAIA,MAAM,sBAA2D;AAAA,EAC/D,aAAa;AACf;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,MAAM,+BAA+B;AAAA,EACnC,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,iBAAe,GAAG,wBAAwB;AAAA,EAC3C,oBAAC,iBAAe,GAAG,8BAA8B;AAAA,EACjD,oBAAC,iBAAe,GAAG,uBAAuB;AAAA,EAE1C,oBAAC,iBAAc,UAAU,MAAM,uBAAsB,UAAS,aAAa,MAAM,QAAQ,OAAO;AAAA,GAClG;",
|
|
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/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-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,\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": "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",
|
|
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/useTreeDndkitConfig.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo } from 'react';\nimport { useMultiTreeDndkitConfig } from './useMultiTreeDndkitConfig.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems: flattenedItemsProp,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const flattenedItems: Record<string, DnDKitTree.Item<T>[]> = useMemo(() => {\n if (Array.isArray(flattenedItemsProp)) {\n return {\n root: flattenedItemsProp,\n } as Record<string, DnDKitTree.Item<T>[]>;\n }
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,eAAe;AACxB,SAAS,gCAAgC;AAGlC,MAAM,sBAAsB,CAAK;AAAA,EACtC,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB,MAAM;AAAA,EACvB,sBAAsB;AACxB,MAA0E;AACxE,QAAM,iBAAuD,QAAQ,MAAM;AACzE,QAAI,MAAM,QAAQ,kBAAkB,GAAG;AACrC,aAAO;AAAA,QACL,MAAM;AAAA,MACR;AAAA,IACF
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useMemo } from 'react';\nimport { useMultiTreeDndkitConfig } from './useMultiTreeDndkitConfig.js';\nimport type { DnDKitTree } from './types.js';\n\nexport const useTreeDndkitConfig = <T,>({\n flattenedItems: flattenedItemsProp,\n onReorder,\n isHorizontalDnD = false,\n isExpandable = false,\n getIsDropValid = () => true,\n maxDragAndDropLevel = Infinity,\n}: DnDKitTree.UseTreeConfigArgs<T>): DnDKitTree.UseTreeConfigReturn<T> => {\n const flattenedItems: Record<string, DnDKitTree.Item<T>[]> = useMemo(() => {\n if (Array.isArray(flattenedItemsProp)) {\n return {\n root: flattenedItemsProp,\n } as Record<string, DnDKitTree.Item<T>[]>;\n } else return flattenedItemsProp;\n }, [flattenedItemsProp]);\n\n return useMultiTreeDndkitConfig({\n flattenedItems,\n onReorder,\n isHorizontalDnD,\n isExpandable,\n getIsDropValid,\n maxDragAndDropLevel,\n });\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,eAAe;AACxB,SAAS,gCAAgC;AAGlC,MAAM,sBAAsB,CAAK;AAAA,EACtC,gBAAgB;AAAA,EAChB;AAAA,EACA,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB,MAAM;AAAA,EACvB,sBAAsB;AACxB,MAA0E;AACxE,QAAM,iBAAuD,QAAQ,MAAM;AACzE,QAAI,MAAM,QAAQ,kBAAkB,GAAG;AACrC,aAAO;AAAA,QACL,MAAM;AAAA,MACR;AAAA,IACF,MAAO,QAAO;AAAA,EAChB,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
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-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\nimport type { Over, Active, 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 visibleItems: Record<string, DnDKitTree.Item<T>[]>,\n itemsDictonary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues,\n isExpandable: boolean,\n active: Active,\n): { depth: number; parentId: UniqueIdentifier | null; position?: number } | null => {\n if (!itemsDictonary[over.id]) {\n return { depth: 0, parentId: null };\n }\n\n const overElement = itemsDictonary[over.id];\n const overContainer = itemsDictonary[over.id].container || 'root';\n const activeElement = itemsDictonary[active.id];\n const activeContainer = itemsDictonary[active.id].container || 'root';\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return null;\n }\n\n const visibleItemsByContainer = visibleItems[overContainer];\n\n const overIndex = visibleItemsByContainer.findIndex((item) => item.uid === over.id);\n\n const previousItem = visibleItemsByContainer[overIndex];\n const nextItem = visibleItemsByContainer[overIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: itemsDictonary[over.id].depth + 1,\n parentId: over.id,\n position: over.id === activeElement.parentId ? 0 :
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,6BAA6B;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI,KAAM,QAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,cACA,gBACA,MACA,uBACA,cACA,WACmF;AACnF,MAAI,CAAC,eAAe,KAAK,EAAE,GAAG;AAC5B,WAAO,EAAE,OAAO,GAAG,UAAU,KAAK;AAAA,EACpC;AAEA,QAAM,cAAc,eAAe,KAAK,EAAE;AAC1C,QAAM,gBAAgB,eAAe,KAAK,EAAE,EAAE,aAAa;AAC3D,QAAM,gBAAgB,eAAe,OAAO,EAAE;AAC9C,QAAM,kBAAkB,eAAe,OAAO,EAAE,EAAE,aAAa;AAC/D,MAAI,0BAA0B,sBAAsB,MAAM;AACxD,WAAO;AAAA,EACT;AAEA,QAAM,0BAA0B,aAAa,aAAa;AAE1D,QAAM,YAAY,wBAAwB,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAElF,QAAM,eAAe,wBAAwB,SAAS;AACtD,QAAM,WAAW,wBAAwB,YAAY,CAAC;AAEtD,MAAI,0BAA0B,sBAAsB,UAAU,cAAc;AAC1E,WAAO;AAAA,MACL,OAAO,eAAe,KAAK,EAAE,EAAE,QAAQ;AAAA,MACvC,UAAU,KAAK;AAAA,MACf,UAAU,KAAK,OAAO,cAAc,WAAW,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\nimport type { Over, Active, 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 visibleItems: Record<string, DnDKitTree.Item<T>[]>,\n itemsDictonary: Record<UniqueIdentifier, DnDKitTree.Item<T>>,\n over: Over,\n dropIndicatorPosition: DnDKitTree.DropIndicatorPositionValues,\n isExpandable: boolean,\n active: Active,\n): { depth: number; parentId: UniqueIdentifier | null; position?: number } | null => {\n if (!itemsDictonary[over.id]) {\n return { depth: 0, parentId: null };\n }\n\n const overElement = itemsDictonary[over.id];\n const overContainer = itemsDictonary[over.id].container || 'root';\n const activeElement = itemsDictonary[active.id];\n const activeContainer = itemsDictonary[active.id].container || 'root';\n if (dropIndicatorPosition === DropIndicatorPosition.None) {\n return null;\n }\n\n const visibleItemsByContainer = visibleItems[overContainer];\n\n const overIndex = visibleItemsByContainer.findIndex((item) => item.uid === over.id);\n\n const previousItem = visibleItemsByContainer[overIndex];\n const nextItem = visibleItemsByContainer[overIndex + 1];\n\n if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {\n return {\n depth: itemsDictonary[over.id].depth + 1,\n parentId: over.id,\n position: over.id === activeElement.parentId ? 0 : previousItem?.childrenCount ?? 0,\n };\n }\n if (dropIndicatorPosition === DropIndicatorPosition.Before) {\n return { depth: getMinDepth(previousItem), parentId: previousItem.parentId, position: 0 };\n }\n\n const isUp = previousItem?.realIndex < activeElement.realIndex;\n let position =\n nextItem === undefined || (activeContainer === overContainer && !isUp) ? previousItem?.index : nextItem.index;\n\n if (\n (activeContainer !== overContainer || activeElement.parentId !== overElement.parentId) &&\n nextItem === undefined\n ) {\n position += 1;\n }\n\n return { depth: getMinDepth(nextItem), parentId: nextItem?.parentId, position };\n};\n\nexport const removeChildrenOf = <T, S extends Pick<DnDKitTree.Item<T>, 'uid' | 'parentId'>>(\n items: S[],\n id: UniqueIdentifier | null | undefined,\n): S[] => {\n if (id === null || id === undefined) return items;\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;ACIvB,SAAS,6BAA6B;AAGtC,MAAM,cAAc,CAAK,SAA6B;AACpD,MAAI,KAAM,QAAO,KAAK;AACtB,SAAO;AACT;AAEO,MAAM,gBAAgB,CAC3B,cACA,gBACA,MACA,uBACA,cACA,WACmF;AACnF,MAAI,CAAC,eAAe,KAAK,EAAE,GAAG;AAC5B,WAAO,EAAE,OAAO,GAAG,UAAU,KAAK;AAAA,EACpC;AAEA,QAAM,cAAc,eAAe,KAAK,EAAE;AAC1C,QAAM,gBAAgB,eAAe,KAAK,EAAE,EAAE,aAAa;AAC3D,QAAM,gBAAgB,eAAe,OAAO,EAAE;AAC9C,QAAM,kBAAkB,eAAe,OAAO,EAAE,EAAE,aAAa;AAC/D,MAAI,0BAA0B,sBAAsB,MAAM;AACxD,WAAO;AAAA,EACT;AAEA,QAAM,0BAA0B,aAAa,aAAa;AAE1D,QAAM,YAAY,wBAAwB,UAAU,CAAC,SAAS,KAAK,QAAQ,KAAK,EAAE;AAElF,QAAM,eAAe,wBAAwB,SAAS;AACtD,QAAM,WAAW,wBAAwB,YAAY,CAAC;AAEtD,MAAI,0BAA0B,sBAAsB,UAAU,cAAc;AAC1E,WAAO;AAAA,MACL,OAAO,eAAe,KAAK,EAAE,EAAE,QAAQ;AAAA,MACvC,UAAU,KAAK;AAAA,MACf,UAAU,KAAK,OAAO,cAAc,WAAW,IAAI,cAAc,iBAAiB;AAAA,IACpF;AAAA,EACF;AACA,MAAI,0BAA0B,sBAAsB,QAAQ;AAC1D,WAAO,EAAE,OAAO,YAAY,YAAY,GAAG,UAAU,aAAa,UAAU,UAAU,EAAE;AAAA,EAC1F;AAEA,QAAM,OAAO,cAAc,YAAY,cAAc;AACrD,MAAI,WACF,aAAa,UAAc,oBAAoB,iBAAiB,CAAC,OAAQ,cAAc,QAAQ,SAAS;AAE1G,OACG,oBAAoB,iBAAiB,cAAc,aAAa,YAAY,aAC7E,aAAa,QACb;AACA,gBAAY;AAAA,EACd;AAEA,SAAO,EAAE,OAAO,YAAY,QAAQ,GAAG,UAAU,UAAU,UAAU,SAAS;AAChF;AAEO,MAAM,mBAAmB,CAC9B,OACA,OACQ;AACR,MAAI,OAAO,QAAQ,OAAO,OAAW,QAAO;AAC5C,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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-drag-and-drop",
|
|
3
|
-
"version": "3.55.
|
|
3
|
+
"version": "3.55.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Drag And Drop",
|
|
6
6
|
"files": [
|
|
@@ -39,17 +39,17 @@
|
|
|
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-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-
|
|
46
|
-
"@elliemae/ds-
|
|
42
|
+
"@elliemae/ds-props-helpers": "3.55.2",
|
|
43
|
+
"@elliemae/ds-tree-model": "3.55.2",
|
|
44
|
+
"@elliemae/ds-typescript-helpers": "3.55.2",
|
|
45
|
+
"@elliemae/ds-fast-list": "3.55.2",
|
|
46
|
+
"@elliemae/ds-system": "3.55.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
50
50
|
"jest": "~29.7.0",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.55.
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.55.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"lodash-es": "^4.17.21",
|