@elliemae/ds-drag-and-drop 2.4.1 → 2.4.2-rc.3
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.
|
@@ -46,21 +46,23 @@ const getVerticalKeyboardCoordinates = _ref => {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const rect = container.rect.current;
|
|
49
|
+
const rect = container.rect.current; // We add and substract 2 just for the sake of avoiding edge cases
|
|
50
50
|
|
|
51
51
|
if (rect && event.code === core.KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {
|
|
52
52
|
layoutRects.push(container);
|
|
53
|
-
} else if (rect && event.code === core.KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {
|
|
53
|
+
} else if (rect && event.code === core.KeyboardCode.Up && collisionRect.top + 2 >= rect.offsetTop) {
|
|
54
54
|
layoutRects.push(container);
|
|
55
55
|
}
|
|
56
|
-
});
|
|
56
|
+
}); // Get the closest rect based on dnd-kit closest-corners algorithm
|
|
57
|
+
|
|
57
58
|
const closestId = core.closestCorners({
|
|
58
59
|
collisionRect,
|
|
59
60
|
droppableContainers: layoutRects,
|
|
60
61
|
active
|
|
61
62
|
});
|
|
62
63
|
const closestItem = items.find(item => item.uid === closestId);
|
|
63
|
-
const closestElement = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current;
|
|
64
|
+
const closestElement = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current; // If no rect is closest, do nothing
|
|
65
|
+
|
|
64
66
|
if (!closestId || !closestItem || !closestElement) return undefined;
|
|
65
67
|
const closestRect = core.getViewRect(closestElement);
|
|
66
68
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
3
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
@@ -7,6 +5,8 @@ import 'core-js/modules/esnext.iterator.map.js';
|
|
|
7
5
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
6
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
7
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
10
10
|
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
11
11
|
import { MeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
|
|
12
12
|
import { useHierarchyActionHandlers } from './useHierarchyActionHandlers.js';
|
|
@@ -38,21 +38,23 @@ const getVerticalKeyboardCoordinates = _ref => {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const rect = container.rect.current;
|
|
41
|
+
const rect = container.rect.current; // We add and substract 2 just for the sake of avoiding edge cases
|
|
42
42
|
|
|
43
43
|
if (rect && event.code === KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {
|
|
44
44
|
layoutRects.push(container);
|
|
45
|
-
} else if (rect && event.code === KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {
|
|
45
|
+
} else if (rect && event.code === KeyboardCode.Up && collisionRect.top + 2 >= rect.offsetTop) {
|
|
46
46
|
layoutRects.push(container);
|
|
47
47
|
}
|
|
48
|
-
});
|
|
48
|
+
}); // Get the closest rect based on dnd-kit closest-corners algorithm
|
|
49
|
+
|
|
49
50
|
const closestId = closestCorners({
|
|
50
51
|
collisionRect,
|
|
51
52
|
droppableContainers: layoutRects,
|
|
52
53
|
active
|
|
53
54
|
});
|
|
54
55
|
const closestItem = items.find(item => item.uid === closestId);
|
|
55
|
-
const closestElement = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current;
|
|
56
|
+
const closestElement = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current; // If no rect is closest, do nothing
|
|
57
|
+
|
|
56
58
|
if (!closestId || !closestItem || !closestElement) return undefined;
|
|
57
59
|
const closestRect = getViewRect(closestElement);
|
|
58
60
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
3
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
@@ -7,6 +5,8 @@ import 'core-js/modules/esnext.iterator.map.js';
|
|
|
7
5
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
6
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
7
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
10
10
|
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
11
11
|
import { MeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
|
|
12
12
|
import { useTreePreviewHandlers } from './useTreePreviewHandlers.js';
|