@elliemae/ds-data-table 2.0.0-rc.1 → 2.0.0-rc.13
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/cjs/DataTableSchema.js +21 -12
- package/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +16 -0
- package/cjs/addons/Filters/Components/CurrencyRangeFilter/index.js +24 -2
- package/cjs/addons/Filters/Components/DateRangeFilter/index.js +4 -1
- package/cjs/addons/Filters/Components/NumberRangeFilter/index.js +25 -3
- package/cjs/addons/Filters/Components/SingleDateFilter/index.js +4 -1
- package/cjs/addons/Filters/Components/index.js +0 -2
- package/cjs/addons/Filters/index.js +0 -2
- package/cjs/configs/usePaginationConfig.js +1 -1
- package/cjs/configs/useRowFlattenization.js +3 -3
- package/cjs/exported-related/EditableCell.js +13 -7
- package/cjs/exported-related/FilterPopover.js +17 -3
- package/cjs/exported-related/FilterTypes.js +0 -1
- package/cjs/exported-related/Filters/applyOutOfTheBoxFilters.js +0 -2
- package/cjs/exported-related/Filters/index.js +0 -2
- package/cjs/exported-related/index.js +0 -2
- package/cjs/helpers/refs-helpers.js +2 -2
- package/cjs/index.js +0 -2
- package/cjs/parts/FilterBar/FiltersBar.js +0 -2
- package/cjs/parts/FilterBar/components/index.js +0 -2
- package/cjs/parts/Filters/index.js +10 -12
- package/cjs/parts/Headers/HeaderCellGroup.js +4 -3
- package/cjs/parts/Headers/index.js +1 -1
- package/cjs/parts/Headers/useHeaderCellHandlers.js +4 -2
- package/cjs/parts/HoC/withConditionalDnDColumnContext.js +37 -16
- package/cjs/parts/HoC/withConditionalDnDRowContext.js +11 -12
- package/cjs/parts/HoC/withConditionalDnDSortableContext.js +1 -1
- package/cjs/parts/HoC/withDnDSortableColumnContext.js +5 -19
- package/cjs/parts/HoC/withDnDSortableRowContext.js +3 -17
- package/cjs/parts/Row.js +10 -10
- package/cjs/parts/Rows.js +1 -1
- package/cjs/parts/index.js +1 -1
- package/cjs/styled.js +18 -13
- package/esm/DataTableSchema.js +21 -12
- package/esm/addons/Editables/TextEditableCell/TextEditableCell.js +16 -0
- package/esm/addons/Filters/Components/CurrencyRangeFilter/index.js +24 -2
- package/esm/addons/Filters/Components/DateRangeFilter/index.js +4 -1
- package/esm/addons/Filters/Components/NumberRangeFilter/index.js +25 -3
- package/esm/addons/Filters/Components/SingleDateFilter/index.js +4 -1
- package/esm/addons/Filters/Components/index.js +0 -1
- package/esm/addons/Filters/index.js +0 -1
- package/esm/configs/usePaginationConfig.js +1 -1
- package/esm/configs/useRowFlattenization.js +3 -3
- package/esm/exported-related/EditableCell.js +13 -7
- package/esm/exported-related/FilterPopover.js +17 -3
- package/esm/exported-related/FilterTypes.js +0 -1
- package/esm/exported-related/Filters/applyOutOfTheBoxFilters.js +0 -2
- package/esm/exported-related/Filters/index.js +0 -1
- package/esm/exported-related/index.js +0 -1
- package/esm/helpers/refs-helpers.js +2 -2
- package/esm/index.js +0 -1
- package/esm/parts/FilterBar/FiltersBar.js +0 -2
- package/esm/parts/FilterBar/components/index.js +0 -1
- package/esm/parts/Filters/index.js +0 -2
- package/esm/parts/Headers/HeaderCellGroup.js +4 -4
- package/esm/parts/Headers/index.js +2 -2
- package/esm/parts/Headers/useHeaderCellHandlers.js +4 -2
- package/esm/parts/HoC/withConditionalDnDColumnContext.js +38 -17
- package/esm/parts/HoC/withConditionalDnDRowContext.js +12 -13
- package/esm/parts/HoC/withConditionalDnDSortableContext.js +1 -1
- package/esm/parts/HoC/withDnDSortableColumnContext.js +6 -20
- package/esm/parts/HoC/withDnDSortableRowContext.js +4 -18
- package/esm/parts/Row.js +7 -10
- package/esm/styled.js +18 -13
- package/package.json +26 -103
- package/types/DataTable.d.ts +245 -43
- package/types/DataTableSchema.d.ts +245 -43
- package/types/addons/Filters/Components/SelectFilter/components.d.ts +6 -6
- package/types/addons/Filters/Components/index.d.ts +0 -1
- package/types/exported-related/FilterTypes.d.ts +0 -1
- package/types/exported-related/Filters/index.d.ts +0 -1
- package/types/helpers/refs-helpers.d.ts +1 -1
- package/types/parts/FilterBar/components/index.d.ts +0 -1
- package/types/parts/FilterBar/styled.d.ts +165 -30
- package/types/parts/Headers/HeaderCellGroup.d.ts +4 -3
- package/types/parts/Row.d.ts +2 -1
- package/types/styled.d.ts +21 -19
- package/types/types/props.d.ts +2 -2
- package/cjs/addons/Filters/Components/TextInputFilter/index.js +0 -92
- package/cjs/exported-related/Filters/textFilterFn.js +0 -14
- package/cjs/helpers/dndkit/hierarchy/customCollisionDetection.js +0 -76
- package/cjs/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +0 -141
- package/cjs/helpers/dndkit/hierarchy/types.js +0 -2
- package/cjs/helpers/dndkit/hierarchy/useHierarchyActionHandlers.js +0 -55
- package/cjs/helpers/dndkit/hierarchy/useHierarchyAnnouncements.js +0 -36
- package/cjs/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +0 -109
- package/cjs/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.js +0 -87
- package/cjs/helpers/dndkit/tree/customCollisionDetection.js +0 -98
- package/cjs/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +0 -139
- package/cjs/helpers/dndkit/tree/types.js +0 -2
- package/cjs/helpers/dndkit/tree/useTreeActionHandlers.js +0 -75
- package/cjs/helpers/dndkit/tree/useTreeAnnouncements.js +0 -55
- package/cjs/helpers/dndkit/tree/useTreeDndkitConfig.js +0 -139
- package/cjs/helpers/dndkit/tree/useTreePreviewHandlers.js +0 -54
- package/cjs/helpers/dndkit/types.js +0 -2
- package/cjs/helpers/dndkit/utilities.js +0 -52
- package/cjs/parts/FilterBar/components/TextPill.js +0 -42
- package/cjs/parts/HoC/DragOverlayContext.js +0 -11
- package/esm/addons/Filters/Components/TextInputFilter/index.js +0 -84
- package/esm/exported-related/Filters/textFilterFn.js +0 -10
- package/esm/helpers/dndkit/hierarchy/customCollisionDetection.js +0 -72
- package/esm/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.js +0 -133
- package/esm/helpers/dndkit/hierarchy/types.js +0 -1
- package/esm/helpers/dndkit/hierarchy/useHierarchyActionHandlers.js +0 -51
- package/esm/helpers/dndkit/hierarchy/useHierarchyAnnouncements.js +0 -32
- package/esm/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.js +0 -103
- package/esm/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.js +0 -83
- package/esm/helpers/dndkit/tree/customCollisionDetection.js +0 -94
- package/esm/helpers/dndkit/tree/getTreeKeyboardCoordinates.js +0 -131
- package/esm/helpers/dndkit/tree/types.js +0 -1
- package/esm/helpers/dndkit/tree/useTreeActionHandlers.js +0 -71
- package/esm/helpers/dndkit/tree/useTreeAnnouncements.js +0 -51
- package/esm/helpers/dndkit/tree/useTreeDndkitConfig.js +0 -133
- package/esm/helpers/dndkit/tree/useTreePreviewHandlers.js +0 -50
- package/esm/helpers/dndkit/types.js +0 -1
- package/esm/helpers/dndkit/utilities.js +0 -47
- package/esm/parts/FilterBar/components/TextPill.js +0 -34
- package/esm/parts/HoC/DragOverlayContext.js +0 -7
- package/types/addons/Filters/Components/TextInputFilter/index.d.ts +0 -3
- package/types/exported-related/Filters/textFilterFn.d.ts +0 -2
- package/types/helpers/dndkit/hierarchy/customCollisionDetection.d.ts +0 -3
- package/types/helpers/dndkit/hierarchy/getHierarchyKeyboardCoordinates.d.ts +0 -3
- package/types/helpers/dndkit/hierarchy/types.d.ts +0 -66
- package/types/helpers/dndkit/hierarchy/useHierarchyActionHandlers.d.ts +0 -2
- package/types/helpers/dndkit/hierarchy/useHierarchyAnnouncements.d.ts +0 -3
- package/types/helpers/dndkit/hierarchy/useHierarchyDndkitConfig.d.ts +0 -3
- package/types/helpers/dndkit/hierarchy/useHierarchyPreviewHandlers.d.ts +0 -2
- package/types/helpers/dndkit/tree/customCollisionDetection.d.ts +0 -4
- package/types/helpers/dndkit/tree/getTreeKeyboardCoordinates.d.ts +0 -3
- package/types/helpers/dndkit/tree/types.d.ts +0 -83
- package/types/helpers/dndkit/tree/useTreeActionHandlers.d.ts +0 -2
- package/types/helpers/dndkit/tree/useTreeAnnouncements.d.ts +0 -4
- package/types/helpers/dndkit/tree/useTreeDndkitConfig.d.ts +0 -3
- package/types/helpers/dndkit/tree/useTreePreviewHandlers.d.ts +0 -2
- package/types/helpers/dndkit/types.d.ts +0 -20
- package/types/helpers/dndkit/utilities.d.ts +0 -7
- package/types/parts/FilterBar/components/TextPill.d.ts +0 -2
- package/types/parts/HoC/DragOverlayContext.d.ts +0 -6
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
6
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
7
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
-
import { useState, useMemo, useRef, useEffect } from 'react';
|
|
11
|
-
import { LayoutMeasuringStrategy, useSensors, useSensor, PointerSensor, KeyboardSensor } from '@dnd-kit/core';
|
|
12
|
-
import { horizontalListSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
13
|
-
import { useTreePreviewHandlers } from './useTreePreviewHandlers.js';
|
|
14
|
-
import { getTreeKeyboardCoordinates } from './getTreeKeyboardCoordinates.js';
|
|
15
|
-
import { removeChildrenOf, getProjection } from '../utilities.js';
|
|
16
|
-
import { useTreeActionHandlers } from './useTreeActionHandlers.js';
|
|
17
|
-
import { customCollisionDetection } from './customCollisionDetection.js';
|
|
18
|
-
import { useTreeAnnouncements } from './useTreeAnnouncements.js';
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
|
-
// if second parameter is true, the space will be done on the horizontal axis
|
|
24
|
-
|
|
25
|
-
const adjustTranslate = function (_ref) {
|
|
26
|
-
let {
|
|
27
|
-
transform
|
|
28
|
-
} = _ref;
|
|
29
|
-
let isHorizontalDnD = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
30
|
-
|
|
31
|
-
const newTransform = _objectSpread({}, transform);
|
|
32
|
-
|
|
33
|
-
if (isHorizontalDnD) {
|
|
34
|
-
newTransform.x = transform.x + 25;
|
|
35
|
-
} else {
|
|
36
|
-
newTransform.x = transform.x + 15;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return newTransform;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const layoutMeasuring = {
|
|
43
|
-
strategy: LayoutMeasuringStrategy.BeforeDragging
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const useTreeDndkitConfig = _ref2 => {
|
|
47
|
-
var _visibleItemsDictiona, _visibleItemsDictiona2;
|
|
48
|
-
|
|
49
|
-
let {
|
|
50
|
-
flattenedItems,
|
|
51
|
-
visibleItems: preVisibleItems,
|
|
52
|
-
isHorizontalDnD = false,
|
|
53
|
-
isExpandable = false,
|
|
54
|
-
onReorder,
|
|
55
|
-
maxDragAndDropLevel
|
|
56
|
-
} = _ref2;
|
|
57
|
-
const [activeId, setActiveId] = useState(null);
|
|
58
|
-
const [overId, setOverId] = useState(null);
|
|
59
|
-
const [dropIndicatorPosition, setDropIndicatorPosition] = useState(null);
|
|
60
|
-
const [lastPosition, setLastPosition] = useState(null); // Remove activeId's children
|
|
61
|
-
|
|
62
|
-
const visibleItems = useMemo(() => removeChildrenOf(preVisibleItems, activeId), [preVisibleItems, activeId]); // Sorted ids for the library
|
|
63
|
-
|
|
64
|
-
const sortedIds = useMemo(() => visibleItems.map(item => item.uid), [visibleItems]);
|
|
65
|
-
/**
|
|
66
|
-
* Dictionary from UID to ITEM
|
|
67
|
-
* This dictionary is computed since on every DnD move, I need to know the
|
|
68
|
-
* depth of a particular row, so O(1) per DnD move instead of O(#ITEMS)
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
const visibleItemsDictionary = useMemo(() => {
|
|
72
|
-
// Using plain for to achieve O(#ITEMS) performance
|
|
73
|
-
const dictionary = {};
|
|
74
|
-
visibleItems.forEach(item => {
|
|
75
|
-
dictionary[item.uid] = item;
|
|
76
|
-
});
|
|
77
|
-
return dictionary;
|
|
78
|
-
}, [visibleItems]);
|
|
79
|
-
const modifiers = useMemo(() => [options => adjustTranslate(options, isHorizontalDnD)], [isHorizontalDnD]);
|
|
80
|
-
const sensorContext = useRef({
|
|
81
|
-
items: visibleItems,
|
|
82
|
-
dropIndicatorPosition,
|
|
83
|
-
setDropIndicatorPosition
|
|
84
|
-
});
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
sensorContext.current = {
|
|
87
|
-
items: visibleItems,
|
|
88
|
-
dropIndicatorPosition,
|
|
89
|
-
setDropIndicatorPosition
|
|
90
|
-
};
|
|
91
|
-
}, [visibleItems, dropIndicatorPosition, setDropIndicatorPosition]);
|
|
92
|
-
const coordinateGetter = useMemo(() => getTreeKeyboardCoordinates(sensorContext, isHorizontalDnD, maxDragAndDropLevel), [sensorContext, isHorizontalDnD, maxDragAndDropLevel]);
|
|
93
|
-
const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
94
|
-
coordinateGetter
|
|
95
|
-
})); // where is the activeItem being positioned (depth and parent)
|
|
96
|
-
|
|
97
|
-
const projected = useMemo(() => overId ? getProjection(visibleItems, visibleItemsDictionary, overId, dropIndicatorPosition, isExpandable) : null, [overId, visibleItems, visibleItemsDictionary, dropIndicatorPosition, isExpandable]);
|
|
98
|
-
const dragPreviewHandlers = useTreePreviewHandlers({
|
|
99
|
-
setActiveId,
|
|
100
|
-
setOverId,
|
|
101
|
-
setDropIndicatorPosition
|
|
102
|
-
});
|
|
103
|
-
const dragActionHandlers = useTreeActionHandlers(_objectSpread(_objectSpread({}, dragPreviewHandlers), {}, {
|
|
104
|
-
onReorder,
|
|
105
|
-
projected,
|
|
106
|
-
flattenedItems,
|
|
107
|
-
dropIndicatorPosition
|
|
108
|
-
}));
|
|
109
|
-
const announcements = useTreeAnnouncements(visibleItemsDictionary, dropIndicatorPosition);
|
|
110
|
-
const dndContextProps = useMemo(() => _objectSpread({
|
|
111
|
-
announcements,
|
|
112
|
-
modifiers,
|
|
113
|
-
sensors,
|
|
114
|
-
layoutMeasuring,
|
|
115
|
-
collisionDetection: customCollisionDetection(activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition)
|
|
116
|
-
}, dragActionHandlers), [announcements, modifiers, sensors, dragActionHandlers, visibleItemsDictionary, setDropIndicatorPosition, activeId, maxDragAndDropLevel, lastPosition, setLastPosition]);
|
|
117
|
-
const sortableContextProps = useMemo(() => ({
|
|
118
|
-
items: sortedIds,
|
|
119
|
-
strategy: isHorizontalDnD ? horizontalListSortingStrategy : verticalListSortingStrategy
|
|
120
|
-
}), [sortedIds, isHorizontalDnD]);
|
|
121
|
-
return {
|
|
122
|
-
dndContextProps,
|
|
123
|
-
sortableContextProps,
|
|
124
|
-
activeId,
|
|
125
|
-
activeIndex: (_visibleItemsDictiona = (_visibleItemsDictiona2 = visibleItemsDictionary[activeId]) === null || _visibleItemsDictiona2 === void 0 ? void 0 : _visibleItemsDictiona2.realIndex) !== null && _visibleItemsDictiona !== void 0 ? _visibleItemsDictiona : -1,
|
|
126
|
-
overId,
|
|
127
|
-
depth: projected ? projected.depth : 0,
|
|
128
|
-
dropIndicatorPosition,
|
|
129
|
-
visibleItems
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export { useTreeDndkitConfig as default };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext.js';
|
|
3
|
-
|
|
4
|
-
const useTreePreviewHandlers = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
setOverId,
|
|
7
|
-
setActiveId,
|
|
8
|
-
setDropIndicatorPosition
|
|
9
|
-
} = _ref;
|
|
10
|
-
const resetState = useCallback(() => {
|
|
11
|
-
setOverId(null);
|
|
12
|
-
setActiveId(null);
|
|
13
|
-
document.body.style.setProperty('cursor', '');
|
|
14
|
-
}, [setOverId, setActiveId]);
|
|
15
|
-
const handlePreviewDragStart = useCallback(_ref2 => {
|
|
16
|
-
let {
|
|
17
|
-
active: {
|
|
18
|
-
id
|
|
19
|
-
}
|
|
20
|
-
} = _ref2;
|
|
21
|
-
setActiveId(id);
|
|
22
|
-
setOverId(id);
|
|
23
|
-
setDropIndicatorPosition(DropIndicatorPosition.Inside);
|
|
24
|
-
document.body.style.setProperty('cursor', 'grabbing');
|
|
25
|
-
}, [setActiveId, setDropIndicatorPosition, setOverId]);
|
|
26
|
-
const handlePreviewDragMove = useCallback(() => null, []);
|
|
27
|
-
const handlePreviewDragOver = useCallback(_ref3 => {
|
|
28
|
-
var _over$id;
|
|
29
|
-
|
|
30
|
-
let {
|
|
31
|
-
over
|
|
32
|
-
} = _ref3;
|
|
33
|
-
setOverId((_over$id = over === null || over === void 0 ? void 0 : over.id) !== null && _over$id !== void 0 ? _over$id : null);
|
|
34
|
-
}, [setOverId]);
|
|
35
|
-
const handlePreviewDragEnd = useCallback(() => {
|
|
36
|
-
resetState();
|
|
37
|
-
}, [resetState]);
|
|
38
|
-
const handlePreviewDragCancel = useCallback(() => {
|
|
39
|
-
resetState();
|
|
40
|
-
}, [resetState]);
|
|
41
|
-
return {
|
|
42
|
-
handlePreviewDragStart,
|
|
43
|
-
handlePreviewDragMove,
|
|
44
|
-
handlePreviewDragOver,
|
|
45
|
-
handlePreviewDragEnd,
|
|
46
|
-
handlePreviewDragCancel
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { useTreePreviewHandlers };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import { DropIndicatorPosition } from '../../parts/HoC/SortableItemContext.js';
|
|
5
|
-
|
|
6
|
-
const getMinDepth = item => {
|
|
7
|
-
if (item) return item.depth;
|
|
8
|
-
return 0;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const getProjection = (items, visibleItemsDictionary, overId, dropIndicatorPosition, isExpandable) => {
|
|
12
|
-
const overItemIndex = visibleItemsDictionary[overId].realIndex;
|
|
13
|
-
const previousItem = items[overItemIndex];
|
|
14
|
-
const nextItem = items[overItemIndex + 1];
|
|
15
|
-
|
|
16
|
-
if (dropIndicatorPosition === DropIndicatorPosition.Inside && isExpandable) {
|
|
17
|
-
return {
|
|
18
|
-
depth: visibleItemsDictionary[overId].depth + 1,
|
|
19
|
-
parentId: overId
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (dropIndicatorPosition === DropIndicatorPosition.Before) {
|
|
24
|
-
return {
|
|
25
|
-
depth: getMinDepth(previousItem),
|
|
26
|
-
parentId: previousItem.parentId
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
depth: getMinDepth(nextItem),
|
|
32
|
-
parentId: nextItem === null || nextItem === void 0 ? void 0 : nextItem.parentId
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const removeChildrenOf = (items, id) => {
|
|
36
|
-
const excludeParentIds = [id];
|
|
37
|
-
return items.filter(item => {
|
|
38
|
-
if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {
|
|
39
|
-
excludeParentIds.push(item.uid);
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return true;
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { getProjection, removeChildrenOf };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
-
import { useCallback } from 'react';
|
|
6
|
-
import { DSPillGroupV2, DSPillV2 } from '@elliemae/ds-pills';
|
|
7
|
-
|
|
8
|
-
const TextPill = _ref => {
|
|
9
|
-
let {
|
|
10
|
-
columnHeader,
|
|
11
|
-
column,
|
|
12
|
-
value,
|
|
13
|
-
filters,
|
|
14
|
-
onFiltersChange,
|
|
15
|
-
prevRef,
|
|
16
|
-
innerRef,
|
|
17
|
-
nextRef
|
|
18
|
-
} = _ref;
|
|
19
|
-
const handleOnRemove = useCallback(() => {
|
|
20
|
-
if (prevRef !== null && prevRef !== void 0 && prevRef.current) prevRef.current.focus();else nextRef.current.focus();
|
|
21
|
-
onFiltersChange(filters.filter(filter => filter.id !== column));
|
|
22
|
-
}, [onFiltersChange, filters, prevRef, nextRef, column]);
|
|
23
|
-
return value ? /*#__PURE__*/_jsx(DSPillGroupV2, {}, void 0, /*#__PURE__*/_jsx(DSPillV2, {
|
|
24
|
-
type: "label",
|
|
25
|
-
label: columnHeader
|
|
26
|
-
}), /*#__PURE__*/_jsx(DSPillV2, {
|
|
27
|
-
type: "removable",
|
|
28
|
-
label: value,
|
|
29
|
-
onRemove: handleOnRemove,
|
|
30
|
-
innerRef: innerRef
|
|
31
|
-
})) : null;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { TextPill };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { DragStartEvent, DragMoveEvent, DragEndEvent, DragOverEvent, Over } from '@dnd-kit/core';
|
|
2
|
-
import { DroppableContainers } from '@dnd-kit/core/dist/store';
|
|
3
|
-
import { Coordinates, DragCancelEvent, ViewRect } from '@dnd-kit/core/dist/types';
|
|
4
|
-
import { MutableRefObject } from 'react';
|
|
5
|
-
import { TypescriptRow } from '../../../types/props';
|
|
6
|
-
import { dndContextPropsType } from '../types';
|
|
7
|
-
export declare type Item = {
|
|
8
|
-
id: string;
|
|
9
|
-
depth: number;
|
|
10
|
-
parentId: string;
|
|
11
|
-
index: number;
|
|
12
|
-
};
|
|
13
|
-
export declare type useHierarchyPreviewHandlersReturn = {
|
|
14
|
-
handlePreviewDragStart: (e: DragStartEvent) => void;
|
|
15
|
-
handlePreviewDragMove: (e: DragMoveEvent) => void;
|
|
16
|
-
handlePreviewDragOver: (e: DragOverEvent) => void;
|
|
17
|
-
handlePreviewDragEnd: (e: DragEndEvent) => void;
|
|
18
|
-
handlePreviewDragCancel: (e: DragCancelEvent) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare type useHierarchyPreviewHandlersArgs = {
|
|
21
|
-
setOverId: React.Dispatch<React.SetStateAction<string>>;
|
|
22
|
-
setActiveId: React.Dispatch<React.SetStateAction<string>>;
|
|
23
|
-
};
|
|
24
|
-
export declare type useHierarchyActionHandlersArgs = useHierarchyPreviewHandlersReturn & {
|
|
25
|
-
dndItems: Item[];
|
|
26
|
-
onReorder: (movedItem: Item, indexes: {
|
|
27
|
-
targetIndex: number;
|
|
28
|
-
fromIndex: number;
|
|
29
|
-
}) => void;
|
|
30
|
-
};
|
|
31
|
-
export declare type useHierarchyActionHandlersReturn = {
|
|
32
|
-
onDragStart: (e: DragStartEvent) => void;
|
|
33
|
-
onDragMove: (e: DragMoveEvent) => void;
|
|
34
|
-
onDragOver: (e: DragOverEvent) => void;
|
|
35
|
-
onDragEnd: (e: DragEndEvent) => void;
|
|
36
|
-
onDragCancel: (e: DragCancelEvent) => void;
|
|
37
|
-
};
|
|
38
|
-
export declare type useHierarchyDndkitConfigArgs = {
|
|
39
|
-
indentationWidth?: number;
|
|
40
|
-
flattenedItems: [Item, TypescriptRow][];
|
|
41
|
-
isHorizontalDnD?: boolean;
|
|
42
|
-
onReorder: (movedItem: Item, indexes: {
|
|
43
|
-
targetIndex: number;
|
|
44
|
-
fromIndex: number;
|
|
45
|
-
}) => void;
|
|
46
|
-
};
|
|
47
|
-
export declare type useHierarchyDndkitConfigType = (args: useHierarchyDndkitConfigArgs) => useHierarchyDndkitConfigReturn;
|
|
48
|
-
export declare type useHierarchyDndkitConfigReturn = {
|
|
49
|
-
dndContextProps: dndContextPropsType;
|
|
50
|
-
activeId: string;
|
|
51
|
-
overId: string;
|
|
52
|
-
activeIndex: number;
|
|
53
|
-
};
|
|
54
|
-
export declare type getKeyboardCoordinatesArgs = {
|
|
55
|
-
items: Item[];
|
|
56
|
-
active: string;
|
|
57
|
-
over: Over;
|
|
58
|
-
event: KeyboardEvent;
|
|
59
|
-
currentCoordinates: Coordinates;
|
|
60
|
-
droppableContainers: DroppableContainers;
|
|
61
|
-
translatedRect: ViewRect;
|
|
62
|
-
};
|
|
63
|
-
export declare type SensorContext = MutableRefObject<{
|
|
64
|
-
items: Item[];
|
|
65
|
-
offset?: number;
|
|
66
|
-
}>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { useHierarchyActionHandlersReturn, useHierarchyActionHandlersArgs } from './types';
|
|
2
|
-
export declare const useHierarchyActionHandlers: ({ handlePreviewDragStart, handlePreviewDragMove, handlePreviewDragOver, handlePreviewDragEnd, handlePreviewDragCancel, onReorder, dndItems, }: useHierarchyActionHandlersArgs) => useHierarchyActionHandlersReturn;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CollisionDetection } from '@dnd-kit/core';
|
|
2
|
-
import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext';
|
|
3
|
-
import { Item } from './types';
|
|
4
|
-
export declare const customCollisionDetection: (activeId: string, visibleItemsDictionary: Record<string, Item>, setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>, maxDragAndDropLevel: number, lastPosition: string, setLastPosition: React.Dispatch<React.SetStateAction<string>>) => CollisionDetection;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { DragStartEvent, DragMoveEvent, DragEndEvent, DragOverEvent, Over } from '@dnd-kit/core';
|
|
2
|
-
import { DroppableContainers } from '@dnd-kit/core/dist/store';
|
|
3
|
-
import { Coordinates, DragCancelEvent, ViewRect } from '@dnd-kit/core/dist/types';
|
|
4
|
-
import React, { MutableRefObject } from 'react';
|
|
5
|
-
import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext';
|
|
6
|
-
import { dndContextPropsType, sortableContextPropsType } from '../types';
|
|
7
|
-
export declare type Item = {
|
|
8
|
-
uid: string;
|
|
9
|
-
depth: number;
|
|
10
|
-
parentId: string;
|
|
11
|
-
realIndex: number;
|
|
12
|
-
original: Record<string, Record<string, any>>;
|
|
13
|
-
};
|
|
14
|
-
export declare type useTreePreviewHandlersReturn = {
|
|
15
|
-
handlePreviewDragStart: (e: DragStartEvent) => void;
|
|
16
|
-
handlePreviewDragMove: (e: DragMoveEvent) => void;
|
|
17
|
-
handlePreviewDragOver: (e: DragOverEvent) => void;
|
|
18
|
-
handlePreviewDragEnd: (e: DragEndEvent) => void;
|
|
19
|
-
handlePreviewDragCancel: (e: DragCancelEvent) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare type useTreePreviewHandlersArgs = {
|
|
22
|
-
setOverId: React.Dispatch<React.SetStateAction<string>>;
|
|
23
|
-
setActiveId: React.Dispatch<React.SetStateAction<string>>;
|
|
24
|
-
setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;
|
|
25
|
-
};
|
|
26
|
-
export declare type useTreeActionHandlersArgs = useTreePreviewHandlersReturn & {
|
|
27
|
-
dropIndicatorPosition: DropIndicatorPosition;
|
|
28
|
-
flattenedItems: Item[];
|
|
29
|
-
projected: {
|
|
30
|
-
depth: number;
|
|
31
|
-
parentId: string;
|
|
32
|
-
};
|
|
33
|
-
onReorder: (newData: Item[], indexes: {
|
|
34
|
-
targetIndex: number;
|
|
35
|
-
fromIndex: number;
|
|
36
|
-
}, considerExpanding: string) => void;
|
|
37
|
-
};
|
|
38
|
-
export declare type useTreeActionHandlersReturn = {
|
|
39
|
-
onDragStart: (e: DragStartEvent) => void;
|
|
40
|
-
onDragMove: (e: DragMoveEvent) => void;
|
|
41
|
-
onDragOver: (e: DragOverEvent) => void;
|
|
42
|
-
onDragEnd: (e: DragEndEvent) => void;
|
|
43
|
-
onDragCancel: (e: DragCancelEvent) => void;
|
|
44
|
-
};
|
|
45
|
-
export declare type useTreeDndkitConfigArgs = {
|
|
46
|
-
flattenedItems: Item[];
|
|
47
|
-
visibleItems: Item[];
|
|
48
|
-
isHorizontalDnD?: boolean;
|
|
49
|
-
isExpandable: boolean;
|
|
50
|
-
onReorder: (newData: Item[], indexes: {
|
|
51
|
-
targetIndex: number;
|
|
52
|
-
fromIndex: number;
|
|
53
|
-
}, considerExpanding: string) => void;
|
|
54
|
-
maxDragAndDropLevel: number;
|
|
55
|
-
};
|
|
56
|
-
export declare type useTreeDndkitConfigReturn = {
|
|
57
|
-
dndContextProps: dndContextPropsType;
|
|
58
|
-
sortableContextProps: sortableContextPropsType;
|
|
59
|
-
activeId: string;
|
|
60
|
-
activeIndex: number;
|
|
61
|
-
overId: string;
|
|
62
|
-
depth: number;
|
|
63
|
-
dropIndicatorPosition: DropIndicatorPosition;
|
|
64
|
-
visibleItems: Item[];
|
|
65
|
-
};
|
|
66
|
-
export declare type useTreeDndkitConfigType = (args: useTreeDndkitConfigArgs) => useTreeDndkitConfigReturn;
|
|
67
|
-
export declare type getKeyboardCoordinatesArgs = {
|
|
68
|
-
items: Item[];
|
|
69
|
-
active: string;
|
|
70
|
-
over: Over;
|
|
71
|
-
event: KeyboardEvent;
|
|
72
|
-
currentCoordinates: Coordinates;
|
|
73
|
-
droppableContainers: DroppableContainers;
|
|
74
|
-
translatedRect: ViewRect;
|
|
75
|
-
dropIndicatorPosition: DropIndicatorPosition;
|
|
76
|
-
maxDragAndDropLevel: number;
|
|
77
|
-
};
|
|
78
|
-
export declare type SensorContext = MutableRefObject<{
|
|
79
|
-
items: Item[];
|
|
80
|
-
offset?: number;
|
|
81
|
-
dropIndicatorPosition?: DropIndicatorPosition;
|
|
82
|
-
setDropIndicatorPosition?: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;
|
|
83
|
-
}>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { useTreeActionHandlersReturn, useTreeActionHandlersArgs } from './types';
|
|
2
|
-
export declare const useTreeActionHandlers: ({ handlePreviewDragStart, handlePreviewDragMove, handlePreviewDragOver, handlePreviewDragEnd, handlePreviewDragCancel, onReorder, flattenedItems, projected, dropIndicatorPosition, }: useTreeActionHandlersArgs) => useTreeActionHandlersReturn;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Announcements } from '@dnd-kit/core';
|
|
2
|
-
import { DropIndicatorPosition } from '../../../parts/HoC/SortableItemContext';
|
|
3
|
-
import { Item } from './types';
|
|
4
|
-
export declare const useTreeAnnouncements: (visibleItemsDictionary: Record<string, Item>, dropIndicatorPosition: DropIndicatorPosition) => Announcements;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Announcements, closestCenter, DragCancelEvent } from '@dnd-kit/core';
|
|
2
|
-
import type { Modifier, DragStartEvent, DragMoveEvent, DragEndEvent, DragOverEvent, LayoutMeasuring } from '@dnd-kit/core';
|
|
3
|
-
import type { SensorDescriptor, SensorOptions } from '@dnd-kit/core/dist/sensors';
|
|
4
|
-
import type { SortingStrategy } from '@dnd-kit/sortable';
|
|
5
|
-
export declare type dndContextPropsType = {
|
|
6
|
-
announcements: Announcements;
|
|
7
|
-
modifiers: Modifier[];
|
|
8
|
-
sensors: SensorDescriptor<SensorOptions>[];
|
|
9
|
-
layoutMeasuring: Partial<LayoutMeasuring>;
|
|
10
|
-
collisionDetection: typeof closestCenter;
|
|
11
|
-
onDragStart: (e: DragStartEvent) => void;
|
|
12
|
-
onDragMove: (e: DragMoveEvent) => void;
|
|
13
|
-
onDragOver: (e: DragOverEvent) => void;
|
|
14
|
-
onDragEnd: (e: DragEndEvent) => void;
|
|
15
|
-
onDragCancel: (e: DragCancelEvent) => void;
|
|
16
|
-
};
|
|
17
|
-
export declare type sortableContextPropsType = {
|
|
18
|
-
items: string[];
|
|
19
|
-
strategy: SortingStrategy;
|
|
20
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DropIndicatorPosition } from '../../parts/HoC/SortableItemContext';
|
|
2
|
-
import { Item } from './tree/types';
|
|
3
|
-
export declare const getProjection: (items: Item[], visibleItemsDictionary: Record<string, Item>, overId: string, dropIndicatorPosition: DropIndicatorPosition, isExpandable: boolean) => {
|
|
4
|
-
depth: number;
|
|
5
|
-
parentId: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const removeChildrenOf: (items: Item[], id: string) => Item[];
|