@elliemae/ds-data-table 2.0.0-rc.3 → 2.0.0-rc.7

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.
Files changed (85) hide show
  1. package/cjs/DataTableSchema.js +1 -1
  2. package/cjs/addons/Filters/Components/index.js +0 -2
  3. package/cjs/addons/Filters/index.js +0 -2
  4. package/cjs/exported-related/FilterPopover.js +17 -3
  5. package/cjs/exported-related/FilterTypes.js +0 -1
  6. package/cjs/exported-related/Filters/applyOutOfTheBoxFilters.js +0 -2
  7. package/cjs/exported-related/Filters/index.js +0 -2
  8. package/cjs/exported-related/index.js +0 -2
  9. package/cjs/helpers/dndkit/hierarchy/customCollisionDetection.js +27 -14
  10. package/cjs/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +22 -20
  11. package/cjs/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +5 -3
  12. package/cjs/helpers/dndkit/tree/customCollisionDetection.js +45 -25
  13. package/cjs/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +25 -30
  14. package/cjs/helpers/dndkit/tree/useTreeDndkitConfig.js +5 -3
  15. package/cjs/helpers/refs-helpers.js +2 -2
  16. package/cjs/index.js +0 -2
  17. package/cjs/parts/FilterBar/FiltersBar.js +0 -2
  18. package/cjs/parts/FilterBar/components/index.js +0 -2
  19. package/cjs/parts/Filters/index.js +10 -12
  20. package/cjs/parts/Headers/HeaderCellGroup.js +4 -3
  21. package/cjs/parts/Headers/index.js +1 -1
  22. package/cjs/parts/HoC/withConditionalDnDColumnContext.js +17 -13
  23. package/cjs/parts/HoC/withConditionalDnDRowContext.js +9 -10
  24. package/cjs/parts/HoC/withConditionalDnDSortableContext.js +1 -1
  25. package/cjs/parts/HoC/withDnDSortableColumnContext.js +5 -19
  26. package/cjs/parts/HoC/withDnDSortableRowContext.js +3 -17
  27. package/cjs/parts/Row.js +10 -10
  28. package/cjs/parts/Rows.js +1 -1
  29. package/cjs/parts/index.js +1 -1
  30. package/cjs/styled.js +1 -1
  31. package/esm/DataTableSchema.js +1 -1
  32. package/esm/addons/Filters/Components/index.js +0 -1
  33. package/esm/addons/Filters/index.js +0 -1
  34. package/esm/exported-related/FilterPopover.js +17 -3
  35. package/esm/exported-related/FilterTypes.js +0 -1
  36. package/esm/exported-related/Filters/applyOutOfTheBoxFilters.js +0 -2
  37. package/esm/exported-related/Filters/index.js +0 -1
  38. package/esm/exported-related/index.js +0 -1
  39. package/esm/helpers/dndkit/hierarchy/customCollisionDetection.js +27 -14
  40. package/esm/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +22 -20
  41. package/esm/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +6 -4
  42. package/esm/helpers/dndkit/tree/customCollisionDetection.js +45 -25
  43. package/esm/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +26 -31
  44. package/esm/helpers/dndkit/tree/useTreeDndkitConfig.js +6 -4
  45. package/esm/helpers/refs-helpers.js +2 -2
  46. package/esm/index.js +0 -1
  47. package/esm/parts/FilterBar/FiltersBar.js +0 -2
  48. package/esm/parts/FilterBar/components/index.js +0 -1
  49. package/esm/parts/Filters/index.js +0 -2
  50. package/esm/parts/Headers/HeaderCellGroup.js +4 -4
  51. package/esm/parts/Headers/index.js +2 -2
  52. package/esm/parts/HoC/withConditionalDnDColumnContext.js +19 -15
  53. package/esm/parts/HoC/withConditionalDnDRowContext.js +11 -12
  54. package/esm/parts/HoC/withConditionalDnDSortableContext.js +1 -1
  55. package/esm/parts/HoC/withDnDSortableColumnContext.js +6 -20
  56. package/esm/parts/HoC/withDnDSortableRowContext.js +4 -18
  57. package/esm/parts/Row.js +7 -10
  58. package/esm/styled.js +1 -1
  59. package/package.json +17 -33
  60. package/types/addons/Filters/Components/SelectFilter/components.d.ts +6 -6
  61. package/types/addons/Filters/Components/index.d.ts +0 -1
  62. package/types/exported-related/FilterTypes.d.ts +0 -1
  63. package/types/exported-related/Filters/index.d.ts +0 -1
  64. package/types/helpers/dndkit/hierarchy/types.d.ts +3 -3
  65. package/types/helpers/dndkit/tree/types.d.ts +3 -4
  66. package/types/helpers/dndkit/types.d.ts +2 -2
  67. package/types/helpers/refs-helpers.d.ts +1 -1
  68. package/types/parts/FilterBar/components/index.d.ts +0 -1
  69. package/types/parts/FilterBar/styled.d.ts +2 -2
  70. package/types/parts/Headers/HeaderCellGroup.d.ts +4 -3
  71. package/types/parts/Row.d.ts +2 -1
  72. package/types/styled.d.ts +19 -19
  73. package/types/types/props.d.ts +2 -2
  74. package/cjs/addons/Filters/Components/TextInputFilter/index.js +0 -92
  75. package/cjs/exported-related/Filters/textFilterFn.js +0 -14
  76. package/cjs/parts/FilterBar/components/TextPill.js +0 -42
  77. package/cjs/parts/HoC/DragOverlayContext.js +0 -11
  78. package/esm/addons/Filters/Components/TextInputFilter/index.js +0 -84
  79. package/esm/exported-related/Filters/textFilterFn.js +0 -10
  80. package/esm/parts/FilterBar/components/TextPill.js +0 -34
  81. package/esm/parts/HoC/DragOverlayContext.js +0 -7
  82. package/types/addons/Filters/Components/TextInputFilter/index.d.ts +0 -3
  83. package/types/exported-related/Filters/textFilterFn.d.ts +0 -2
  84. package/types/parts/FilterBar/components/TextPill.d.ts +0 -2
  85. package/types/parts/HoC/DragOverlayContext.d.ts +0 -6
@@ -4,11 +4,11 @@ import 'core-js/modules/esnext.iterator.constructor.js';
4
4
  import 'core-js/modules/esnext.iterator.find.js';
5
5
  import 'core-js/modules/esnext.async-iterator.for-each.js';
6
6
  import 'core-js/modules/esnext.iterator.for-each.js';
7
- import 'core-js/modules/web.dom-collections.iterator.js';
8
7
  import 'core-js/modules/esnext.async-iterator.filter.js';
9
8
  import 'core-js/modules/esnext.iterator.filter.js';
10
9
  import { KeyboardCode, getViewRect, closestCorners } from '@dnd-kit/core';
11
10
  import { DATA_TESTID } from '../../../configs/constants.js';
11
+ import 'core-js/modules/web.dom-collections.iterator.js';
12
12
  import 'core-js/modules/esnext.async-iterator.reduce.js';
13
13
  import 'core-js/modules/esnext.iterator.reduce.js';
14
14
  import 'react';
@@ -48,16 +48,14 @@ const getHorizontalKeyboardCoordinates = _ref => {
48
48
  event,
49
49
  currentCoordinates,
50
50
  droppableContainers,
51
- translatedRect
51
+ collisionRect
52
52
  } = _ref;
53
53
  if (vertical.includes(event.code)) return undefined;
54
- const activeItem = items.find(item => item.id === active);
54
+ const activeItem = items.find(item => item.id === active.id);
55
55
  const overRect = over.rect;
56
56
  const layoutRects = []; // Get the reacheable rects depending on the arrow key pressed
57
57
 
58
- Object.entries(droppableContainers).forEach(_ref2 => {
59
- let [id, container] = _ref2;
60
-
58
+ droppableContainers.forEach(container => {
61
59
  if (container !== null && container !== void 0 && container.disabled || !overRect) {
62
60
  return;
63
61
  }
@@ -68,44 +66,48 @@ const getHorizontalKeyboardCoordinates = _ref => {
68
66
  return;
69
67
  }
70
68
 
71
- const itemParent = items.find(item => item.id === id).parentId;
69
+ const itemParent = items.find(item => item.id === container.id).parentId;
72
70
  if (itemParent !== activeItem.parentId) return;
73
71
  const rect = getViewRect(node);
74
72
 
75
- if (event.code === KeyboardCode.Left && translatedRect.left > rect.right - 10) {
76
- layoutRects.push([id, rect]);
77
- } else if (event.code === KeyboardCode.Right && translatedRect.left < rect.left) {
78
- layoutRects.push([id, rect]);
73
+ if (event.code === KeyboardCode.Left && collisionRect.left > rect.right - 10) {
74
+ layoutRects.push(container);
75
+ } else if (event.code === KeyboardCode.Right && collisionRect.left < rect.left) {
76
+ layoutRects.push(container);
79
77
  }
80
78
  });
81
79
  const dragOverlayRect = (_document$querySelect = (_document$querySelect2 = document.querySelector("[data-testid=\"".concat(DATA_TESTID.DATA_TABLE_COLUMN_DRAG_OVERLAY, "\"]"))) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.getBoundingClientRect()) !== null && _document$querySelect !== void 0 ? _document$querySelect : {
82
80
  width: 150,
83
81
  left: 0
84
82
  };
85
- const closestId = closestCorners(layoutRects, translatedRect);
83
+ const closestId = closestCorners({
84
+ droppableContainers: layoutRects,
85
+ collisionRect,
86
+ active
87
+ });
86
88
  if (!closestId) return undefined;
87
- const closestRect = getViewRect(droppableContainers[closestId].node.current);
88
- const activeRect = getViewRect(droppableContainers[active].node.current);
89
+ const closestRect = getViewRect(droppableContainers.get(closestId).node.current);
90
+ const activeRect = getViewRect(droppableContainers.get(active.id).node.current);
89
91
  return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
90
92
  x: closestRect.left + (closestRect.width - dragOverlayRect.width) / 2 + (closestRect.offsetLeft < activeRect.left ? -1 : 1)
91
93
  });
92
94
  };
93
95
 
94
- const getHierarchyKeyboardCoordinates = (context, isHorizontalDnD) => (event, _ref3) => {
96
+ const getHierarchyKeyboardCoordinates = (context, isHorizontalDnD) => (event, _ref2) => {
95
97
  let {
96
- active,
97
98
  currentCoordinates,
98
99
  context: {
100
+ active,
99
101
  over,
100
- translatedRect,
102
+ collisionRect,
101
103
  droppableContainers
102
104
  }
103
- } = _ref3;
105
+ } = _ref2;
104
106
 
105
107
  if (directions.includes(event.code)) {
106
108
  event.preventDefault();
107
109
 
108
- if (!translatedRect) {
110
+ if (!collisionRect) {
109
111
  return undefined;
110
112
  }
111
113
 
@@ -121,7 +123,7 @@ const getHierarchyKeyboardCoordinates = (context, isHorizontalDnD) => (event, _r
121
123
  event,
122
124
  currentCoordinates,
123
125
  droppableContainers,
124
- translatedRect
126
+ collisionRect
125
127
  };
126
128
  if (isHorizontalDnD) return getHorizontalKeyboardCoordinates(args);
127
129
  return undefined;
@@ -10,7 +10,7 @@ import 'core-js/modules/esnext.iterator.find.js';
10
10
  import 'core-js/modules/esnext.async-iterator.for-each.js';
11
11
  import 'core-js/modules/esnext.iterator.for-each.js';
12
12
  import { useState, useMemo, useRef, useEffect } from 'react';
13
- import { LayoutMeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
13
+ import { MeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
14
14
  import { useHierarchyActionHandlers } from './useHierarchyActionHandlers.js';
15
15
  import { useHierarchyPreviewHandlers } from './useHierarchyPreviewHandlers.js';
16
16
  import { getHierarchyKeyboardCoordinates } from './getHierarchyKeyboardCoordinates.js';
@@ -39,8 +39,10 @@ const adjustTranslate = function (_ref) {
39
39
  return newTransform;
40
40
  };
41
41
 
42
- const layoutMeasuring = {
43
- strategy: LayoutMeasuringStrategy.Always
42
+ const measuring = {
43
+ droppable: {
44
+ strategy: MeasuringStrategy.Always
45
+ }
44
46
  };
45
47
 
46
48
  const useHierarchyDndkitConfig = _ref2 => {
@@ -89,7 +91,7 @@ const useHierarchyDndkitConfig = _ref2 => {
89
91
  announcements,
90
92
  modifiers,
91
93
  sensors,
92
- layoutMeasuring,
94
+ measuring,
93
95
  collisionDetection: customCollisionDetection(activeId, activeItem === null || activeItem === void 0 ? void 0 : activeItem.parentId, dndItems)
94
96
  }, dragActionHandlers), [announcements, modifiers, sensors, activeId, activeItem === null || activeItem === void 0 ? void 0 : activeItem.parentId, dndItems, dragActionHandlers]);
95
97
  return {
@@ -1,9 +1,9 @@
1
1
  import 'core-js/modules/esnext.async-iterator.find.js';
2
2
  import 'core-js/modules/esnext.iterator.constructor.js';
3
3
  import 'core-js/modules/esnext.iterator.find.js';
4
- import 'core-js/modules/web.dom-collections.iterator.js';
5
4
  import 'core-js/modules/esnext.async-iterator.reduce.js';
6
5
  import 'core-js/modules/esnext.iterator.reduce.js';
6
+ import 'core-js/modules/web.dom-collections.iterator.js';
7
7
  import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext.js';
8
8
 
9
9
  const DUMMY_ID = 'DUMMY_ID_INTERNAL_USE_ONLY';
@@ -29,58 +29,78 @@ const RECT_DOWN = {
29
29
  const thresholdRatio = 0.2; // Percentage to be inside
30
30
 
31
31
  const insideThreshold = 0.7;
32
- const customCollisionDetection = (activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition) => (rects, rect) => {
33
- const originalRect = rects.find(_ref => {
34
- let [rectId] = _ref;
35
- return rectId === activeId;
36
- }); // We first check if the item was moved up or down
32
+ const customCollisionDetection = (activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition) => _ref => {
33
+ var _originalContainer$re;
34
+
35
+ let {
36
+ droppableContainers,
37
+ collisionRect
38
+ } = _ref;
39
+ const originalContainer = droppableContainers.find(_ref2 => {
40
+ let {
41
+ id
42
+ } = _ref2;
43
+ return id === activeId;
44
+ });
45
+ const originalRect = originalContainer === null || originalContainer === void 0 ? void 0 : (_originalContainer$re = originalContainer.rect) === null || _originalContainer$re === void 0 ? void 0 : _originalContainer$re.current; // We first check if the item was moved up or down
37
46
  // This modifies how to search the matching colliding rect
38
47
 
39
48
  let isUp = lastPosition === 'up';
40
49
 
41
50
  if (originalRect) {
42
- isUp = originalRect[1].offsetTop > rect.top;
51
+ isUp = originalRect.offsetTop > collisionRect.top;
43
52
  } // Threshold
44
53
 
45
54
 
46
- const threshold = rect.height * thresholdRatio;
47
- let collidingRect = null;
55
+ const threshold = collisionRect.height * thresholdRatio;
56
+ let collidingContainer = null;
48
57
 
49
58
  if (isUp) {
50
59
  // Up -- We need to find the first rectangle downwards
51
- collidingRect = rects.reduce((acc, _ref2) => {
52
- let [rectID, rectData] = _ref2;
60
+ collidingContainer = droppableContainers.reduce((acc, container) => {
61
+ const rect = container.rect.current;
53
62
 
54
- if (rectData.offsetTop + threshold > rect.top && rectData.offsetTop < acc[1].offsetTop) {
55
- return [rectID, rectData];
63
+ if (rect.offsetTop + threshold > collisionRect.top && rect.offsetTop < acc.rect.current.offsetTop) {
64
+ return container;
56
65
  }
57
66
 
58
67
  return acc;
59
- }, [DUMMY_ID, RECT_DOWN]);
68
+ }, {
69
+ id: DUMMY_ID,
70
+ rect: {
71
+ current: RECT_DOWN
72
+ }
73
+ });
60
74
  } else {
61
75
  // Down -- We need to find the first rectangle upwards
62
- collidingRect = rects.reduce((acc, _ref3) => {
63
- let [rectID, rectData] = _ref3;
76
+ collidingContainer = droppableContainers.reduce((acc, container) => {
77
+ const rect = container.rect.current;
64
78
 
65
- if (rectData.offsetTop - threshold < rect.top && rectData.offsetTop > acc[1].offsetTop) {
66
- return [rectID, rectData];
79
+ if (rect.offsetTop - threshold < collisionRect.top && rect.offsetTop > acc.rect.current.offsetTop) {
80
+ return container;
67
81
  }
68
82
 
69
83
  return acc;
70
- }, [DUMMY_ID, RECT_UP]);
84
+ }, {
85
+ id: DUMMY_ID,
86
+ rect: {
87
+ current: RECT_UP
88
+ }
89
+ });
71
90
  } // If we didn't find a match, return null
72
91
 
73
92
 
74
- if (collidingRect[0] === DUMMY_ID) {
93
+ if (collidingContainer.id === DUMMY_ID) {
75
94
  return null;
76
- } // Calculate the intersection interval
95
+ }
77
96
 
97
+ const collidingRect = collidingContainer.rect.current; // Calculate the intersection interval
78
98
 
79
- const [top, bottom] = [Math.max(rect.top, collidingRect[1].offsetTop), Math.min(rect.bottom, collidingRect[1].offsetTop + collidingRect[1].height)]; // Calculate the percentage of intersection
99
+ const [top, bottom] = [Math.max(collisionRect.top, collidingRect.offsetTop), Math.min(collisionRect.bottom, collidingRect.offsetTop + collidingRect.height)]; // Calculate the percentage of intersection
80
100
 
81
- const intersectionPercentage = Math.abs(bottom - top) / collidingRect[1].height;
101
+ const intersectionPercentage = Math.abs(bottom - top) / collidingRect.height;
82
102
 
83
- if (intersectionPercentage > insideThreshold && visibleItemsDictionary[collidingRect[0]].depth + 1 <= maxDragAndDropLevel && collidingRect[0] !== activeId) {
103
+ if (intersectionPercentage > insideThreshold && visibleItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel && collidingContainer.id !== activeId) {
84
104
  setDropIndicatorPosition(DropIndicatorPosition.Inside);
85
105
  } else {
86
106
  setDropIndicatorPosition(isUp ? DropIndicatorPosition.Before : DropIndicatorPosition.After);
@@ -88,7 +108,7 @@ const customCollisionDetection = (activeId, visibleItemsDictionary, setDropIndic
88
108
 
89
109
  if (isUp && lastPosition !== 'up') setLastPosition('up');else if (!isUp && lastPosition !== 'down') setLastPosition('down'); // Return the id of the match rectangle
90
110
 
91
- return collidingRect[0];
111
+ return collidingContainer.id;
92
112
  };
93
113
 
94
114
  export { customCollisionDetection };
@@ -2,12 +2,11 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
2
  import 'core-js/modules/esnext.async-iterator.for-each.js';
3
3
  import 'core-js/modules/esnext.iterator.constructor.js';
4
4
  import 'core-js/modules/esnext.iterator.for-each.js';
5
- import 'core-js/modules/web.dom-collections.iterator.js';
6
5
  import 'core-js/modules/esnext.async-iterator.find.js';
7
6
  import 'core-js/modules/esnext.iterator.find.js';
8
7
  import 'core-js/modules/esnext.async-iterator.filter.js';
9
8
  import 'core-js/modules/esnext.iterator.filter.js';
10
- import { KeyboardCode, getViewRect, closestCorners } from '@dnd-kit/core';
9
+ import { KeyboardCode, closestCorners, getViewRect } from '@dnd-kit/core';
11
10
  import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext.js';
12
11
 
13
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -24,80 +23,76 @@ const getVerticalKeyboardCoordinates = _ref => {
24
23
  event,
25
24
  currentCoordinates,
26
25
  droppableContainers,
27
- translatedRect,
26
+ collisionRect,
28
27
  dropIndicatorPosition,
29
28
  maxDragAndDropLevel
30
29
  } = _ref;
31
30
  if (horizontal.includes(event.code)) return undefined;
32
- const activeRect = droppableContainers[active].rect.current;
33
31
  const overRect = over.rect;
34
32
  const layoutRects = []; // Get the reacheable rects depending on the arrow key pressed
35
33
 
36
- Object.entries(droppableContainers).forEach(_ref2 => {
37
- let [id, container] = _ref2;
38
-
34
+ droppableContainers.forEach(container => {
39
35
  if (container !== null && container !== void 0 && container.disabled || !overRect) {
40
36
  return;
41
37
  }
42
38
 
43
- const node = container === null || container === void 0 ? void 0 : container.node.current;
44
-
45
- if (!node) {
46
- return;
47
- }
48
-
49
- const rect = getViewRect(node);
39
+ const rect = container.rect.current;
50
40
 
51
- if (event.code === KeyboardCode.Down && translatedRect.top - 2 <= rect.top) {
52
- layoutRects.push([id, rect]);
53
- } else if (event.code === KeyboardCode.Up && translatedRect.top >= rect.top) {
54
- layoutRects.push([id, rect]);
41
+ if (event.code === KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {
42
+ layoutRects.push(container);
43
+ } else if (event.code === KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {
44
+ layoutRects.push(container);
55
45
  }
56
46
  });
57
- const closestId = closestCorners(layoutRects, translatedRect);
47
+ const closestId = closestCorners({
48
+ collisionRect,
49
+ droppableContainers: layoutRects,
50
+ active
51
+ });
58
52
  if (!closestId) return undefined;
59
53
  const closestItem = items.find(item => item.uid === closestId);
60
- const closestRect = getViewRect(droppableContainers[closestId].node.current);
54
+ const closestRect = getViewRect(droppableContainers.get(closestId).node.current);
61
55
 
62
56
  if (event.code === KeyboardCode.Up) {
63
57
  // If the drop indicator is inside (or over ourselves)
64
58
  // We are gonna go to the before position
65
59
  // Else we are gonna go inside the over rect
66
- if (dropIndicatorPosition === DropIndicatorPosition.Inside || closestId === active || closestItem.depth + 1 > maxDragAndDropLevel) {
60
+ if (dropIndicatorPosition === DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
67
61
  return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
68
- y: closestRect.top - translatedRect.height / 2
62
+ y: closestRect.top - collisionRect.height / 2
69
63
  });
70
64
  }
71
65
 
72
66
  return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
73
- y: closestRect.top + Math.abs(closestRect.height - activeRect.height) / 2
67
+ y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2
74
68
  });
75
69
  } // If the drop indicator is inside (or over ourselves)
76
70
  // We are gonna go to the after position
77
71
  // Else we are gonna go inside the over rect
78
72
 
79
73
 
80
- if (dropIndicatorPosition === DropIndicatorPosition.Inside || closestId === active || closestItem.depth + 1 > maxDragAndDropLevel) {
74
+ if (dropIndicatorPosition === DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
81
75
  return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
82
- y: closestRect.top + translatedRect.height / 2
76
+ y: closestRect.top + collisionRect.height / 2
83
77
  });
84
78
  }
85
79
 
86
80
  return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
87
- y: closestRect.top + Math.abs(closestRect.height - activeRect.height) / 2
81
+ y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2
88
82
  });
89
83
  };
90
84
 
91
- const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLevel) => (event, _ref3) => {
85
+ const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLevel) => (event, _ref2) => {
92
86
  let {
93
- active,
94
87
  currentCoordinates,
95
88
  context: {
96
89
  over,
97
90
  translatedRect,
98
- droppableContainers
91
+ droppableContainers,
92
+ active,
93
+ collisionRect
99
94
  }
100
- } = _ref3;
95
+ } = _ref2;
101
96
 
102
97
  if (directions.includes(event.code)) {
103
98
  if (!translatedRect) {
@@ -117,7 +112,7 @@ const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLeve
117
112
  event,
118
113
  currentCoordinates,
119
114
  droppableContainers,
120
- translatedRect,
115
+ collisionRect,
121
116
  dropIndicatorPosition,
122
117
  maxDragAndDropLevel
123
118
  };
@@ -8,7 +8,7 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
8
8
  import 'core-js/modules/esnext.iterator.constructor.js';
9
9
  import 'core-js/modules/esnext.iterator.for-each.js';
10
10
  import { useState, useMemo, useRef, useEffect } from 'react';
11
- import { LayoutMeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
11
+ import { MeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
12
12
  import { horizontalListSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
13
13
  import { useTreePreviewHandlers } from './useTreePreviewHandlers.js';
14
14
  import { getTreeKeyboardCoordinates } from './getTreeKeyboardCoordinates.js';
@@ -39,8 +39,10 @@ const adjustTranslate = function (_ref) {
39
39
  return newTransform;
40
40
  };
41
41
 
42
- const layoutMeasuring = {
43
- strategy: LayoutMeasuringStrategy.BeforeDragging
42
+ const measuring = {
43
+ droppable: {
44
+ strategy: MeasuringStrategy.BeforeDragging
45
+ }
44
46
  };
45
47
 
46
48
  const useTreeDndkitConfig = _ref2 => {
@@ -111,7 +113,7 @@ const useTreeDndkitConfig = _ref2 => {
111
113
  announcements,
112
114
  modifiers,
113
115
  sensors,
114
- layoutMeasuring,
116
+ measuring,
115
117
  collisionDetection: customCollisionDetection(activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition)
116
118
  }, dragActionHandlers), [announcements, modifiers, sensors, dragActionHandlers, visibleItemsDictionary, setDropIndicatorPosition, activeId, maxDragAndDropLevel, lastPosition, setLastPosition]);
117
119
  const sortableContextProps = useMemo(() => ({
@@ -11,8 +11,8 @@ const setMultipleRefs = function () {
11
11
  }
12
12
 
13
13
  const filteredRefs = refs.filter(Boolean);
14
- if (!filteredRefs.length) return null;
15
- if (filteredRefs.length === 0) return filteredRefs[0];
14
+ if (!filteredRefs.length) return () => null;
15
+ if (filteredRefs.length === 0) return () => null;
16
16
  return newRef => {
17
17
  filteredRefs.forEach(refToBeUpdated => {
18
18
  if (typeof refToBeUpdated === 'function') {
package/esm/index.js CHANGED
@@ -6,7 +6,6 @@ export { groupBy } from './exported-related/groupBy.js';
6
6
  export { FILTER_TYPES } from './exported-related/FilterTypes.js';
7
7
  export { ROW_VARIANTS, ROW_VARIANT_COMPACT_KEY, ROW_VARIANT_KEY } from './exported-related/RowVariants.js';
8
8
  export { applyOutOfTheBoxFilters } from './exported-related/Filters/applyOutOfTheBoxFilters.js';
9
- export { textFilterFn } from './exported-related/Filters/textFilterFn.js';
10
9
  export { singleDateFilterFn } from './exported-related/Filters/singleDateFilterFn.js';
11
10
  export { singleSelectFilterFn } from './exported-related/Filters/singleSelectFilterFn.js';
12
11
  export { multiSelectFilterFn } from './exported-related/Filters/multiSelectFilterFn.js';
@@ -45,14 +45,12 @@ import { MultiSelectPill } from './components/MultiSelectPill.js';
45
45
  import { NumberRangePill } from './components/NumberRangePill.js';
46
46
  import { SelectPill } from './components/SelectPill.js';
47
47
  import { SingleDatePill } from './components/SingleDatePill.js';
48
- import { TextPill } from './components/TextPill.js';
49
48
  import { StyledWrapper, StyledDropdownMenu } from './styled.js';
50
49
 
51
50
  var _MoreOptionsVert;
52
51
  const pillRenderMapper = {
53
52
  [FILTER_TYPES.SELECT]: SelectPill,
54
53
  [FILTER_TYPES.MULTI_SELECT]: MultiSelectPill,
55
- [FILTER_TYPES.TEXT]: TextPill,
56
54
  [FILTER_TYPES.SINGLE_DATE]: SingleDatePill,
57
55
  [FILTER_TYPES.DATE_RANGE]: DateRangePill,
58
56
  [FILTER_TYPES.DATE_SWITCHER]: DateSwitcherPill,
@@ -4,4 +4,3 @@ export { MultiSelectPill } from './MultiSelectPill.js';
4
4
  export { NumberRangePill } from './NumberRangePill.js';
5
5
  export { SelectPill } from './SelectPill.js';
6
6
  export { SingleDatePill } from './SingleDatePill.js';
7
- export { TextPill } from './TextPill.js';
@@ -15,7 +15,6 @@ import { CurrencyRangeFilter } from '../../addons/Filters/Components/CurrencyRan
15
15
  import { SingleSelectFilter } from '../../addons/Filters/Components/SelectFilter/SingleSelectFilter.js';
16
16
  import { MultiSelectFilter } from '../../addons/Filters/Components/SelectFilter/MultiSelectFilter.js';
17
17
  import { SingleDateFilter } from '../../addons/Filters/Components/SingleDateFilter/index.js';
18
- import { TextInputFilter } from '../../addons/Filters/Components/TextInputFilter/index.js';
19
18
  import '@babel/runtime/helpers/esm/jsx';
20
19
  import '@elliemae/ds-button';
21
20
  import '@elliemae/ds-popperjs';
@@ -55,7 +54,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
55
54
  const FilterMapper = {
56
55
  [FILTER_TYPES.SELECT]: SingleSelectFilter,
57
56
  [FILTER_TYPES.MULTI_SELECT]: MultiSelectFilter,
58
- [FILTER_TYPES.TEXT]: TextInputFilter,
59
57
  [FILTER_TYPES.SINGLE_DATE]: SingleDateFilter,
60
58
  [FILTER_TYPES.DATE_RANGE]: DateRangeFilter,
61
59
  [FILTER_TYPES.DATE_SWITCHER]: DateSwitcherFilter,
@@ -54,7 +54,7 @@ const HeaderCellGroupComp = _ref => {
54
54
  const children = header.columns;
55
55
  const isDragging = draggableProps && draggableProps.isDragging || isDraggingParent;
56
56
  const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
57
- const ChildGroup = isDragOverlay ? NotSortableHeaderCellGroup : HeaderCellGroup;
57
+ const ChildGroup = isDragOverlay ? HeaderCellGroup : HeaderCellGroupSortable;
58
58
  const colSpan = (_children$length = children === null || children === void 0 ? void 0 : children.length) !== null && _children$length !== void 0 ? _children$length : 1;
59
59
  return /*#__PURE__*/jsxs(StyledWrapper, {
60
60
  ref: draggableProps ? draggableProps.setNodeRef : null,
@@ -84,7 +84,7 @@ const HeaderCellGroupComp = _ref => {
84
84
  };
85
85
 
86
86
  // We need to declare this because we MUST avoid the useSortable call in the recursive calls of the function
87
- const NotSortableHeaderCellGroup = HeaderCellGroupComp;
88
- const HeaderCellGroup = withDnDSortableColumnContext(HeaderCellGroupComp);
87
+ const HeaderCellGroup = HeaderCellGroupComp;
88
+ const HeaderCellGroupSortable = withDnDSortableColumnContext(HeaderCellGroupComp);
89
89
 
90
- export { HeaderCellGroup };
90
+ export { HeaderCellGroup, HeaderCellGroupSortable as default };
@@ -5,7 +5,7 @@ import { useContext, useMemo } from 'react';
5
5
  import { StyledHeadTr, StyledHeadWrapper } from '../../styled.js';
6
6
  import DataTableContext from '../../DataTableContext.js';
7
7
  import { withConditionalDnDColumnContext } from '../HoC/withConditionalDnDColumnContext.js';
8
- import { HeaderCellGroup } from './HeaderCellGroup.js';
8
+ import HeaderCellGroupSortable from './HeaderCellGroup.js';
9
9
  import { SortableHeaderCell } from '../SortableHeaderCell.js';
10
10
  import { jsx } from 'react/jsx-runtime';
11
11
 
@@ -29,7 +29,7 @@ const HeadersComp = () => {
29
29
  cols: gridLayout,
30
30
  colsLayoutStyle: colsLayoutStyle,
31
31
  isExpandable: isExpandable
32
- }, void 0, visibleColumns.map((h, index) => /*#__PURE__*/_jsx(HeaderCellGroup, {
32
+ }, void 0, visibleColumns.map((h, index) => /*#__PURE__*/_jsx(HeaderCellGroupSortable, {
33
33
  header: h,
34
34
  isLast: index === visibleColumns.length - 1
35
35
  }, h.id)))), [isExpandable, visibleColumns, gridLayout, colsLayoutStyle]);
@@ -1,17 +1,19 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.filter.js';
1
3
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
4
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
5
  import 'core-js/modules/esnext.async-iterator.for-each.js';
4
6
  import 'core-js/modules/esnext.iterator.constructor.js';
5
7
  import 'core-js/modules/esnext.iterator.for-each.js';
6
8
  import 'core-js/modules/web.dom-collections.iterator.js';
7
- import 'core-js/modules/esnext.async-iterator.filter.js';
8
- import 'core-js/modules/esnext.iterator.filter.js';
9
+ import 'core-js/modules/esnext.async-iterator.find.js';
10
+ import 'core-js/modules/esnext.iterator.find.js';
9
11
  import React, { useMemo, useCallback, createContext } from 'react';
10
12
  import { DndContext, DragOverlay } from '@dnd-kit/core';
11
13
  import { arrayMove } from '@dnd-kit/sortable';
12
- import { DragOverlayContext } from './DragOverlayContext.js';
13
14
  import useHierarchyDndkitConfig from '../../helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js';
14
15
  import DataTableContext from '../../DataTableContext.js';
16
+ import { HeaderCellGroup } from '../Headers/HeaderCellGroup.js';
15
17
  import { jsxs, jsx } from 'react/jsx-runtime';
16
18
 
17
19
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -26,7 +28,9 @@ const flattenColumns = cols => {
26
28
 
27
29
  const flatten = function (col, index) {
28
30
  let parentId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
29
- const id = col.Header;
31
+ const {
32
+ id
33
+ } = col;
30
34
  flattened.push([{
31
35
  id,
32
36
  parentId,
@@ -44,13 +48,11 @@ const withConditionalDnDColumnContext = Component => props => {
44
48
  const {
45
49
  tableProps: {
46
50
  dragAndDropColumns,
47
- columns,
48
51
  onColumnsReorder
49
- }
52
+ },
53
+ visibleColumns
50
54
  } = React.useContext(DataTableContext);
51
- const [PureDraggedJSX, setPureDraggedJSX] = React.useState(null); // todo: check if this can be done via portal
52
-
53
- const flattenedItems = useMemo(() => flattenColumns(columns), [columns]);
55
+ const flattenedItems = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);
54
56
  const onReorder = useCallback((movedItem, indexes) => {
55
57
  // Send from index to target index
56
58
  const newFlattenedData = arrayMove(flattenedItems, indexes.fromIndex, indexes.targetIndex); // Pull the cols's data into an object
@@ -84,15 +86,17 @@ const withConditionalDnDColumnContext = Component => props => {
84
86
  onReorder
85
87
  });
86
88
  if (dragAndDropColumns) return /*#__PURE__*/jsxs(DndContext, _objectSpread(_objectSpread({}, dndContextProps), {}, {
87
- children: [/*#__PURE__*/_jsx(DragOverlayContext.Provider, {
88
- value: {
89
- setPureDraggedJSX
90
- }
91
- }, void 0, /*#__PURE__*/_jsx(DnDGroupContext.Provider, {
89
+ children: [/*#__PURE__*/_jsx(DnDGroupContext.Provider, {
92
90
  value: {
93
91
  activeIndex
94
92
  }
95
- }, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)))), /*#__PURE__*/_jsx(DragOverlay, {}, void 0, activeId ? PureDraggedJSX : null)]
93
+ }, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props))), /*#__PURE__*/_jsx(DragOverlay, {}, void 0, activeId ? /*#__PURE__*/_jsx(HeaderCellGroup, {
94
+ header: flattenedItems.find(_ref3 => {
95
+ let [item] = _ref3;
96
+ return item.id === activeId;
97
+ })[1],
98
+ isDragOverlay: true
99
+ }) : null)]
96
100
  }));
97
101
  return /*#__PURE__*/jsx(Component, _objectSpread({}, props));
98
102
  };