authscape 1.0.374 → 1.0.376
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/index.js +1124 -0
- package/package.json +1 -1
- package/src/components/kaban/Action.js +23 -0
- package/src/components/kaban/Container.js +66 -0
- package/src/components/kaban/Handle.js +20 -0
- package/src/components/kaban/Item.js +139 -0
- package/src/components/kaban/Kanban.js +852 -0
- package/src/components/kaban/Remove.js +19 -0
- package/src/components/kaban/createRange.js +5 -0
- package/src/components/kaban/multipleContainersKeyboardCoordinates.js +114 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Action} from './Action';
|
|
4
|
+
|
|
5
|
+
export function Remove(props) {
|
|
6
|
+
return (
|
|
7
|
+
<Action
|
|
8
|
+
{...props}
|
|
9
|
+
active={{
|
|
10
|
+
fill: 'rgba(255, 70, 70, 0.95)',
|
|
11
|
+
background: 'rgba(255, 70, 70, 0.1)',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<svg width="8" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
+
<path d="M2.99998 -0.000206962C2.7441 -0.000206962 2.48794 0.0972617 2.29294 0.292762L0.292945 2.29276C-0.0980552 2.68376 -0.0980552 3.31682 0.292945 3.70682L7.58591 10.9998L0.292945 18.2928C-0.0980552 18.6838 -0.0980552 19.3168 0.292945 19.7068L2.29294 21.7068C2.68394 22.0978 3.31701 22.0978 3.70701 21.7068L11 14.4139L18.2929 21.7068C18.6829 22.0978 19.317 22.0978 19.707 21.7068L21.707 19.7068C22.098 19.3158 22.098 18.6828 21.707 18.2928L14.414 10.9998L21.707 3.70682C22.098 3.31682 22.098 2.68276 21.707 2.29276L19.707 0.292762C19.316 -0.0982383 18.6829 -0.0982383 18.2929 0.292762L11 7.58573L3.70701 0.292762C3.51151 0.0972617 3.25585 -0.000206962 2.99998 -0.000206962Z" />
|
|
16
|
+
</svg>
|
|
17
|
+
</Action>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closestCorners,
|
|
3
|
+
getFirstCollision,
|
|
4
|
+
KeyboardCode,
|
|
5
|
+
DroppableContainer,
|
|
6
|
+
KeyboardCoordinateGetter,
|
|
7
|
+
} from '@dnd-kit/core';
|
|
8
|
+
|
|
9
|
+
const directions = [
|
|
10
|
+
KeyboardCode.Down,
|
|
11
|
+
KeyboardCode.Right,
|
|
12
|
+
KeyboardCode.Up,
|
|
13
|
+
KeyboardCode.Left,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const coordinateGetter = (
|
|
17
|
+
event,
|
|
18
|
+
{context: {active, droppableRects, droppableContainers, collisionRect}}
|
|
19
|
+
) => {
|
|
20
|
+
if (directions.includes(event.code)) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
|
|
23
|
+
if (!active || !collisionRect) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const filteredContainers = [];
|
|
28
|
+
|
|
29
|
+
droppableContainers.getEnabled().forEach((entry) => {
|
|
30
|
+
if (!entry || entry?.disabled) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const rect = droppableRects.get(entry.id);
|
|
35
|
+
|
|
36
|
+
if (!rect) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const data = entry.data.current;
|
|
41
|
+
|
|
42
|
+
if (data) {
|
|
43
|
+
const {type, children} = data;
|
|
44
|
+
|
|
45
|
+
if (type === 'container' && children?.length > 0) {
|
|
46
|
+
if (active.data.current?.type !== 'container') {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
switch (event.code) {
|
|
53
|
+
case KeyboardCode.Down:
|
|
54
|
+
if (collisionRect.top < rect.top) {
|
|
55
|
+
filteredContainers.push(entry);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case KeyboardCode.Up:
|
|
59
|
+
if (collisionRect.top > rect.top) {
|
|
60
|
+
filteredContainers.push(entry);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case KeyboardCode.Left:
|
|
64
|
+
if (collisionRect.left >= rect.left + rect.width) {
|
|
65
|
+
filteredContainers.push(entry);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case KeyboardCode.Right:
|
|
69
|
+
if (collisionRect.left + collisionRect.width <= rect.left) {
|
|
70
|
+
filteredContainers.push(entry);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const collisions = closestCorners({
|
|
77
|
+
active,
|
|
78
|
+
collisionRect: collisionRect,
|
|
79
|
+
droppableRects,
|
|
80
|
+
droppableContainers: filteredContainers,
|
|
81
|
+
pointerCoordinates: null,
|
|
82
|
+
});
|
|
83
|
+
const closestId = getFirstCollision(collisions, 'id');
|
|
84
|
+
|
|
85
|
+
if (closestId != null) {
|
|
86
|
+
const newDroppable = droppableContainers.get(closestId);
|
|
87
|
+
const newNode = newDroppable?.node.current;
|
|
88
|
+
const newRect = newDroppable?.rect.current;
|
|
89
|
+
|
|
90
|
+
if (newNode && newRect) {
|
|
91
|
+
if (newDroppable.id === 'placeholder') {
|
|
92
|
+
return {
|
|
93
|
+
x: newRect.left + (newRect.width - collisionRect.width) / 2,
|
|
94
|
+
y: newRect.top + (newRect.height - collisionRect.height) / 2,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (newDroppable.data.current?.type === 'container') {
|
|
99
|
+
return {
|
|
100
|
+
x: newRect.left + 20,
|
|
101
|
+
y: newRect.top + 74,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
x: newRect.left,
|
|
107
|
+
y: newRect.top,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return undefined;
|
|
114
|
+
};
|