ar-design 0.3.21 → 0.3.23
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.
|
@@ -12,6 +12,8 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
|
|
|
12
12
|
event.preventDefault();
|
|
13
13
|
const item = JSON.parse(event.dataTransfer.getData("item"));
|
|
14
14
|
const fromColumn = event.dataTransfer.getData("fromColumn");
|
|
15
|
+
const nodes = document.querySelectorAll("[data-id='placeholder']");
|
|
16
|
+
nodes.forEach((node) => node.remove());
|
|
15
17
|
if (!item || fromColumn === toColumn)
|
|
16
18
|
return;
|
|
17
19
|
const updatedColumns = data.map((board) => {
|
|
@@ -22,13 +24,13 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
|
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
if (board.key === toColumn) {
|
|
25
|
-
const
|
|
26
|
-
const safeIndex = Math.min(_hoverItemIndex.current ?? Infinity,
|
|
27
|
-
|
|
27
|
+
const boardItems = [...board.items];
|
|
28
|
+
const safeIndex = Math.min(_hoverItemIndex.current ?? Infinity, boardItems.length); // son elemandan fazla olmasın.
|
|
29
|
+
boardItems.splice(safeIndex, 0, item);
|
|
28
30
|
onChange?.(item, board.key, safeIndex);
|
|
29
31
|
return {
|
|
30
32
|
...board,
|
|
31
|
-
items:
|
|
33
|
+
items: boardItems,
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
return board;
|
|
@@ -38,8 +40,6 @@ const KanbanBoard = function ({ trackBy, columns, onChange }) {
|
|
|
38
40
|
event.dataTransfer.clearData("item");
|
|
39
41
|
event.dataTransfer.clearData("fromColumn");
|
|
40
42
|
_hoverItemIndex.current = null;
|
|
41
|
-
const nodes = document.querySelectorAll("[data-id='placeholder']");
|
|
42
|
-
nodes.forEach((node) => node.remove());
|
|
43
43
|
};
|
|
44
44
|
// useEffects
|
|
45
45
|
useEffect(() => setData(columns), [columns]);
|