@pega/cosmos-react-dnd 2.0.0-dev.2.1 → 2.0.0-dev.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/{DragDrop → DragDropList}/DragDropList.d.ts +1 -1
- package/lib/components/DragDropList/DragDropList.d.ts.map +1 -0
- package/lib/components/{DragDrop → DragDropList}/DragDropList.js +35 -34
- package/lib/components/DragDropList/DragDropList.js.map +1 -0
- package/lib/components/DragDropList/DragDropList.types.d.ts +34 -0
- package/lib/components/DragDropList/DragDropList.types.d.ts.map +1 -0
- package/lib/components/DragDropList/DragDropList.types.js +2 -0
- package/lib/components/DragDropList/DragDropList.types.js.map +1 -0
- package/lib/components/DragDropList/index.d.ts +3 -0
- package/lib/components/DragDropList/index.d.ts.map +1 -0
- package/lib/components/DragDropList/index.js +2 -0
- package/lib/components/DragDropList/index.js.map +1 -0
- package/lib/components/{DragDrop → DragDropManager}/DragDropManager.d.ts +0 -0
- package/lib/components/DragDropManager/DragDropManager.d.ts.map +1 -0
- package/lib/components/DragDropManager/DragDropManager.js +8 -0
- package/lib/components/DragDropManager/DragDropManager.js.map +1 -0
- package/lib/components/DragDropManager/index.d.ts +2 -0
- package/lib/components/DragDropManager/index.d.ts.map +1 -0
- package/lib/components/DragDropManager/index.js +2 -0
- package/lib/components/DragDropManager/index.js.map +1 -0
- package/lib/components/Draggable/Draggable.d.ts +28 -0
- package/lib/components/Draggable/Draggable.d.ts.map +1 -0
- package/lib/components/{DragDrop → Draggable}/Draggable.js +8 -8
- package/lib/components/Draggable/Draggable.js.map +1 -0
- package/lib/components/Draggable/index.d.ts +2 -0
- package/lib/components/Draggable/index.d.ts.map +1 -0
- package/lib/components/Draggable/index.js +2 -0
- package/lib/components/Draggable/index.js.map +1 -0
- package/lib/components/Droppable/Droppable.d.ts +23 -0
- package/lib/components/Droppable/Droppable.d.ts.map +1 -0
- package/lib/components/{DragDrop → Droppable}/Droppable.js +2 -2
- package/lib/components/Droppable/Droppable.js.map +1 -0
- package/lib/components/Droppable/index.d.ts +2 -0
- package/lib/components/Droppable/index.d.ts.map +1 -0
- package/lib/components/Droppable/index.js +2 -0
- package/lib/components/Droppable/index.js.map +1 -0
- package/lib/index.d.ts +8 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -1
- package/lib/index.js.map +1 -1
- package/package.json +16 -16
- package/lib/components/DragDrop/DragDrop.types.d.ts +0 -70
- package/lib/components/DragDrop/DragDrop.types.d.ts.map +0 -1
- package/lib/components/DragDrop/DragDrop.types.js +0 -2
- package/lib/components/DragDrop/DragDrop.types.js.map +0 -1
- package/lib/components/DragDrop/DragDropList.d.ts.map +0 -1
- package/lib/components/DragDrop/DragDropList.js.map +0 -1
- package/lib/components/DragDrop/DragDropManager.d.ts.map +0 -1
- package/lib/components/DragDrop/DragDropManager.js +0 -11
- package/lib/components/DragDrop/DragDropManager.js.map +0 -1
- package/lib/components/DragDrop/Draggable.d.ts +0 -5
- package/lib/components/DragDrop/Draggable.d.ts.map +0 -1
- package/lib/components/DragDrop/Draggable.js.map +0 -1
- package/lib/components/DragDrop/Droppable.d.ts +0 -5
- package/lib/components/DragDrop/Droppable.d.ts.map +0 -1
- package/lib/components/DragDrop/Droppable.js.map +0 -1
- package/lib/components/DragDrop/index.d.ts +0 -10
- package/lib/components/DragDrop/index.d.ts.map +0 -1
- package/lib/components/DragDrop/index.js +0 -5
- package/lib/components/DragDrop/index.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { DragDropListProps } from './
|
|
3
|
+
import { DragDropListProps } from './DragDropList.types';
|
|
4
4
|
declare const DragDropList: <T extends object = object>({ accept, items, itemRenderer: ItemRenderer, emptyRenderer: EmptyRenderer, onChange, pullMode, pushMode, as: Component, ...restProps }: DragDropListProps<T> & ForwardProps) => JSX.Element;
|
|
5
5
|
export default DragDropList;
|
|
6
6
|
//# sourceMappingURL=DragDropList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.tsx"],"names":[],"mappings":";AAGA,OAAO,EAIL,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAYzD,QAAA,MAAM,YAAY,yNA2NjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState, useRef } from 'react';
|
|
2
3
|
import { useElement, useAfterInitialEffect, useTriggerableLayoutEffect } from '@pega/cosmos-react-core';
|
|
3
|
-
import Draggable from '
|
|
4
|
-
import Droppable from '
|
|
4
|
+
import Draggable from '../Draggable';
|
|
5
|
+
import Droppable from '../Droppable';
|
|
5
6
|
const middleYOfRect = ({ top, bottom }) => top + (bottom - top) / 2;
|
|
6
7
|
const DragDropList = ({ accept, items, itemRenderer: ItemRenderer, emptyRenderer: EmptyRenderer, onChange, pullMode = 'remove', pushMode = 'insert', as: Component = 'ul', ...restProps }) => {
|
|
7
8
|
const [internalItems, setInternalItems] = useState(items);
|
|
@@ -57,12 +58,12 @@ const DragDropList = ({ accept, items, itemRenderer: ItemRenderer, emptyRenderer
|
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
return insertIndex;
|
|
60
|
-
}, [getItemRects, internalItems
|
|
61
|
+
}, [getItemRects, internalItems]);
|
|
61
62
|
const removeById = useCallback((itemId) => {
|
|
62
63
|
if (pullMode === 'remove') {
|
|
63
64
|
setInternalItems(currentItems => currentItems.filter(({ id }) => id !== itemId));
|
|
64
65
|
}
|
|
65
|
-
}, [
|
|
66
|
+
}, [pullMode]);
|
|
66
67
|
const normalizeItems = useCallback(() => {
|
|
67
68
|
setInternalItems(currentItems => currentItems.map(({ id, data, type }) => ({
|
|
68
69
|
id,
|
|
@@ -71,12 +72,11 @@ const DragDropList = ({ accept, items, itemRenderer: ItemRenderer, emptyRenderer
|
|
|
71
72
|
})));
|
|
72
73
|
}, []);
|
|
73
74
|
const positionItems = useCallback((item, monitor) => {
|
|
74
|
-
var _a;
|
|
75
75
|
if (!monitor.canDrop())
|
|
76
76
|
return;
|
|
77
77
|
const prevIndex = internalItems.findIndex(({ id }) => id === item.id);
|
|
78
78
|
if (prevIndex === -1) {
|
|
79
|
-
|
|
79
|
+
item.removeFromCurrent?.();
|
|
80
80
|
item.removeFromCurrent = () => {
|
|
81
81
|
removeById(item.id);
|
|
82
82
|
};
|
|
@@ -108,7 +108,7 @@ const DragDropList = ({ accept, items, itemRenderer: ItemRenderer, emptyRenderer
|
|
|
108
108
|
else
|
|
109
109
|
setInternalItems(newItems);
|
|
110
110
|
}
|
|
111
|
-
}, [pushMode, getInsertIndex,
|
|
111
|
+
}, [internalItems, pushMode, getInsertIndex, normalizeItems, triggerOnChange, removeById]);
|
|
112
112
|
const onHover = positionItems;
|
|
113
113
|
const onDrop = positionItems;
|
|
114
114
|
const onBegin = useCallback((itemId) => () => {
|
|
@@ -129,39 +129,40 @@ const DragDropList = ({ accept, items, itemRenderer: ItemRenderer, emptyRenderer
|
|
|
129
129
|
changeSource: triggerOnChange,
|
|
130
130
|
changeDestination: triggerOnChange
|
|
131
131
|
};
|
|
132
|
-
}, [
|
|
132
|
+
}, [internalItems, normalizeItems, triggerOnChange, removeById]);
|
|
133
133
|
const onEnd = useCallback((item, monitor) => {
|
|
134
|
-
|
|
134
|
+
if (!item)
|
|
135
|
+
return;
|
|
135
136
|
if (monitor.didDrop()) {
|
|
136
|
-
|
|
137
|
+
item.normalizeDestination?.();
|
|
137
138
|
if (item.changeSource !== item.changeDestination)
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
item.changeSource?.();
|
|
140
|
+
item.changeDestination?.();
|
|
140
141
|
}
|
|
141
142
|
else {
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
item.removeFromCurrent?.();
|
|
144
|
+
item.returnToSource?.(item);
|
|
144
145
|
}
|
|
145
146
|
}, []);
|
|
146
|
-
const emptyContent = EmptyRenderer ?
|
|
147
|
-
return (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
const emptyContent = EmptyRenderer ? _jsx(EmptyRenderer, {}, void 0) : null;
|
|
148
|
+
return (_jsx(Droppable, { accept: accept, onHover: onHover, onDrop: onDrop, children: ({ dropRef }) => {
|
|
149
|
+
return (_jsx(Component, { ref: (el) => {
|
|
150
|
+
dropRef(el);
|
|
151
|
+
setListEl(el);
|
|
152
|
+
}, ...restProps, children: internalItems.length === 0
|
|
153
|
+
? emptyContent
|
|
154
|
+
: internalItems.map(item => {
|
|
155
|
+
return (_jsx(Draggable, { id: item.id, type: item.type, data: item.data, onBegin: onBegin(item.id), onEnd: onEnd, children: ({ dragRef, previewRef, collected }) => {
|
|
156
|
+
return (_jsx(ItemRenderer, { ...{
|
|
157
|
+
...item,
|
|
158
|
+
dragRef,
|
|
159
|
+
previewRef,
|
|
160
|
+
...collected,
|
|
161
|
+
isDragging: collected.isDragging || !!item.removeFromCurrent
|
|
162
|
+
} }, void 0));
|
|
163
|
+
} }, item.id));
|
|
164
|
+
}) }, void 0));
|
|
165
|
+
} }, void 0));
|
|
165
166
|
};
|
|
166
167
|
export default DragDropList;
|
|
167
168
|
//# sourceMappingURL=DragDropList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.tsx"],"names":[],"mappings":";AAAA,OAAO,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AER,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,YAEX,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE;gCACtC,OAAO,CACL,KAAC,YAAY,OACP;wCACF,GAAG,IAAI;wCACP,OAAO;wCACP,UAAU;wCACV,GAAG,SAAS;wCACZ,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB;qCAC7D,WACD,CACH,CAAC;4BACJ,CAAC,IAnBI,IAAI,CAAC,EAAE,CAoBF,CACb,CAAC;oBACJ,CAAC,CAAC,WACI,CACb,CAAC;QACJ,CAAC,WACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useState, useRef } from 'react';\nimport { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';\n\nimport {\n useElement,\n useAfterInitialEffect,\n useTriggerableLayoutEffect,\n ForwardProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\n\nimport Draggable, { DraggableItem } from '../Draggable';\nimport Droppable from '../Droppable';\n\nimport { DragDropListProps } from './DragDropList.types';\n\ninterface DragDropListItem<T extends object = object> extends DraggableItem<T> {\n removeFromCurrent?: () => void;\n returnToSource?: (item: DraggableItem<T>) => void;\n normalizeDestination?: () => void;\n changeSource?: () => void;\n changeDestination?: () => void;\n}\n\nconst middleYOfRect = ({ top, bottom }: DOMRect): number => top + (bottom - top) / 2;\n\nconst DragDropList = <T extends object = object>({\n accept,\n items,\n itemRenderer: ItemRenderer,\n emptyRenderer: EmptyRenderer,\n onChange,\n pullMode = 'remove',\n pushMode = 'insert',\n as: Component = 'ul',\n ...restProps\n}: DragDropListProps<T> & ForwardProps) => {\n const [internalItems, setInternalItems] = useState<DragDropListItem<T>[]>(items);\n const itemRectsRef = useRef<DOMRect[] | null>(null);\n const [listEl, setListEl] = useElement<HTMLElement>();\n\n const getItemRects = useCallback((): DOMRect[] | null => {\n if (!listEl || listEl.children.length === 0) return null;\n return [...listEl.children].map(itemEl => {\n return itemEl.getBoundingClientRect();\n });\n }, [listEl]);\n\n useAfterInitialEffect(() => {\n setInternalItems(items);\n }, [items]);\n\n const triggerOnChange = useTriggerableLayoutEffect(\n useCallback(() => {\n onChange(internalItems);\n }, [onChange, internalItems])\n );\n\n const getInsertIndex = useCallback(\n (item: DraggableItem<T>, monitor: DropTargetMonitor | DragSourceMonitor): number => {\n itemRectsRef.current = getItemRects();\n const { current: itemRects } = itemRectsRef;\n let insertIndex = -1;\n const prevIndex = internalItems.findIndex(({ id }) => id === item.id);\n\n const clientXY = monitor.getClientOffset();\n if (!itemRects || !clientXY) return insertIndex;\n\n const dragPreviewRectTop = clientXY.y;\n const atHead = dragPreviewRectTop < middleYOfRect(itemRects[0]);\n const atTail = dragPreviewRectTop >= middleYOfRect(itemRects[itemRects.length - 1]);\n\n if (atHead) {\n insertIndex = 0;\n } else if (atTail) {\n insertIndex = prevIndex === itemRects.length - 1 ? prevIndex : itemRects.length;\n } else {\n itemRects.some((rect, i, rects) => {\n if (i === rects.length - 1) {\n if (prevIndex === i) insertIndex = i;\n return true;\n }\n const belowCurrent = dragPreviewRectTop >= middleYOfRect(rect);\n const aboveNext = dragPreviewRectTop < middleYOfRect(rects[i + 1]);\n if (belowCurrent && aboveNext) {\n if (prevIndex !== -1 && i >= prevIndex) insertIndex = i;\n else insertIndex = i + 1;\n return true;\n }\n return false;\n });\n }\n\n return insertIndex;\n },\n [getItemRects, internalItems]\n );\n\n const removeById = useCallback(\n (itemId: DraggableItem<T>['id']): void => {\n if (pullMode === 'remove') {\n setInternalItems(currentItems => currentItems.filter(({ id }) => id !== itemId));\n }\n },\n [pullMode]\n );\n\n const normalizeItems = useCallback(() => {\n setInternalItems(currentItems =>\n currentItems.map(({ id, data, type }) => ({\n id,\n data,\n type\n }))\n );\n }, []);\n\n const positionItems = useCallback(\n (item: DragDropListItem<T>, monitor: DropTargetMonitor): void => {\n if (!monitor.canDrop()) return;\n\n const prevIndex = internalItems.findIndex(({ id }) => id === item.id);\n\n if (prevIndex === -1) {\n item.removeFromCurrent?.();\n item.removeFromCurrent = () => {\n removeById(item.id);\n };\n item.normalizeDestination = normalizeItems;\n item.changeDestination = triggerOnChange;\n }\n\n let insertIndex = 0;\n if (pushMode === 'insert') insertIndex = getInsertIndex(item, monitor);\n if (pushMode === 'append') insertIndex = internalItems.length + 1;\n\n let newItems: DraggableItem<T>[];\n\n // Is the current being dragged is within its own list\n if (prevIndex !== -1) {\n if (insertIndex === prevIndex || pushMode !== 'insert') return;\n\n newItems = internalItems.filter(({ id }) => id !== item.id);\n newItems.splice(insertIndex, 0, item);\n\n if (typeof pushMode === 'function') setInternalItems(newItems.sort(pushMode));\n else setInternalItems(newItems);\n } else {\n newItems = [...internalItems];\n newItems.splice(insertIndex, 0, item);\n\n if (typeof pushMode === 'function') setInternalItems(newItems.sort(pushMode));\n else setInternalItems(newItems);\n }\n },\n [internalItems, pushMode, getInsertIndex, normalizeItems, triggerOnChange, removeById]\n );\n\n const onHover = positionItems;\n const onDrop = positionItems;\n\n const onBegin = useCallback(\n (itemId: DraggableItem<T>['id']) =>\n (): OmitStrict<DragDropListItem<T>, keyof DraggableItem<T>> => {\n const initialIndex = internalItems.findIndex(({ id }) => id === itemId);\n\n return {\n removeFromCurrent: () => {\n removeById(itemId);\n },\n returnToSource: (item: DraggableItem<T>) => {\n setInternalItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(initialIndex, 0, item);\n return newItems;\n });\n normalizeItems();\n },\n normalizeDestination: normalizeItems,\n changeSource: triggerOnChange,\n changeDestination: triggerOnChange\n };\n },\n [internalItems, normalizeItems, triggerOnChange, removeById]\n );\n\n const onEnd = useCallback((item: DragDropListItem<T> | undefined, monitor: DragSourceMonitor) => {\n if (!item) return;\n\n if (monitor.didDrop()) {\n item.normalizeDestination?.();\n if (item.changeSource !== item.changeDestination) item.changeSource?.();\n item.changeDestination?.();\n } else {\n item.removeFromCurrent?.();\n item.returnToSource?.(item);\n }\n }, []);\n\n const emptyContent = EmptyRenderer ? <EmptyRenderer /> : null;\n\n return (\n <Droppable accept={accept} onHover={onHover} onDrop={onDrop}>\n {({ dropRef }) => {\n return (\n <Component\n ref={(el: HTMLElement) => {\n dropRef(el);\n setListEl(el);\n }}\n {...restProps}\n >\n {internalItems.length === 0\n ? emptyContent\n : internalItems.map(item => {\n return (\n <Draggable\n key={item.id}\n id={item.id}\n type={item.type}\n data={item.data}\n onBegin={onBegin(item.id)}\n onEnd={onEnd}\n >\n {({ dragRef, previewRef, collected }) => {\n return (\n <ItemRenderer\n {...{\n ...item,\n dragRef,\n previewRef,\n ...collected,\n isDragging: collected.isDragging || !!item.removeFromCurrent\n }}\n />\n );\n }}\n </Draggable>\n );\n })}\n </Component>\n );\n }}\n </Droppable>\n );\n};\n\nexport default DragDropList;\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RefCallback, ComponentType } from 'react';
|
|
2
|
+
import { AsProp, BaseProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { DraggableItem, DraggableCollectedProps } from '../Draggable';
|
|
4
|
+
import { DroppableProps } from '../Droppable';
|
|
5
|
+
export interface ItemRendererProps<T extends object = object> extends DraggableItem<T>, DraggableCollectedProps {
|
|
6
|
+
dragRef: RefCallback<HTMLElement>;
|
|
7
|
+
previewRef: RefCallback<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export interface DragDropListProps<T extends object = object> extends AsProp, BaseProps {
|
|
10
|
+
/** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */
|
|
11
|
+
accept: DroppableProps['accept'];
|
|
12
|
+
/** Array of data objects used for the list. */
|
|
13
|
+
items: DraggableItem<T>[];
|
|
14
|
+
/**
|
|
15
|
+
* @default "remove"
|
|
16
|
+
*/
|
|
17
|
+
pullMode?: 'clone' | 'remove';
|
|
18
|
+
/**
|
|
19
|
+
* @default "insert"
|
|
20
|
+
*/
|
|
21
|
+
pushMode?: 'insert' | 'prepend' | 'append' | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);
|
|
22
|
+
/** User defined function that should return content for the draggable element. */
|
|
23
|
+
itemRenderer: ComponentType<ItemRendererProps<T>>;
|
|
24
|
+
/**
|
|
25
|
+
* Enable drag handle elements for each of the list items. By default the entire element is draggable.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
dragHandles?: boolean;
|
|
29
|
+
/** User defined function(Component) that should return content for when the list is empty. */
|
|
30
|
+
emptyRenderer?: ComponentType;
|
|
31
|
+
/** Called when list data is updated. */
|
|
32
|
+
onChange: (items: DragDropListProps<T>['items']) => void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=DragDropList.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.types.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC1D,SAAQ,aAAa,CAAC,CAAC,CAAC,EACtB,uBAAuB;IACzB,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,MAAM,EAAE,SAAS;IACrF,6GAA6G;IAC7G,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,+CAA+C;IAC/C,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EACL,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IAC3D,kFAAkF;IAClF,YAAY,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropList.types.js","sourceRoot":"","sources":["../../../src/components/DragDropList/DragDropList.types.ts"],"names":[],"mappings":"","sourcesContent":["import { RefCallback, ComponentType } from 'react';\n\nimport { AsProp, BaseProps } from '@pega/cosmos-react-core';\n\nimport { DraggableItem, DraggableCollectedProps } from '../Draggable';\nimport { DroppableProps } from '../Droppable';\n\nexport interface ItemRendererProps<T extends object = object>\n extends DraggableItem<T>,\n DraggableCollectedProps {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n}\n\nexport interface DragDropListProps<T extends object = object> extends AsProp, BaseProps {\n /** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */\n accept: DroppableProps['accept'];\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /**\n * @default \"remove\"\n */\n pullMode?: 'clone' | 'remove';\n /**\n * @default \"insert\"\n */\n pushMode?:\n | 'insert'\n | 'prepend'\n | 'append'\n | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<ItemRendererProps<T>>;\n /**\n * Enable drag handle elements for each of the list items. By default the entire element is draggable.\n * @default false\n */\n dragHandles?: boolean;\n /** User defined function(Component) that should return content for when the list is empty. */\n emptyRenderer?: ComponentType;\n /** Called when list data is updated. */\n onChange: (items: DragDropListProps<T>['items']) => void;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDropList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './DragDropList';\nexport { DragDropListProps, ItemRendererProps } from './DragDropList.types';\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropManager.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAI5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DndProvider } from 'react-dnd';
|
|
3
|
+
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
4
|
+
const DragDropManager = ({ children }) => {
|
|
5
|
+
return _jsx(DndProvider, { backend: HTML5Backend, children: children }, void 0);
|
|
6
|
+
};
|
|
7
|
+
export default DragDropManager;
|
|
8
|
+
//# sourceMappingURL=DragDropManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropManager.js","sourceRoot":"","sources":["../../../src/components/DragDropManager/DragDropManager.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,MAAM,eAAe,GAA4C,CAAC,EAChE,QAAQ,EACa,EAAE,EAAE;IACzB,OAAO,KAAC,WAAW,IAAC,OAAO,EAAE,YAAY,YAAG,QAAQ,WAAe,CAAC;AACtE,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FunctionComponent, ReactNode } from 'react';\nimport { DndProvider } from 'react-dnd';\nimport { HTML5Backend } from 'react-dnd-html5-backend';\n\nexport interface DragDropManagerProps {\n children: ReactNode;\n}\n\nconst DragDropManager: FunctionComponent<DragDropManagerProps> = ({\n children\n}: DragDropManagerProps) => {\n return <DndProvider backend={HTML5Backend}>{children}</DndProvider>;\n};\n\nexport default DragDropManager;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDropManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDropManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC","sourcesContent":["export { default, DragDropManagerProps } from './DragDropManager';\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RefCallback, ReactElement } from 'react';
|
|
2
|
+
import { DragSourceMonitor } from 'react-dnd';
|
|
3
|
+
import { SourceType } from 'dnd-core';
|
|
4
|
+
export interface DraggableItem<T extends object = object> {
|
|
5
|
+
/** Draggable item id */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Draggable item type */
|
|
8
|
+
type: SourceType;
|
|
9
|
+
/** Arbitrary data associated with this drag item */
|
|
10
|
+
data?: T;
|
|
11
|
+
}
|
|
12
|
+
export interface DraggableCollectedProps {
|
|
13
|
+
isDragging: boolean;
|
|
14
|
+
dragEl: HTMLElement | null;
|
|
15
|
+
}
|
|
16
|
+
export interface DraggableProps<T extends object = object> extends DraggableItem<T> {
|
|
17
|
+
onBegin?: (monitor: DragSourceMonitor) => object;
|
|
18
|
+
/** Called when drag item is dropped on a valid drop target */
|
|
19
|
+
onEnd?: (item: DraggableItem<T> | undefined, monitor: DragSourceMonitor) => void;
|
|
20
|
+
children: (props: {
|
|
21
|
+
dragRef: RefCallback<HTMLElement>;
|
|
22
|
+
previewRef: RefCallback<HTMLElement>;
|
|
23
|
+
collected: DraggableCollectedProps;
|
|
24
|
+
}) => ReactElement;
|
|
25
|
+
}
|
|
26
|
+
declare const Draggable: <T extends object = object>({ id, type, data, onBegin, onEnd, children }: DraggableProps<T>) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
27
|
+
export default Draggable;
|
|
28
|
+
//# sourceMappingURL=Draggable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../src/components/Draggable/Draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,WAAW,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAW,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACtD,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,oDAAoD;IACpD,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,CAAC;IACjD,8DAA8D;IAC9D,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjF,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;QAClC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;QACrC,SAAS,EAAE,uBAAuB,CAAC;KACpC,KAAK,YAAY,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,wKA+Bd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useRef } from 'react';
|
|
2
2
|
import { useDrag } from 'react-dnd';
|
|
3
|
-
const Draggable = ({ id, type, data,
|
|
3
|
+
const Draggable = ({ id, type, data, onBegin, onEnd, children }) => {
|
|
4
4
|
const dragElRef = useRef(null);
|
|
5
|
-
const [collected, dragRef, previewRef] = useDrag({
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const [collected, dragRef, previewRef] = useDrag(() => ({
|
|
6
|
+
type,
|
|
7
|
+
item: monitor => ({ ...onBegin?.(monitor), id, type, data }),
|
|
8
|
+
end: onEnd,
|
|
9
|
+
collect: monitor => ({
|
|
8
10
|
isDragging: monitor.isDragging(),
|
|
9
11
|
dragEl: dragElRef.current
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
end
|
|
13
|
-
});
|
|
12
|
+
})
|
|
13
|
+
}), [id, type, data, onBegin, onEnd]);
|
|
14
14
|
return children({
|
|
15
15
|
dragRef: (el) => {
|
|
16
16
|
dragElRef.current = el;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../src/components/Draggable/Draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA+C,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAC;AA4BvD,MAAM,SAAS,GAAG,CAA4B,EAC5C,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACU,EAAE,EAAE;IACtB,MAAM,SAAS,GAAyC,MAAM,CAAc,IAAI,CAAC,CAAC;IAElF,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,OAAO,CAC9C,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC5D,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YACnB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;YAChC,MAAM,EAAE,SAAS,CAAC,OAAO;SAC1B,CAAC;KACH,CAAC,EACF,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CACjC,CAAC;IAEF,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,CAAC,EAAe,EAAE,EAAE;YAC3B,SAAS,CAAC,OAAO,GAAG,EAAE,CAAC;YACvB,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;QACD,UAAU;QACV,SAAS;KACV,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useRef, MutableRefObject, RefCallback, ReactElement } from 'react';\nimport { useDrag, DragSourceMonitor } from 'react-dnd';\nimport { SourceType } from 'dnd-core';\n\nexport interface DraggableItem<T extends object = object> {\n /** Draggable item id */\n id: string;\n /** Draggable item type */\n type: SourceType;\n /** Arbitrary data associated with this drag item */\n data?: T;\n}\n\nexport interface DraggableCollectedProps {\n isDragging: boolean;\n dragEl: HTMLElement | null;\n}\n\nexport interface DraggableProps<T extends object = object> extends DraggableItem<T> {\n onBegin?: (monitor: DragSourceMonitor) => object;\n /** Called when drag item is dropped on a valid drop target */\n onEnd?: (item: DraggableItem<T> | undefined, monitor: DragSourceMonitor) => void;\n children: (props: {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n collected: DraggableCollectedProps;\n }) => ReactElement;\n}\n\nconst Draggable = <T extends object = object>({\n id,\n type,\n data,\n onBegin,\n onEnd,\n children\n}: DraggableProps<T>) => {\n const dragElRef: MutableRefObject<HTMLElement | null> = useRef<HTMLElement>(null);\n\n const [collected, dragRef, previewRef] = useDrag(\n () => ({\n type,\n item: monitor => ({ ...onBegin?.(monitor), id, type, data }),\n end: onEnd,\n collect: monitor => ({\n isDragging: monitor.isDragging(),\n dragEl: dragElRef.current\n })\n }),\n [id, type, data, onBegin, onEnd]\n );\n\n return children({\n dragRef: (el: HTMLElement) => {\n dragElRef.current = el;\n dragRef(el);\n },\n previewRef,\n collected\n });\n};\n\nexport default Draggable;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Draggable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Draggable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA0D,MAAM,aAAa,CAAC","sourcesContent":["export { default, DraggableProps, DraggableItem, DraggableCollectedProps } from './Draggable';\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefCallback, ReactElement } from 'react';
|
|
2
|
+
import { DropTargetMonitor } from 'react-dnd';
|
|
3
|
+
import { TargetType } from 'dnd-core';
|
|
4
|
+
import { DraggableItem } from '../Draggable';
|
|
5
|
+
export interface DroppableProps<T extends object = object> {
|
|
6
|
+
/** Type of item allowed to be dropped on this drop target */
|
|
7
|
+
accept: TargetType;
|
|
8
|
+
/** Called when drop target is hovered with valid Droppable item */
|
|
9
|
+
onHover?: (item: DraggableItem<T>, monitor: DropTargetMonitor) => void;
|
|
10
|
+
/** Called when drag item is dropped on a valid drop target */
|
|
11
|
+
onDrop?: (item: DraggableItem<T>, monitor: DropTargetMonitor) => void;
|
|
12
|
+
/** Called when item is dropped on this drop target */
|
|
13
|
+
children: (refs: {
|
|
14
|
+
dropRef: RefCallback<HTMLElement>;
|
|
15
|
+
collected: {
|
|
16
|
+
canDrop: boolean;
|
|
17
|
+
isOver: boolean;
|
|
18
|
+
};
|
|
19
|
+
}) => ReactElement;
|
|
20
|
+
}
|
|
21
|
+
declare const Droppable: <T extends object = object>({ accept, onDrop, onHover, children }: DroppableProps<T>) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
22
|
+
export default Droppable;
|
|
23
|
+
//# sourceMappingURL=Droppable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Droppable.d.ts","sourceRoot":"","sources":["../../../src/components/Droppable/Droppable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAW,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACvD,6DAA6D;IAC7D,MAAM,EAAE,UAAU,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACvE,8DAA8D;IAC9D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtE,sDAAsD;IACtD,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;QAClC,SAAS,EAAE;YAAE,OAAO,EAAE,OAAO,CAAC;YAAC,MAAM,EAAE,OAAO,CAAA;SAAE,CAAC;KAClD,KAAK,YAAY,CAAC;CACpB;AAED,QAAA,MAAM,SAAS,iKAoBd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDrop } from 'react-dnd';
|
|
2
2
|
const Droppable = ({ accept, onDrop, onHover, children }) => {
|
|
3
|
-
const [collected, dropRef] = useDrop({
|
|
3
|
+
const [collected, dropRef] = useDrop(() => ({
|
|
4
4
|
accept,
|
|
5
5
|
drop: onDrop,
|
|
6
6
|
hover: onHover,
|
|
@@ -8,7 +8,7 @@ const Droppable = ({ accept, onDrop, onHover, children }) => {
|
|
|
8
8
|
canDrop: monitor.canDrop(),
|
|
9
9
|
isOver: monitor.isOver()
|
|
10
10
|
})
|
|
11
|
-
});
|
|
11
|
+
}), [accept, onDrop, onHover]);
|
|
12
12
|
return children({ dropRef, collected });
|
|
13
13
|
};
|
|
14
14
|
export default Droppable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Droppable.js","sourceRoot":"","sources":["../../../src/components/Droppable/Droppable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAC;AAmBvD,MAAM,SAAS,GAAG,CAA4B,EAC5C,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACU,EAAE,EAAE;IACtB,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,OAAO,CAClC,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YACnB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;SACzB,CAAC;KACH,CAAC,EACF,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAC1B,CAAC;IAEF,OAAO,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { RefCallback, ReactElement } from 'react';\nimport { useDrop, DropTargetMonitor } from 'react-dnd';\nimport { TargetType } from 'dnd-core';\n\nimport { DraggableItem } from '../Draggable';\n\nexport interface DroppableProps<T extends object = object> {\n /** Type of item allowed to be dropped on this drop target */\n accept: TargetType;\n /** Called when drop target is hovered with valid Droppable item */\n onHover?: (item: DraggableItem<T>, monitor: DropTargetMonitor) => void;\n /** Called when drag item is dropped on a valid drop target */\n onDrop?: (item: DraggableItem<T>, monitor: DropTargetMonitor) => void;\n /** Called when item is dropped on this drop target */\n children: (refs: {\n dropRef: RefCallback<HTMLElement>;\n collected: { canDrop: boolean; isOver: boolean };\n }) => ReactElement;\n}\n\nconst Droppable = <T extends object = object>({\n accept,\n onDrop,\n onHover,\n children\n}: DroppableProps<T>) => {\n const [collected, dropRef] = useDrop(\n () => ({\n accept,\n drop: onDrop,\n hover: onHover,\n collect: monitor => ({\n canDrop: monitor.canDrop(),\n isOver: monitor.isOver()\n })\n }),\n [accept, onDrop, onHover]\n );\n\n return children({ dropRef, collected });\n};\n\nexport default Droppable;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Droppable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Droppable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,aAAa,CAAC","sourcesContent":["export { default, DroppableProps } from './Droppable';\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as DragDropList } from './components/DragDropList';
|
|
2
|
+
export * from './components/DragDropList';
|
|
3
|
+
export { default as DragDropManager } from './components/DragDropManager';
|
|
4
|
+
export * from './components/DragDropManager';
|
|
5
|
+
export { default as Draggable } from './components/Draggable';
|
|
6
|
+
export * from './components/Draggable';
|
|
7
|
+
export { default as Droppable } from './components/Droppable';
|
|
8
|
+
export * from './components/Droppable';
|
|
2
9
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
// This file is autogenerated. Any changes will be overwritten.
|
|
2
|
-
export
|
|
2
|
+
export { default as DragDropList } from './components/DragDropList';
|
|
3
|
+
export * from './components/DragDropList';
|
|
4
|
+
export { default as DragDropManager } from './components/DragDropManager';
|
|
5
|
+
export * from './components/DragDropManager';
|
|
6
|
+
export { default as Draggable } from './components/Draggable';
|
|
7
|
+
export * from './components/Draggable';
|
|
8
|
+
export { default as Droppable } from './components/Droppable';
|
|
9
|
+
export * from './components/Droppable';
|
|
3
10
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,wBAAwB,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as DragDropList } from './components/DragDropList';\nexport * from './components/DragDropList';\nexport { default as DragDropManager } from './components/DragDropManager';\nexport * from './components/DragDropManager';\nexport { default as Draggable } from './components/Draggable';\nexport * from './components/Draggable';\nexport { default as Droppable } from './components/Droppable';\nexport * from './components/Droppable';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-dnd",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.20.0",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,25 +20,25 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-core": "2.0.0-dev.
|
|
23
|
+
"@pega/cosmos-react-core": "2.0.0-dev.20.0",
|
|
24
|
+
"dnd-core": "14.0.1",
|
|
24
25
|
"polished": "^4.1.0",
|
|
25
|
-
"react": "^16.
|
|
26
|
-
"react-dnd": "^
|
|
27
|
-
"react-dnd-html5-backend": "^
|
|
28
|
-
"react-dom": "^16.
|
|
26
|
+
"react": "^16.14.0 || ^17.0.0",
|
|
27
|
+
"react-dnd": "^14.0.4",
|
|
28
|
+
"react-dnd-html5-backend": "^14.0.2",
|
|
29
|
+
"react-dom": "^16.14.0 || ^17.0.0",
|
|
29
30
|
"styled-components": "^5.2.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@storybook/addon-a11y": "^6.
|
|
33
|
-
"@storybook/addon-actions": "^6.
|
|
34
|
-
"@storybook/addon-knobs": "^6.
|
|
35
|
-
"@storybook/addon-storysource": "^6.
|
|
36
|
-
"@storybook/addon-toolbars": "^6.
|
|
37
|
-
"@storybook/addons": "^6.
|
|
38
|
-
"@storybook/react": "^6.
|
|
39
|
-
"@storybook/theming": "^6.
|
|
33
|
+
"@storybook/addon-a11y": "^6.3.8",
|
|
34
|
+
"@storybook/addon-actions": "^6.3.8",
|
|
35
|
+
"@storybook/addon-knobs": "^6.3.1",
|
|
36
|
+
"@storybook/addon-storysource": "^6.3.8",
|
|
37
|
+
"@storybook/addon-toolbars": "^6.3.8",
|
|
38
|
+
"@storybook/addons": "^6.3.8",
|
|
39
|
+
"@storybook/react": "^6.3.8",
|
|
40
|
+
"@storybook/theming": "^6.3.8",
|
|
40
41
|
"enzyme": "^3.11.0",
|
|
41
|
-
"
|
|
42
|
-
"typescript": "~4.3.2"
|
|
42
|
+
"typescript": "~4.5.2"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ComponentType, ReactElement, RefCallback } from 'react';
|
|
2
|
-
import { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';
|
|
3
|
-
import { AsProp, BaseProps } from '@pega/cosmos-react-core';
|
|
4
|
-
export interface DraggableItem<T extends object = object> {
|
|
5
|
-
/** Draggable item id */
|
|
6
|
-
id: string;
|
|
7
|
-
/** Draggable item type */
|
|
8
|
-
type: string | symbol;
|
|
9
|
-
/** Arbitrary data associated with this drag item */
|
|
10
|
-
data?: T;
|
|
11
|
-
}
|
|
12
|
-
export interface CollectedProps {
|
|
13
|
-
isDragging: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface DraggableProps<T extends object = object> extends DraggableItem<T> {
|
|
16
|
-
onBegin?(monitor: DragSourceMonitor): object;
|
|
17
|
-
/** Called when drag item is dropped on a valid drop target */
|
|
18
|
-
onEnd?(item: DraggableItem<T> | undefined, monitor: DragSourceMonitor): void;
|
|
19
|
-
children(props: {
|
|
20
|
-
dragRef: RefCallback<HTMLElement>;
|
|
21
|
-
previewRef: RefCallback<HTMLElement>;
|
|
22
|
-
collected: CollectedProps;
|
|
23
|
-
}): ReactElement;
|
|
24
|
-
}
|
|
25
|
-
export interface DroppableProps<T extends object = object> {
|
|
26
|
-
/** Type of item allowed to be dropped on this drop target */
|
|
27
|
-
accept: DraggableProps['type'] | DraggableProps['type'][];
|
|
28
|
-
/** Called when drop target is hovered with valid Droppable item */
|
|
29
|
-
onHover?(item: DraggableItem<T>, monitor: DropTargetMonitor): void;
|
|
30
|
-
/** Called when drag item is dropped on a valid drop target */
|
|
31
|
-
onDrop?(item: DraggableItem<T>, monitor: DropTargetMonitor): void;
|
|
32
|
-
/** Called when item is dropped on this drop target */
|
|
33
|
-
children(refs: {
|
|
34
|
-
dropRef: RefCallback<HTMLElement>;
|
|
35
|
-
collected: {
|
|
36
|
-
canDrop: boolean;
|
|
37
|
-
isOver: boolean;
|
|
38
|
-
};
|
|
39
|
-
}): ReactElement;
|
|
40
|
-
}
|
|
41
|
-
export interface ItemRendererProps<T extends object = object> extends DraggableItem<T>, CollectedProps {
|
|
42
|
-
dragRef: RefCallback<HTMLElement>;
|
|
43
|
-
previewRef: RefCallback<HTMLElement>;
|
|
44
|
-
}
|
|
45
|
-
export interface DragDropListProps<T extends object = object> extends AsProp, BaseProps {
|
|
46
|
-
/** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */
|
|
47
|
-
accept: DroppableProps['accept'];
|
|
48
|
-
/** Array of data objects used for the list. */
|
|
49
|
-
items: DraggableItem<T>[];
|
|
50
|
-
/**
|
|
51
|
-
* @default "remove"
|
|
52
|
-
*/
|
|
53
|
-
pullMode?: 'clone' | 'remove';
|
|
54
|
-
/**
|
|
55
|
-
* @default "insert"
|
|
56
|
-
*/
|
|
57
|
-
pushMode?: 'insert' | 'prepend' | 'append' | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);
|
|
58
|
-
/** User defined function that should return content for the draggable element. */
|
|
59
|
-
itemRenderer: ComponentType<ItemRendererProps<T>>;
|
|
60
|
-
/**
|
|
61
|
-
* Enable drag handle elements for each of the list items. By default the entire element is draggable.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
dragHandles?: boolean;
|
|
65
|
-
/** User defined function(Component) that should return content for when the list is empty. */
|
|
66
|
-
emptyRenderer?: ComponentType;
|
|
67
|
-
/** Called when list data is updated. */
|
|
68
|
-
onChange(items: DragDropListProps<T>['items']): void;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=DragDrop.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDrop.types.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDrop.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACtD,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,oDAAoD;IACpD,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjF,OAAO,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAC7C,8DAA8D;IAC9D,KAAK,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC7E,QAAQ,CAAC,KAAK,E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H,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EACL,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;IAC3D,kFAAkF;IAClF,YAAY,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDrop.types.js","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDrop.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType, ReactElement, RefCallback } from 'react';\nimport { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';\n\nimport { AsProp, BaseProps } from '@pega/cosmos-react-core';\n\nexport interface DraggableItem<T extends object = object> {\n /** Draggable item id */\n id: string;\n /** Draggable item type */\n type: string | symbol;\n /** Arbitrary data associated with this drag item */\n data?: T;\n}\n\nexport interface CollectedProps {\n isDragging: boolean;\n}\n\nexport interface DraggableProps<T extends object = object> extends DraggableItem<T> {\n onBegin?(monitor: DragSourceMonitor): object;\n /** Called when drag item is dropped on a valid drop target */\n onEnd?(item: DraggableItem<T> | undefined, monitor: DragSourceMonitor): void;\n children(props: {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n collected: CollectedProps;\n }): ReactElement;\n}\n\nexport interface DroppableProps<T extends object = object> {\n /** Type of item allowed to be dropped on this drop target */\n accept: DraggableProps['type'] | DraggableProps['type'][];\n /** Called when drop target is hovered with valid Droppable item */\n onHover?(item: DraggableItem<T>, monitor: DropTargetMonitor): void;\n /** Called when drag item is dropped on a valid drop target */\n onDrop?(item: DraggableItem<T>, monitor: DropTargetMonitor): void;\n /** Called when item is dropped on this drop target */\n children(refs: {\n dropRef: RefCallback<HTMLElement>;\n collected: { canDrop: boolean; isOver: boolean };\n }): ReactElement;\n}\n\nexport interface ItemRendererProps<T extends object = object>\n extends DraggableItem<T>,\n CollectedProps {\n dragRef: RefCallback<HTMLElement>;\n previewRef: RefCallback<HTMLElement>;\n}\n\nexport interface DragDropListProps<T extends object = object> extends AsProp, BaseProps {\n /** Type of item allowed to be dropped on this list (useful when there is multiple lists that share data). */\n accept: DroppableProps['accept'];\n /** Array of data objects used for the list. */\n items: DraggableItem<T>[];\n /**\n * @default \"remove\"\n */\n pullMode?: 'clone' | 'remove';\n /**\n * @default \"insert\"\n */\n pushMode?:\n | 'insert'\n | 'prepend'\n | 'append'\n | ((a: DraggableItem<T>, b: DraggableItem<T>) => number);\n /** User defined function that should return content for the draggable element. */\n itemRenderer: ComponentType<ItemRendererProps<T>>;\n /**\n * Enable drag handle elements for each of the list items. By default the entire element is draggable.\n * @default false\n */\n dragHandles?: boolean;\n /** User defined function(Component) that should return content for when the list is empty. */\n emptyRenderer?: ComponentType;\n /** Called when list data is updated. */\n onChange(items: DragDropListProps<T>['items']): void;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropList.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDropList.tsx"],"names":[],"mappings":";AAGA,OAAO,EAIL,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,kBAAkB,CAAC;AAYpE,QAAA,MAAM,YAAY,yNAyNjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropList.js","sourceRo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K,CAAC;YACzB,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBACvB,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,IAAI,CAAC,EAAE,EACZ,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,KAAK,IAEX,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE;oBACtC,OAAO,CACL,oBAAC,YAAY,OACP;4BACF,GAAG,IAAI;4BACP,OAAO;4BACP,UAAU;4BACV,GAAG,SAAS;4BACZ,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB;yBAC7D,GACD,CACH,CAAC;gBACJ,CAAC,CACS,CACb,CAAC;YACJ,CAAC,CAAC,CACI,CACb,CAAC;IACJ,CAAC,CACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import React, { useCallback, useState, useRef } from 'react';\nimport { DragSourceMonitor, DropTargetMonitor } from 'react-dnd';\n\nimport {\n useElement,\n useAfterInitialEffect,\n useTriggerableLayoutEffect,\n ForwardProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\n\nimport Draggable from './Draggable';\nimport Droppable from './Droppable';\nimport { DragDropListProps, DraggableItem } from './DragDrop.types';\n\ninterface DragDropListItem<T extends object = object> extends DraggableItem<T> {\n removeFromCurrent?(): void;\n returnToSource?(item: DraggableItem<T>): void;\n normalizeDestination?(): void;\n changeSource?(): void;\n changeDestination?(): void;\n}\n\nconst middleYOfRect = ({ top, bottom }: DOMRect): number => top + (bottom - top) / 2;\n\nconst DragDropList = <T extends object = object>({\n accept,\n items,\n itemRenderer: ItemRenderer,\n emptyRenderer: EmptyRenderer,\n onChange,\n pullMode = 'remove',\n pushMode = 'insert',\n as: Component = 'ul',\n ...restProps\n}: DragDropListProps<T> & ForwardProps) => {\n const [internalItems, setInternalItems] = useState<DragDropListItem<T>[]>(items);\n const itemRectsRef = useRef<DOMRect[] | null>(null);\n const [listEl, setListEl] = useElement<HTMLElement>();\n\n const getItemRects = useCallback((): DOMRect[] | null => {\n if (!listEl || listEl.children.length === 0) return null;\n return [...listEl.children].map(itemEl => {\n return itemEl.getBoundingClientRect();\n });\n }, [listEl]);\n\n useAfterInitialEffect(() => {\n setInternalItems(items);\n }, [items]);\n\n const triggerOnChange = useTriggerableLayoutEffect(\n useCallback(() => {\n onChange(internalItems);\n }, [onChange, internalItems])\n );\n\n const getInsertIndex = useCallback(\n (item: DraggableItem<T>, monitor: DropTargetMonitor | DragSourceMonitor): number => {\n itemRectsRef.current = getItemRects();\n const { current: itemRects } = itemRectsRef;\n let insertIndex = -1;\n const prevIndex = internalItems.findIndex(({ id }) => id === item.id);\n\n const clientXY = monitor.getClientOffset();\n if (!itemRects || !clientXY) return insertIndex;\n\n const dragPreviewRectTop = clientXY.y;\n const atHead = dragPreviewRectTop < middleYOfRect(itemRects[0]);\n const atTail = dragPreviewRectTop >= middleYOfRect(itemRects[itemRects.length - 1]);\n\n if (atHead) {\n insertIndex = 0;\n } else if (atTail) {\n insertIndex = prevIndex === itemRects.length - 1 ? prevIndex : itemRects.length;\n } else {\n itemRects.some((rect, i, rects) => {\n if (i === rects.length - 1) {\n if (prevIndex === i) insertIndex = i;\n return true;\n }\n const belowCurrent = dragPreviewRectTop >= middleYOfRect(rect);\n const aboveNext = dragPreviewRectTop < middleYOfRect(rects[i + 1]);\n if (belowCurrent && aboveNext) {\n if (prevIndex !== -1 && i >= prevIndex) insertIndex = i;\n else insertIndex = i + 1;\n return true;\n }\n return false;\n });\n }\n\n return insertIndex;\n },\n [getItemRects, internalItems, itemRectsRef.current]\n );\n\n const removeById = useCallback(\n (itemId: DraggableItem<T>['id']): void => {\n if (pullMode === 'remove') {\n setInternalItems(currentItems => currentItems.filter(({ id }) => id !== itemId));\n }\n },\n [internalItems, pullMode]\n );\n\n const normalizeItems = useCallback(() => {\n setInternalItems(currentItems =>\n currentItems.map(({ id, data, type }) => ({\n id,\n data,\n type\n }))\n );\n }, []);\n\n const positionItems = useCallback(\n (item: DragDropListItem<T>, monitor: DropTargetMonitor): void => {\n if (!monitor.canDrop()) return;\n\n const prevIndex = internalItems.findIndex(({ id }) => id === item.id);\n\n if (prevIndex === -1) {\n item.removeFromCurrent?.();\n item.removeFromCurrent = () => {\n removeById(item.id);\n };\n item.normalizeDestination = normalizeItems;\n item.changeDestination = triggerOnChange;\n }\n\n let insertIndex = 0;\n if (pushMode === 'insert') insertIndex = getInsertIndex(item, monitor);\n if (pushMode === 'append') insertIndex = internalItems.length + 1;\n\n let newItems: DraggableItem<T>[];\n\n // Is the current being dragged is within its own list\n if (prevIndex !== -1) {\n if (insertIndex === prevIndex || pushMode !== 'insert') return;\n\n newItems = internalItems.filter(({ id }) => id !== item.id);\n newItems.splice(insertIndex, 0, item);\n\n if (typeof pushMode === 'function') setInternalItems(newItems.sort(pushMode));\n else setInternalItems(newItems);\n } else {\n newItems = [...internalItems];\n newItems.splice(insertIndex, 0, item);\n\n if (typeof pushMode === 'function') setInternalItems(newItems.sort(pushMode));\n else setInternalItems(newItems);\n }\n },\n [pushMode, getInsertIndex, internalItems, removeById]\n );\n\n const onHover = positionItems;\n const onDrop = positionItems;\n\n const onBegin = useCallback(\n (itemId: DraggableItem<T>['id']) =>\n (): OmitStrict<DragDropListItem<T>, keyof DraggableItem<T>> => {\n const initialIndex = internalItems.findIndex(({ id }) => id === itemId);\n\n return {\n removeFromCurrent: () => {\n removeById(itemId);\n },\n returnToSource: (item: DraggableItem<T>) => {\n setInternalItems(currentItems => {\n const newItems = currentItems.filter(({ id }) => id !== itemId);\n newItems.splice(initialIndex, 0, item);\n return newItems;\n });\n normalizeItems();\n },\n normalizeDestination: normalizeItems,\n changeSource: triggerOnChange,\n changeDestination: triggerOnChange\n };\n },\n [removeById, internalItems]\n );\n\n const onEnd = useCallback((item: DragDropListItem<T>, monitor: DragSourceMonitor) => {\n if (monitor.didDrop()) {\n item.normalizeDestination?.();\n if (item.changeSource !== item.changeDestination) item.changeSource?.();\n item.changeDestination?.();\n } else {\n item.removeFromCurrent?.();\n item.returnToSource?.(item);\n }\n }, []);\n\n const emptyContent = EmptyRenderer ? <EmptyRenderer /> : null;\n\n return (\n <Droppable accept={accept} onHover={onHover} onDrop={onDrop}>\n {({ dropRef }) => {\n return (\n <Component\n ref={(el: HTMLElement) => {\n dropRef(el);\n setListEl(el);\n }}\n {...restProps}\n >\n {internalItems.length === 0\n ? emptyContent\n : internalItems.map(item => {\n return (\n <Draggable\n key={item.id}\n id={item.id}\n type={item.type}\n data={item.data}\n onBegin={onBegin(item.id)}\n onEnd={onEnd}\n >\n {({ dragRef, previewRef, collected }) => {\n return (\n <ItemRenderer\n {...{\n ...item,\n dragRef,\n previewRef,\n ...collected,\n isDragging: collected.isDragging || !!item.removeFromCurrent\n }}\n />\n );\n }}\n </Draggable>\n );\n })}\n </Component>\n );\n }}\n </Droppable>\n );\n};\n\nexport default DragDropList;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropManager.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDropManager.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,iBAAiB,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAIpE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAKD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,CAK5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
2
|
-
import { DndProvider, createDndContext } from 'react-dnd';
|
|
3
|
-
import Backend from 'react-dnd-html5-backend';
|
|
4
|
-
// https://github.com/react-dnd/react-dnd/issues/186
|
|
5
|
-
const Context = createDndContext(Backend);
|
|
6
|
-
const DragDropManager = ({ children }) => {
|
|
7
|
-
const manager = useRef(Context);
|
|
8
|
-
return React.createElement(DndProvider, { manager: manager.current.dragDropManager }, children);
|
|
9
|
-
};
|
|
10
|
-
export default DragDropManager;
|
|
11
|
-
//# sourceMappingURL=DragDropManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropManager.js","sourceRoot":"","sources":["../../../src/components/DragDrop/DragDropManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgC,MAAM,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAM9C,oDAAoD;AACpD,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAE1C,MAAM,eAAe,GAA4C,CAAC,EAChE,QAAQ,EACa,EAAE,EAAE;IACzB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,oBAAC,WAAW,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe,IAAG,QAAQ,CAAe,CAAC;AACzF,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import React, { FunctionComponent, ReactNode, useRef } from 'react';\nimport { DndProvider, createDndContext } from 'react-dnd';\nimport Backend from 'react-dnd-html5-backend';\n\nexport interface DragDropManagerProps {\n children: ReactNode;\n}\n\n// https://github.com/react-dnd/react-dnd/issues/186\nconst Context = createDndContext(Backend);\n\nconst DragDropManager: FunctionComponent<DragDropManagerProps> = ({\n children\n}: DragDropManagerProps) => {\n const manager = useRef(Context);\n return <DndProvider manager={manager.current.dragDropManager}>{children}</DndProvider>;\n};\n\nexport default DragDropManager;\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DraggableProps } from './DragDrop.types';
|
|
3
|
-
declare const Draggable: <T extends object = object>({ id, type, data, children, onBegin, onEnd: end }: DraggableProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
|
-
export default Draggable;
|
|
5
|
-
//# sourceMappingURL=Draggable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/Draggable.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,SAAS,6LA4Bd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../src/components/DragDrop/Draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAC;AAIvD,MAAM,SAAS,GAAG,CAA4B,EAC5C,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EAAE,GAAG,EACQ,EAAE,EAAE;IACtB,MAAM,SAAS,GAAyC,MAAM,CAAc,IAAI,CAAC,CAAC;IAElF,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC;QAC/C,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACxB,OAAO,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;YACxC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;YAChC,MAAM,EAAE,SAAS,CAAC,OAAO;SAC1B,CAAC;QACF,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QACjF,GAAG;KACJ,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;QACd,OAAO,EAAE,CAAC,EAAe,EAAE,EAAE;YAC3B,SAAS,CAAC,OAAO,GAAG,EAAE,CAAC;YACvB,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;QACD,UAAU;QACV,SAAS;KACV,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useRef, MutableRefObject } from 'react';\nimport { useDrag, DragSourceMonitor } from 'react-dnd';\n\nimport { DraggableProps } from './DragDrop.types';\n\nconst Draggable = <T extends object = object>({\n id,\n type,\n data,\n children,\n onBegin,\n onEnd: end\n}: DraggableProps<T>) => {\n const dragElRef: MutableRefObject<HTMLElement | null> = useRef<HTMLElement>(null);\n\n const [collected, dragRef, previewRef] = useDrag({\n item: { id, type, data },\n collect: (monitor: DragSourceMonitor) => ({\n isDragging: monitor.isDragging(),\n dragEl: dragElRef.current\n }),\n begin: onBegin ? monitor => ({ ...onBegin(monitor), id, type, data }) : undefined,\n end\n });\n\n return children({\n dragRef: (el: HTMLElement) => {\n dragElRef.current = el;\n dragRef(el);\n },\n previewRef,\n collected\n });\n};\n\nexport default Draggable;\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { DroppableProps } from './DragDrop.types';
|
|
3
|
-
declare const Droppable: <T extends object = object>({ accept, onDrop, onHover, children }: DroppableProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
4
|
-
export default Droppable;
|
|
5
|
-
//# sourceMappingURL=Droppable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Droppable.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/Droppable.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,SAAS,iLAiBd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Droppable.js","sourceRoot":"","sources":["../../../src/components/DragDrop/Droppable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,SAAS,GAAG,CAA4B,EAC5C,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACU,EAAE,EAAE;IACtB,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QACnC,MAAM;QACN,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;YACnB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;SACzB,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useDrop } from 'react-dnd';\n\nimport { DroppableProps } from './DragDrop.types';\n\nconst Droppable = <T extends object = object>({\n accept,\n onDrop,\n onHover,\n children\n}: DroppableProps<T>) => {\n const [collected, dropRef] = useDrop({\n accept,\n drop: onDrop,\n hover: onHover,\n collect: monitor => ({\n canDrop: monitor.canDrop(),\n isOver: monitor.isOver()\n })\n });\n\n return children({ dropRef, collected });\n};\n\nexport default Droppable;\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as DragDropManager } from './DragDropManager';
|
|
2
|
-
export { default as Draggable } from './Draggable';
|
|
3
|
-
export { default as Droppable } from './Droppable';
|
|
4
|
-
export { default as DragDropList } from './DragDropList';
|
|
5
|
-
export { DragDropManagerProps } from './DragDropManager';
|
|
6
|
-
export { DraggableProps } from './DragDrop.types';
|
|
7
|
-
export { DroppableProps } from './DragDrop.types';
|
|
8
|
-
export { DragDropListProps } from './DragDrop.types';
|
|
9
|
-
export { DraggableItem } from './DragDrop.types';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default as DragDropManager } from './DragDropManager';\nexport { default as Draggable } from './Draggable';\nexport { default as Droppable } from './Droppable';\nexport { default as DragDropList } from './DragDropList';\nexport { DragDropManagerProps } from './DragDropManager';\nexport { DraggableProps } from './DragDrop.types';\nexport { DroppableProps } from './DragDrop.types';\nexport { DragDropListProps } from './DragDrop.types';\nexport { DraggableItem } from './DragDrop.types';\n"]}
|