@elliemae/ds-treeview 2.0.0-next.0 → 2.0.0-next.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/TreeView.js +6 -0
- package/cjs/config/cssClassesConstants.js +1 -1
- package/cjs/deprecated/TreeView.js +7 -1
- package/cjs/deprecated/__testUtils__/utils.js +10 -1
- package/cjs/deprecated/plugins/dnd/TreeDndPlugin.js +15 -8
- package/cjs/deprecated/plugins/dnd/renderers/DraggableItem.js +10 -5
- package/cjs/deprecated/plugins/dnd/renderers/DroppableList.js +21 -15
- package/cjs/deprecated/plugins/dnd/utils.js +42 -34
- package/cjs/deprecated/plugins/roving/TreeRovingPlugin.js +13 -3
- package/cjs/deprecated/plugins/searchable/SearchableTreePlugin.js +5 -3
- package/cjs/deprecated/plugins/searchable/utils.js +1 -1
- package/cjs/deprecated/plugins/selectable/SelectablePluginTree.js +53 -33
- package/cjs/deprecated/plugins/toolbar/TreeToolbarPlugin.js +11 -7
- package/cjs/deprecated/plugins/tree/TreeDataPlugin.js +45 -34
- package/cjs/deprecated/plugins/tree/useExpandTreeState.js +9 -5
- package/cjs/deprecated/plugins/tree/utils.js +19 -6
- package/cjs/deprecated/plugins/tree/walkTreeStrategy.js +13 -9
- package/cjs/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js +24 -10
- package/cjs/deprecated/renderers.js +17 -9
- package/cjs/parts/CheckboxSelectable.js +7 -3
- package/cjs/parts/ChildrenCountDisplayer.js +2 -2
- package/cjs/parts/ExpandCaret.js +11 -11
- package/cjs/parts/Icon.js +2 -2
- package/cjs/parts/NestingSpace.js +6 -1
- package/cjs/parts/RadioSelectable.js +3 -4
- package/cjs/parts/TreeItem.js +34 -23
- package/cjs/parts/TreeItemText.js +18 -15
- package/cjs/parts/TreeList.js +26 -16
- package/cjs/related-components/TreeViewSearchBar.js +2 -2
- package/cjs/utils/array-helpers.js +2 -0
- package/cjs/utils/dnd-helpers.js +29 -25
- package/cjs/utils/group-expands-helpers.js +7 -5
- package/cjs/utils/keyboard-helpers.js +6 -3
- package/cjs/utils/object-helpers.js +8 -0
- package/cjs/utils/refs-helpers.js +11 -1
- package/cjs/utils/selectable-helper.js +9 -2
- package/cjs/utils/tree-helpers.js +27 -9
- package/cjs/utils/useDnDHelpers.js +21 -14
- package/cjs/utils/useInstanceRefActions.js +14 -10
- package/cjs/utils/useTree.js +6 -0
- package/esm/TreeView.js +6 -0
- package/esm/config/cssClassesConstants.js +1 -1
- package/esm/deprecated/TreeView.js +7 -1
- package/esm/deprecated/__testUtils__/utils.js +10 -1
- package/esm/deprecated/plugins/dnd/TreeDndPlugin.js +14 -7
- package/esm/deprecated/plugins/dnd/renderers/DraggableItem.js +9 -3
- package/esm/deprecated/plugins/dnd/renderers/DroppableList.js +18 -11
- package/esm/deprecated/plugins/dnd/utils.js +35 -27
- package/esm/deprecated/plugins/roving/TreeRovingPlugin.js +12 -2
- package/esm/deprecated/plugins/searchable/SearchableTreePlugin.js +4 -1
- package/esm/deprecated/plugins/searchable/utils.js +1 -1
- package/esm/deprecated/plugins/selectable/SelectablePluginTree.js +45 -22
- package/esm/deprecated/plugins/toolbar/TreeToolbarPlugin.js +8 -3
- package/esm/deprecated/plugins/tree/TreeDataPlugin.js +35 -22
- package/esm/deprecated/plugins/tree/useExpandTreeState.js +7 -2
- package/esm/deprecated/plugins/tree/utils.js +19 -6
- package/esm/deprecated/plugins/tree/walkTreeStrategy.js +13 -9
- package/esm/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js +24 -10
- package/esm/deprecated/renderers.js +17 -9
- package/esm/parts/CheckboxSelectable.js +7 -2
- package/esm/parts/ChildrenCountDisplayer.js +2 -2
- package/esm/parts/ExpandCaret.js +9 -7
- package/esm/parts/Icon.js +1 -1
- package/esm/parts/NestingSpace.js +6 -1
- package/esm/parts/RadioSelectable.js +3 -3
- package/esm/parts/TreeItem.js +34 -22
- package/esm/parts/TreeItemText.js +16 -13
- package/esm/parts/TreeList.js +25 -15
- package/esm/related-components/TreeViewSearchBar.js +1 -1
- package/esm/utils/array-helpers.js +2 -0
- package/esm/utils/dnd-helpers.js +29 -25
- package/esm/utils/group-expands-helpers.js +7 -5
- package/esm/utils/keyboard-helpers.js +6 -3
- package/esm/utils/object-helpers.js +8 -0
- package/esm/utils/refs-helpers.js +11 -1
- package/esm/utils/selectable-helper.js +9 -2
- package/esm/utils/tree-helpers.js +27 -9
- package/esm/utils/useDnDHelpers.js +21 -14
- package/esm/utils/useInstanceRefActions.js +14 -10
- package/esm/utils/useTree.js +6 -0
- package/package.json +11 -10
- package/types/deprecated/plugins/tree/useExpandTreeState.d.ts +12 -2
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.constructor.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.drop.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.drop.js');
|
|
9
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
10
|
var React = require('react');
|
|
6
11
|
var lodash = require('lodash');
|
|
7
12
|
var TreeViewContext = require('../TreeViewContext.js');
|
|
8
13
|
var treeHelpers = require('./tree-helpers.js');
|
|
9
14
|
var dndHelpers = require('./dnd-helpers.js');
|
|
10
15
|
|
|
11
|
-
/* eslint-disable max-depth */
|
|
12
16
|
const useDnDHelpers = () => {
|
|
13
17
|
const ctx = React.useContext(TreeViewContext["default"]);
|
|
14
18
|
const {
|
|
@@ -31,11 +35,12 @@ const useDnDHelpers = () => {
|
|
|
31
35
|
treeRoot,
|
|
32
36
|
draggedItem
|
|
33
37
|
} = ctx;
|
|
34
|
-
const onSortEnd = React.useCallback(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const onSortEnd = React.useCallback(_ref => {
|
|
39
|
+
let {
|
|
40
|
+
oldIndex,
|
|
41
|
+
newIndex,
|
|
42
|
+
isKeySorting
|
|
43
|
+
} = _ref;
|
|
39
44
|
let newItems = lodash.cloneDeep(data);
|
|
40
45
|
const {
|
|
41
46
|
isBefore,
|
|
@@ -130,13 +135,14 @@ const useDnDHelpers = () => {
|
|
|
130
135
|
// at the top/center/bottom of an element to choose where to move the element
|
|
131
136
|
// requested in the specs
|
|
132
137
|
|
|
133
|
-
const onMouseDragOverItem = React.useCallback(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
const onMouseDragOverItem = React.useCallback(_ref2 => {
|
|
139
|
+
let {
|
|
140
|
+
event,
|
|
141
|
+
item,
|
|
142
|
+
itemIndex,
|
|
143
|
+
setIsDraggingOverThis,
|
|
144
|
+
openFolderOnHoverTimeout
|
|
145
|
+
} = _ref2;
|
|
140
146
|
const {
|
|
141
147
|
node
|
|
142
148
|
} = item;
|
|
@@ -183,7 +189,8 @@ const useDnDHelpers = () => {
|
|
|
183
189
|
setIsDraggingOverThis(true);
|
|
184
190
|
|
|
185
191
|
if (!(openFolderOnHoverTimeout !== null && openFolderOnHoverTimeout !== void 0 && openFolderOnHoverTimeout.current) && // only set the interval if it wasn't set already once
|
|
186
|
-
(draggedItem === null || draggedItem === void 0 ? void 0 : draggedItem.id) !== (item === null || item === void 0 ? void 0 : item.id) && (
|
|
192
|
+
(draggedItem === null || draggedItem === void 0 ? void 0 : draggedItem.id) !== (item === null || item === void 0 ? void 0 : item.id) && ( // don't open ghost element
|
|
193
|
+
item.isGroup || item.children.length > 0) && // only open groups
|
|
187
194
|
!restrictDragAndDrop) {
|
|
188
195
|
openFolderOnHoverTimeout.current = setTimeout(() => {
|
|
189
196
|
item.node.model.isExpanded = true;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var treeHelpers = require('./tree-helpers.js');
|
|
7
8
|
var groupExpandsHelpers = require('./group-expands-helpers.js');
|
|
8
9
|
|
|
9
|
-
const useInstanceRefActions = ({
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const useInstanceRefActions = (_ref, ctx) => {
|
|
11
|
+
let {
|
|
12
|
+
actions
|
|
13
|
+
} = _ref;
|
|
12
14
|
const {
|
|
13
15
|
props: {
|
|
14
16
|
onItemFocus
|
|
@@ -43,19 +45,21 @@ const useInstanceRefActions = ({
|
|
|
43
45
|
setPromise(p);
|
|
44
46
|
return p;
|
|
45
47
|
}, [promises, treeRoot, triggerTreeRerender, setLatestToggledItem]);
|
|
46
|
-
actions.scrollTo = React.useCallback((indx
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
actions.scrollTo = React.useCallback(function (indx) {
|
|
49
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
50
|
+
align: 'start'
|
|
51
|
+
};
|
|
49
52
|
if (scrollToIndex) scrollToIndex(indx, opts);
|
|
50
53
|
}, [scrollToIndex]);
|
|
51
54
|
actions.setSelectedItemByVirtualIndex = React.useCallback(index => {
|
|
52
55
|
const itemByIndex = visibleItems[index];
|
|
53
56
|
setSelectedItem(itemByIndex);
|
|
54
57
|
}, [visibleItems, setSelectedItem]);
|
|
55
|
-
actions.setFocusedItemByVirtualIndex = React.useCallback((index
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
actions.setFocusedItemByVirtualIndex = React.useCallback(function (index) {
|
|
59
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
60
|
+
align: 'start',
|
|
61
|
+
withScroll: false
|
|
62
|
+
};
|
|
59
63
|
const itemByIndex = visibleItems[index];
|
|
60
64
|
const onItemFocusParams = {
|
|
61
65
|
itemIndex: itemByIndex.virtualIndex,
|
package/cjs/utils/useTree.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
12
|
var React = require('react');
|
|
7
13
|
var TreeModel = require('tree-model');
|
|
8
14
|
var lodash = require('lodash');
|
package/esm/TreeView.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
9
|
import { useRef, useState, useEffect } from 'react';
|
|
4
10
|
import { useVirtual } from 'react-virtual';
|
|
5
11
|
import { v4 } from 'uuid';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const DSTreeViewPrefix = 'em-ds';
|
|
2
2
|
const treeItemBlockName = 'tree-item';
|
|
3
3
|
const treeListBlockName = 'tree-list';
|
|
4
|
-
const treeListNoItemsBn =
|
|
4
|
+
const treeListNoItemsBn = "".concat(treeListBlockName, "-no-items");
|
|
5
5
|
|
|
6
6
|
export { DSTreeViewPrefix, treeItemBlockName, treeListBlockName, treeListNoItemsBn };
|
|
@@ -1,6 +1,12 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
9
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
10
|
import 'react';
|
|
5
11
|
import useDataList from '@elliemae/ds-shared/useDataList';
|
|
6
12
|
import { TreeRenderers } from './renderers.js';
|
|
@@ -48,7 +54,7 @@ function TreeView(_ref) {
|
|
|
48
54
|
return wrapComponentIfExists(Wrapper, /*#__PURE__*/jsx(ListComponent, _objectSpread(_objectSpread({
|
|
49
55
|
records: instance.records
|
|
50
56
|
}, getListProps()), {}, {
|
|
51
|
-
className:
|
|
57
|
+
className: "em-ds-tv-row-size-".concat(rowSize)
|
|
52
58
|
})));
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
3
|
import 'core-js/modules/esnext.map.delete-all.js';
|
|
4
|
+
import 'core-js/modules/esnext.map.emplace.js';
|
|
4
5
|
import 'core-js/modules/esnext.map.every.js';
|
|
5
6
|
import 'core-js/modules/esnext.map.filter.js';
|
|
6
7
|
import 'core-js/modules/esnext.map.find.js';
|
|
@@ -13,7 +14,13 @@ import 'core-js/modules/esnext.map.merge.js';
|
|
|
13
14
|
import 'core-js/modules/esnext.map.reduce.js';
|
|
14
15
|
import 'core-js/modules/esnext.map.some.js';
|
|
15
16
|
import 'core-js/modules/esnext.map.update.js';
|
|
17
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
18
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
19
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
20
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
16
21
|
import 'core-js/modules/es.string.replace.js';
|
|
22
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
23
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
17
24
|
import 'react';
|
|
18
25
|
import { render } from '@testing-library/react';
|
|
19
26
|
import { treeItemBlockName } from '../renderers.js';
|
|
@@ -40,7 +47,9 @@ const treeItemsToMap = items => {
|
|
|
40
47
|
* @param key
|
|
41
48
|
*/
|
|
42
49
|
|
|
43
|
-
function getTreeItemsFromRender(_ref
|
|
50
|
+
function getTreeItemsFromRender(_ref) {
|
|
51
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : treeItemBlockName;
|
|
52
|
+
|
|
44
53
|
let {
|
|
45
54
|
data,
|
|
46
55
|
plugins
|
|
@@ -1,6 +1,12 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
8
|
import { useState, useCallback, useMemo } from 'react';
|
|
3
|
-
import { isEqual } from '@elliemae/ds-utilities
|
|
9
|
+
import { isEqual } from '@elliemae/ds-utilities';
|
|
4
10
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
5
11
|
import DraggableItem from './renderers/DraggableItem.js';
|
|
6
12
|
import DroppableList from './renderers/DroppableList.js';
|
|
@@ -21,12 +27,13 @@ const TreeDndPlugin = createInstancePlugin('tree-dnd', {
|
|
|
21
27
|
|
|
22
28
|
const [draggedRecord, setDraggedRecord] = useState(null); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
29
|
|
|
24
|
-
const changeRecordsPosition = useCallback(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const changeRecordsPosition = useCallback(_ref => {
|
|
31
|
+
let {
|
|
32
|
+
sourceRecord,
|
|
33
|
+
targetRecord,
|
|
34
|
+
combineWith,
|
|
35
|
+
down
|
|
36
|
+
} = _ref;
|
|
30
37
|
let nextTreeData;
|
|
31
38
|
const sourceTreePosition = getTreePosition(sourceRecord.path);
|
|
32
39
|
let targetTreePosition = {};
|
|
@@ -1,9 +1,15 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
10
|
import 'react';
|
|
5
11
|
import { Draggable } from 'react-beautiful-dnd';
|
|
6
|
-
import GripperVertical from '@elliemae/ds-icons
|
|
12
|
+
import { GripperVertical } from '@elliemae/ds-icons';
|
|
7
13
|
import { getDraggableProps } from '../utils.js';
|
|
8
14
|
import { jsx } from 'react/jsx-runtime';
|
|
9
15
|
|
|
@@ -30,7 +36,7 @@ const DraggableItem = (renderers // , instance
|
|
|
30
36
|
isDragDisabled: isDragDisabled,
|
|
31
37
|
draggableId: String(record.id),
|
|
32
38
|
index: index
|
|
33
|
-
},
|
|
39
|
+
}, "".concat(record.id, "-draggable"), (provided, snapshot) => {
|
|
34
40
|
const _getDraggableProps = getDraggableProps(props, provided, snapshot),
|
|
35
41
|
{
|
|
36
42
|
key
|
|
@@ -44,7 +50,7 @@ const DraggableItem = (renderers // , instance
|
|
|
44
50
|
}, provided.dragHandleProps), {}, {
|
|
45
51
|
className: "drag-handle",
|
|
46
52
|
tabIndex: isItemFocused ? 0 : -1
|
|
47
|
-
}),
|
|
53
|
+
}), "".concat(record.id, "-drag-handle")), ...(props.leftAddons || [])],
|
|
48
54
|
children: props.children
|
|
49
55
|
}), key);
|
|
50
56
|
});
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
10
|
import { useContext, useState, useRef, useCallback, createElement } from 'react';
|
|
5
11
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
|
6
|
-
import { cx } from '@elliemae/ds-utilities
|
|
7
|
-
import GripperVertical from '@elliemae/ds-icons
|
|
8
|
-
import { mergeRefs } from '@elliemae/ds-utilities/system';
|
|
12
|
+
import { cx, mergeRefs } from '@elliemae/ds-utilities';
|
|
13
|
+
import { GripperVertical } from '@elliemae/ds-icons';
|
|
9
14
|
import FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';
|
|
10
15
|
import { findItemById, findItemOnDocument } from '../../tree/utils.js';
|
|
11
16
|
import { getDraggableProps } from '../utils.js';
|
|
@@ -64,9 +69,10 @@ const DroppableList = (renderers, instance) => _ref => {
|
|
|
64
69
|
|
|
65
70
|
currTargetRef.current = destination || currTargetRef.current;
|
|
66
71
|
}, [records]);
|
|
67
|
-
const onDragStart = useCallback(
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
const onDragStart = useCallback(_ref2 => {
|
|
73
|
+
let {
|
|
74
|
+
source
|
|
75
|
+
} = _ref2;
|
|
70
76
|
preDragFocusedNode.current = document.activeElement; // when we move the currently focused item, preDragFocusedNode is the body of the doc
|
|
71
77
|
|
|
72
78
|
setFocusedItemWasDragged(preDragFocusedNode.current.tagName === 'BODY');
|
|
@@ -81,13 +87,14 @@ const DroppableList = (renderers, instance) => _ref => {
|
|
|
81
87
|
}, [records]);
|
|
82
88
|
const onDragEnd = useCallback( // eslint-disable-next-line complexity
|
|
83
89
|
// eslint-disable-next-line max-statements
|
|
84
|
-
|
|
85
|
-
destination,
|
|
86
|
-
source,
|
|
87
|
-
combine
|
|
88
|
-
}) => {
|
|
90
|
+
_ref3 => {
|
|
89
91
|
var _sourceRecord$parentN, _targetRecord$parentN;
|
|
90
92
|
|
|
93
|
+
let {
|
|
94
|
+
destination,
|
|
95
|
+
source,
|
|
96
|
+
combine
|
|
97
|
+
} = _ref3;
|
|
91
98
|
clearTimeout(expandTimerRef.current);
|
|
92
99
|
const sourceIndex = source.index;
|
|
93
100
|
const destinationIndex = destination && destination.index;
|
|
@@ -1,6 +1,11 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
3
|
-
import { mergeRefs } from '@elliemae/ds-utilities
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import { cx, mergeRefs, set, get, cloneDeep, arrayMove } from '@elliemae/ds-utilities';
|
|
4
9
|
|
|
5
10
|
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; }
|
|
6
11
|
|
|
@@ -55,7 +60,8 @@ const isSourceBeforeTarget = (sourcePath, targetPath) => {
|
|
|
55
60
|
|
|
56
61
|
return sourceIsBeforeTarget;
|
|
57
62
|
};
|
|
58
|
-
const updateTargetPath = (sourcePath, targetPath
|
|
63
|
+
const updateTargetPath = function (sourcePath, targetPath) {
|
|
64
|
+
let incr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
59
65
|
const nextTargetPath = [...targetPath];
|
|
60
66
|
const posToUpdate = sourcePath.length ? sourcePath.length - 1 : 0;
|
|
61
67
|
nextTargetPath.splice(posToUpdate, 1, targetPath[posToUpdate] + incr);
|
|
@@ -67,24 +73,25 @@ const getTreePosition = recordPath => ({
|
|
|
67
73
|
parentPath: getParentPath(recordPath),
|
|
68
74
|
index: recordPath.slice(-1)[0]
|
|
69
75
|
});
|
|
70
|
-
const changePositionBetweenDifferentArrays =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
const changePositionBetweenDifferentArrays = _ref => {
|
|
77
|
+
let {
|
|
78
|
+
sourceTreePosition,
|
|
79
|
+
// already extracted sourceRecord.path
|
|
80
|
+
targetTreePosition,
|
|
81
|
+
// already extracted targetRecord.path
|
|
82
|
+
// combineWith the element we want to append to the children of (this is null when the drag doesn't result in adding children)
|
|
83
|
+
combineWith,
|
|
84
|
+
sourceRecord,
|
|
85
|
+
// what we are dragging
|
|
86
|
+
targetRecord,
|
|
87
|
+
// what we are dropping on top of
|
|
88
|
+
down,
|
|
89
|
+
// ???
|
|
90
|
+
data,
|
|
91
|
+
// tree before dragEnd changes
|
|
92
|
+
childrenKey = 'children' // constant -> 'children'
|
|
93
|
+
|
|
94
|
+
} = _ref;
|
|
88
95
|
let nextTreeData = cloneDeep(data);
|
|
89
96
|
if (!sourceRecord || !sourceRecord.data) throw new Error('error while dragging, no dragged item received');
|
|
90
97
|
const sourceTreeChildren = getParentChildrenByPath(nextTreeData, sourceTreePosition.parentPath); // When moving an item we remove the item from it's former parent children array
|
|
@@ -114,12 +121,13 @@ const changePositionBetweenDifferentArrays = ({
|
|
|
114
121
|
return nextTreeData;
|
|
115
122
|
};
|
|
116
123
|
const combineWithTarget = () => {};
|
|
117
|
-
const changePositionSameArray =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
const changePositionSameArray = _ref2 => {
|
|
125
|
+
let {
|
|
126
|
+
targetTreePosition,
|
|
127
|
+
sourceRecord,
|
|
128
|
+
targetRecord,
|
|
129
|
+
data
|
|
130
|
+
} = _ref2;
|
|
123
131
|
let nextTreeData = cloneDeep(data);
|
|
124
132
|
const targetTreeChildren = getParentChildrenByPath(nextTreeData, targetTreePosition.parentPath);
|
|
125
133
|
const nextChildren = arrayMove(targetTreeChildren, sourceRecord.index, targetRecord.index); // mutates the tree. That's the reason of the clone above
|
|
@@ -1,10 +1,16 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
9
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
10
|
import { useState, useMemo, useRef } from 'react';
|
|
5
11
|
import FocusGroupProvider from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';
|
|
6
12
|
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
7
|
-
import { mergeRefs } from '@elliemae/ds-utilities
|
|
13
|
+
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
8
14
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
9
15
|
import { jsx } from 'react/jsx-runtime';
|
|
10
16
|
|
|
@@ -57,9 +63,13 @@ const TreeRovingPlugin = createInstancePlugin('tree-data', {
|
|
|
57
63
|
|
|
58
64
|
if (instance !== null && instance !== void 0 && (_instance$props = instance.props) !== null && _instance$props !== void 0 && _instance$props.onItemFocus) {
|
|
59
65
|
instance.props.onItemFocus({
|
|
60
|
-
scrollToItem: (
|
|
66
|
+
scrollToItem: function () {
|
|
61
67
|
var _props$listRef, _props$listRef$curren;
|
|
62
68
|
|
|
69
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
|
+
args[_key] = arguments[_key];
|
|
71
|
+
}
|
|
72
|
+
|
|
63
73
|
return props === null || props === void 0 ? void 0 : (_props$listRef = props.listRef) === null || _props$listRef === void 0 ? void 0 : (_props$listRef$curren = _props$listRef.current) === null || _props$listRef$curren === void 0 ? void 0 : _props$listRef$curren.scrollToItem(args);
|
|
64
74
|
},
|
|
65
75
|
itemIndex: props === null || props === void 0 ? void 0 : props.index
|
|
@@ -1,8 +1,11 @@
|
|
|
1
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';
|
|
2
5
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
3
6
|
import Highlighter from 'react-highlight-words';
|
|
4
7
|
import 'react';
|
|
5
|
-
import usePrevious from '@elliemae/ds-utilities
|
|
8
|
+
import { usePrevious } from '@elliemae/ds-utilities';
|
|
6
9
|
|
|
7
10
|
const markParentsAsChildMatch = record => {
|
|
8
11
|
let currRecord = record;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
3
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
4
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
5
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
11
|
import { useMemo, useCallback } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { cx, isFunction } from '@elliemae/ds-utilities/utils';
|
|
7
|
-
import useDerivedStateFromProps from '@elliemae/ds-utilities/hooks/useDerivedStateFromProps';
|
|
12
|
+
import { DSCheckbox, DSRadio } from '@elliemae/ds-form';
|
|
13
|
+
import { cx, useDerivedStateFromProps, isFunction } from '@elliemae/ds-utilities';
|
|
8
14
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
9
15
|
import { walkTreeStrategy } from '../tree/walkTreeStrategy.js';
|
|
10
16
|
import { getParentId, getParentChildren } from '../tree/utils.js';
|
|
@@ -15,12 +21,13 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
21
|
|
|
16
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; }
|
|
17
23
|
|
|
18
|
-
const updateParentState =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const updateParentState = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
node,
|
|
27
|
+
checked,
|
|
28
|
+
selectionState,
|
|
29
|
+
isCurrentParentChildren = true
|
|
30
|
+
} = _ref;
|
|
24
31
|
const {
|
|
25
32
|
parentNode
|
|
26
33
|
} = node;
|
|
@@ -72,10 +79,16 @@ const useSelectableTreeState = instance => {
|
|
|
72
79
|
|
|
73
80
|
return 'mixed';
|
|
74
81
|
}, [selection]);
|
|
75
|
-
const select = useCallback((record
|
|
82
|
+
const select = useCallback(function (record) {
|
|
83
|
+
let additionalActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
84
|
+
|
|
76
85
|
if (isFunction(onSelect)) {
|
|
77
86
|
onSelect(record.data, {
|
|
78
|
-
scrollToItem: (
|
|
87
|
+
scrollToItem: function () {
|
|
88
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
89
|
+
args[_key] = arguments[_key];
|
|
90
|
+
}
|
|
91
|
+
|
|
79
92
|
if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);
|
|
80
93
|
},
|
|
81
94
|
itemIndex: additionalActions === null || additionalActions === void 0 ? void 0 : additionalActions.itemIndex
|
|
@@ -117,7 +130,11 @@ const useSelectableTreeState = instance => {
|
|
|
117
130
|
}
|
|
118
131
|
|
|
119
132
|
onSelectionChange(nextSelectionState, record.data, {
|
|
120
|
-
scrollToItem: (
|
|
133
|
+
scrollToItem: function () {
|
|
134
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
135
|
+
args[_key2] = arguments[_key2];
|
|
136
|
+
}
|
|
137
|
+
|
|
121
138
|
if (additionalActions.scrollToItem) additionalActions.scrollToItem(args);
|
|
122
139
|
},
|
|
123
140
|
itemIndex: additionalActions === null || additionalActions === void 0 ? void 0 : additionalActions.itemIndex
|
|
@@ -179,9 +196,10 @@ const SelectablePluginTree = createInstancePlugin('selectable', {
|
|
|
179
196
|
return record;
|
|
180
197
|
},
|
|
181
198
|
|
|
182
|
-
getItemProps(props, instance, {
|
|
183
|
-
|
|
184
|
-
|
|
199
|
+
getItemProps(props, instance, _ref3) {
|
|
200
|
+
let {
|
|
201
|
+
record
|
|
202
|
+
} = _ref3;
|
|
185
203
|
const {
|
|
186
204
|
actions: {
|
|
187
205
|
select
|
|
@@ -195,15 +213,19 @@ const SelectablePluginTree = createInstancePlugin('selectable', {
|
|
|
195
213
|
} = instance.getInstance();
|
|
196
214
|
|
|
197
215
|
const handleSelect = () => select(record, {
|
|
198
|
-
scrollToItem: (
|
|
216
|
+
scrollToItem: function () {
|
|
199
217
|
var _props$listRef, _props$listRef$curren;
|
|
200
218
|
|
|
219
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
220
|
+
args[_key3] = arguments[_key3];
|
|
221
|
+
}
|
|
222
|
+
|
|
201
223
|
return props === null || props === void 0 ? void 0 : (_props$listRef = props.listRef) === null || _props$listRef === void 0 ? void 0 : (_props$listRef$curren = _props$listRef.current) === null || _props$listRef$curren === void 0 ? void 0 : _props$listRef$curren.scrollToItem(args);
|
|
202
224
|
},
|
|
203
225
|
itemIndex: props === null || props === void 0 ? void 0 : props.index
|
|
204
226
|
});
|
|
205
227
|
|
|
206
|
-
const checkboxAddon = isMultiSelect && /*#__PURE__*/_jsx(
|
|
228
|
+
const checkboxAddon = isMultiSelect && /*#__PURE__*/_jsx(DSCheckbox, {
|
|
207
229
|
checked: record.checked,
|
|
208
230
|
disabled: record.isGroup ? disableGroups : disableLeafs,
|
|
209
231
|
className: "tree-item-checkbox",
|
|
@@ -212,7 +234,7 @@ const SelectablePluginTree = createInstancePlugin('selectable', {
|
|
|
212
234
|
tabIndex: -1
|
|
213
235
|
});
|
|
214
236
|
|
|
215
|
-
const radioAddon = isSingleSelect && !isMultiSelect && /*#__PURE__*/_jsx(
|
|
237
|
+
const radioAddon = isSingleSelect && !isMultiSelect && /*#__PURE__*/_jsx(DSRadio, {
|
|
216
238
|
checked: !!record.checked,
|
|
217
239
|
disabled: record.isGroup ? disableGroups : disableLeafs,
|
|
218
240
|
className: "tree-item-radio",
|
|
@@ -238,9 +260,10 @@ const SelectablePluginTree = createInstancePlugin('selectable', {
|
|
|
238
260
|
hotKeys(grid) {
|
|
239
261
|
return {
|
|
240
262
|
key: 'space',
|
|
241
|
-
handler:
|
|
242
|
-
|
|
243
|
-
|
|
263
|
+
handler: _ref4 => {
|
|
264
|
+
let {
|
|
265
|
+
index
|
|
266
|
+
} = _ref4;
|
|
244
267
|
const {
|
|
245
268
|
records,
|
|
246
269
|
actions: {
|
|
@@ -1,10 +1,15 @@
|
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
9
|
import { useMemo, useContext, useRef } from 'react';
|
|
5
|
-
import MoreOptionsVert from '@elliemae/ds-icons
|
|
6
|
-
import Button from '@elliemae/ds-
|
|
7
|
-
import { runAll } from '@elliemae/ds-utilities
|
|
10
|
+
import { MoreOptionsVert } from '@elliemae/ds-icons';
|
|
11
|
+
import Button from '@elliemae/ds-button';
|
|
12
|
+
import { runAll } from '@elliemae/ds-utilities';
|
|
8
13
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
9
14
|
import ToolbarProvider, { ToolbarContext } from '@elliemae/ds-shared/toolbar/ToolbarProvider';
|
|
10
15
|
import FocusGroupContext from '@elliemae/ds-shared/FocusGroup/FocusGroupContext';
|