@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,12 @@
|
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var
|
|
5
|
+
var dsForm = require('@elliemae/ds-form');
|
|
6
6
|
var TreeViewContext = require('../TreeViewContext.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
10
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
11
|
-
var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
|
|
12
11
|
|
|
13
12
|
function RadioSelectable(props) {
|
|
14
13
|
const {
|
|
@@ -47,8 +46,8 @@ function RadioSelectable(props) {
|
|
|
47
46
|
};
|
|
48
47
|
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
49
48
|
}, [item, id, onSelectionChange, scrollToIndex]);
|
|
50
|
-
const radioName = React.useMemo(() =>
|
|
51
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
49
|
+
const radioName = React.useMemo(() => "radios-".concat(uniqueTreeViewUUID), [uniqueTreeViewUUID]);
|
|
50
|
+
return /*#__PURE__*/_jsx__default["default"](dsForm.DSRadio, {
|
|
52
51
|
checked: selectedCheckboxes[id] === true,
|
|
53
52
|
name: radioName,
|
|
54
53
|
disabled: item.isGroup ? disableGroups : disableLeafs,
|
package/cjs/parts/TreeItem.js
CHANGED
|
@@ -4,10 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
13
|
var React = require('react');
|
|
8
14
|
var reactSortableHoc = require('@elliemae/react-sortable-hoc');
|
|
9
15
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
-
var
|
|
16
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
11
17
|
var RadioSelectable = require('./RadioSelectable.js');
|
|
12
18
|
var CheckboxSelectable = require('./CheckboxSelectable.js');
|
|
13
19
|
var TreeViewContext = require('../TreeViewContext.js');
|
|
@@ -24,7 +30,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
24
30
|
|
|
25
31
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
32
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
27
|
-
var GripperVertical__default = /*#__PURE__*/_interopDefaultLegacy(GripperVertical);
|
|
28
33
|
|
|
29
34
|
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; }
|
|
30
35
|
|
|
@@ -34,20 +39,23 @@ const TreeListItem = dsClassnames.aggregatedClasses('li', {
|
|
|
34
39
|
role: 'treeitem'
|
|
35
40
|
})(cssClassesConstants.treeItemBlockName);
|
|
36
41
|
const TreeListItemAddonsWrapper = dsClassnames.aggregatedClasses('div')(cssClassesConstants.treeItemBlockName, 'addons');
|
|
37
|
-
const DnDHandle = reactSortableHoc.SortableHandle(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
42
|
+
const DnDHandle = reactSortableHoc.SortableHandle(_ref => {
|
|
43
|
+
let {
|
|
44
|
+
id
|
|
45
|
+
} = _ref;
|
|
46
|
+
return /*#__PURE__*/_jsx__default["default"](dsIcons.GripperVertical, {
|
|
47
|
+
"data-testid": "drag-handle",
|
|
48
|
+
className: "drag-handle",
|
|
49
|
+
size: "s",
|
|
50
|
+
onMouseDown: e => {
|
|
51
|
+
// prevent focusing the drag-handle to avoid borders
|
|
52
|
+
if (e) {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
tabIndex: "0"
|
|
57
|
+
}, "".concat(id, "-drag-handle"));
|
|
58
|
+
});
|
|
51
59
|
const TreeItem = props => {
|
|
52
60
|
const {
|
|
53
61
|
item,
|
|
@@ -106,7 +114,7 @@ const TreeItem = props => {
|
|
|
106
114
|
isAfter,
|
|
107
115
|
isValid
|
|
108
116
|
} = relativeMouseCord;
|
|
109
|
-
let className =
|
|
117
|
+
let className = "".concat(cssClassesConstants.DSTreeViewPrefix, "-").concat(cssClassesConstants.treeItemBlockName).concat(isValid ? '--valid' : '--invalid');
|
|
110
118
|
if (isBefore) className += '-drop-before';else if (isAfter) className += '-drop-after';else className += '-drop-in';
|
|
111
119
|
return className;
|
|
112
120
|
}, [withDragAndDrop, relativeMouseCord, isDraggingOverThis]);
|
|
@@ -114,22 +122,25 @@ const TreeItem = props => {
|
|
|
114
122
|
const hoverClassName = React.useMemo(() => (hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) !== item.id || withDragAndDrop && isDragging ? '' : 'hover', [hoverItem, withDragAndDrop, isDragging]);
|
|
115
123
|
const fixedHeightClassname = React.useMemo(() => {
|
|
116
124
|
if (labelOverflow === 'truncate') {
|
|
117
|
-
if (rowSize === 'compact') return
|
|
118
|
-
return
|
|
125
|
+
if (rowSize === 'compact') return "".concat(cssClassesConstants.DSTreeViewPrefix, "-").concat(cssClassesConstants.treeItemBlockName, "--fixed-height-compact");
|
|
126
|
+
return "".concat(cssClassesConstants.DSTreeViewPrefix, "-").concat(cssClassesConstants.treeItemBlockName, "--fixed-height");
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
return '';
|
|
122
130
|
}, [labelOverflow, rowSize]);
|
|
123
|
-
const finalClassName = React.useMemo(() =>
|
|
131
|
+
const finalClassName = React.useMemo(() => "".concat(dropPreviewClassName, " ").concat(fixedHeightClassname, " ").concat(selectedClassName, " ").concat(hoverClassName), [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname]);
|
|
124
132
|
const handleItemClick = React.useCallback(e => {
|
|
125
133
|
onItemClick(item, e);
|
|
126
134
|
setFocusedItem(item);
|
|
127
135
|
setSelectedItem(item);
|
|
128
136
|
onItemFocus({
|
|
129
137
|
itemIndex: item.virtualIndex,
|
|
130
|
-
scrollToItem: (
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
scrollToItem: function () {
|
|
139
|
+
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
140
|
+
align: 'start'
|
|
141
|
+
};
|
|
142
|
+
return scrollToIndex(item.virtualIndex, opts);
|
|
143
|
+
},
|
|
133
144
|
item
|
|
134
145
|
});
|
|
135
146
|
}, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var Highlighter = require('react-highlight-words');
|
|
8
|
-
var
|
|
8
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
9
9
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
10
|
var ChildrenCountDisplayer = require('./ChildrenCountDisplayer.js');
|
|
11
11
|
var cssClassesConstants = require('../config/cssClassesConstants.js');
|
|
@@ -17,18 +17,21 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
18
|
var Highlighter__default = /*#__PURE__*/_interopDefaultLegacy(Highlighter);
|
|
19
19
|
|
|
20
|
-
const ItemContent = dsClassnames.aggregatedClasses('div')(
|
|
20
|
+
const ItemContent = dsClassnames.aggregatedClasses('div')("".concat(cssClassesConstants.treeItemBlockName, "-content"));
|
|
21
21
|
const ItemValue = dsClassnames.aggregatedClasses('span')(cssClassesConstants.treeItemBlockName, 'value'); // const wrapperClassName = `${DSTreeViewPrefix}-${treeItemBlockName}-content`;
|
|
22
22
|
|
|
23
|
-
const classNameModifierWrapAll =
|
|
24
|
-
const classNameModifierTruncate =
|
|
23
|
+
const classNameModifierWrapAll = "".concat(cssClassesConstants.DSTreeViewPrefix, "-").concat(cssClassesConstants.treeItemBlockName, "__value--wrap-all");
|
|
24
|
+
const classNameModifierTruncate = "".concat(cssClassesConstants.DSTreeViewPrefix, "-").concat(cssClassesConstants.treeItemBlockName, "__value--truncate"); // eslint-disable-next-line react/prop-types
|
|
25
25
|
|
|
26
|
-
const CustomHighlight =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
26
|
+
const CustomHighlight = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
children
|
|
29
|
+
} = _ref;
|
|
30
|
+
return /*#__PURE__*/_jsx__default["default"]("mark", {
|
|
31
|
+
className: "tree-text-highlight",
|
|
32
|
+
"data-testid": "tree-text-highlight"
|
|
33
|
+
}, void 0, children);
|
|
34
|
+
};
|
|
32
35
|
|
|
33
36
|
function TreeItemText(props) {
|
|
34
37
|
var _ChildrenCountDisplay, _ChildrenCountDisplay2, _ChildrenCountDisplay3, _ChildrenCountDisplay4;
|
|
@@ -50,7 +53,7 @@ function TreeItemText(props) {
|
|
|
50
53
|
|
|
51
54
|
if (searchQuery) {
|
|
52
55
|
if (labelOverflow === 'truncate') {
|
|
53
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
56
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
54
57
|
value: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
55
58
|
children: [/*#__PURE__*/_jsx__default["default"](Highlighter__default["default"], {
|
|
56
59
|
autoEscape: true,
|
|
@@ -77,7 +80,7 @@ function TreeItemText(props) {
|
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
if (labelOverflow === 'truncate') {
|
|
80
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
83
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
81
84
|
value: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
82
85
|
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay3 || (_ChildrenCountDisplay3 = /*#__PURE__*/_jsx__default["default"](ChildrenCountDisplayer.ChildrenCountDisplayer, {
|
|
83
86
|
item: item
|
|
@@ -93,10 +96,10 @@ function TreeItemText(props) {
|
|
|
93
96
|
});
|
|
94
97
|
}, [item, searchQuery, nameKey, showChildrenAmount, labelOverflow]);
|
|
95
98
|
let className = '';
|
|
96
|
-
if (labelOverflow === 'wrap-all') className +=
|
|
97
|
-
if (labelOverflow === 'truncate') className +=
|
|
99
|
+
if (labelOverflow === 'wrap-all') className += "".concat(classNameModifierWrapAll, " ");
|
|
100
|
+
if (labelOverflow === 'truncate') className += "".concat(classNameModifierTruncate, " ");
|
|
98
101
|
return /*#__PURE__*/_jsx__default["default"](ItemContent, {
|
|
99
|
-
"data-testid":
|
|
102
|
+
"data-testid": "".concat(cssClassesConstants.treeItemBlockName, "-content")
|
|
100
103
|
}, void 0, /*#__PURE__*/_jsx__default["default"](ItemValue, {
|
|
101
104
|
className: className
|
|
102
105
|
}, void 0, Text));
|
package/cjs/parts/TreeList.js
CHANGED
|
@@ -4,10 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
14
|
var React = require('react');
|
|
8
15
|
var reactSortableHoc = require('@elliemae/react-sortable-hoc');
|
|
9
16
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
-
var
|
|
17
|
+
var dsCircularProgressIndicator = require('@elliemae/ds-circular-progress-indicator');
|
|
11
18
|
var TreeViewContext = require('../TreeViewContext.js');
|
|
12
19
|
var TreeItem = require('./TreeItem.js');
|
|
13
20
|
var cssClassesConstants = require('../config/cssClassesConstants.js');
|
|
@@ -21,20 +28,23 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
21
28
|
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; }
|
|
22
29
|
|
|
23
30
|
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__default["default"](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; }
|
|
24
|
-
const treeListNoItemsBn =
|
|
31
|
+
const treeListNoItemsBn = "".concat(cssClassesConstants.treeListBlockName, "-no-items");
|
|
25
32
|
const TreeListNoItems = dsClassnames.aggregatedClasses('div', {
|
|
26
33
|
'data-testid': treeListNoItemsBn
|
|
27
34
|
})(treeListNoItemsBn);
|
|
28
35
|
const TreeListWrapper = dsClassnames.aggregatedClasses('ul', {
|
|
29
36
|
'data-testid': cssClassesConstants.treeListBlockName,
|
|
30
37
|
role: 'tree'
|
|
31
|
-
})(cssClassesConstants.treeListBlockName, null,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
})(cssClassesConstants.treeListBlockName, null, _ref => {
|
|
39
|
+
let {
|
|
40
|
+
rowSize
|
|
41
|
+
} = _ref;
|
|
42
|
+
return {
|
|
43
|
+
["rowsize-".concat(rowSize)]: rowSize
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
const compactRowClass = "".concat(cssClassesConstants.DSTreeViewPrefix, "-tv-row-size-compact");
|
|
47
|
+
const normaRowClass = "".concat(cssClassesConstants.DSTreeViewPrefix, "-tv-row-size-normal");
|
|
38
48
|
const TreeList = props => {
|
|
39
49
|
const {
|
|
40
50
|
onMouseDragOverItem
|
|
@@ -57,13 +67,13 @@ const TreeList = props => {
|
|
|
57
67
|
totalSize,
|
|
58
68
|
virtualItems
|
|
59
69
|
} = virtualListHelpers;
|
|
60
|
-
const className =
|
|
70
|
+
const className = "".concat(rowSize === 'compact' ? "".concat(compactRowClass) : "".concat(normaRowClass));
|
|
61
71
|
return /*#__PURE__*/jsxRuntime.jsxs(TreeListWrapper, {
|
|
62
72
|
ref: virtualListRef,
|
|
63
73
|
className: className,
|
|
64
74
|
style: {
|
|
65
|
-
height:
|
|
66
|
-
width:
|
|
75
|
+
height: "".concat(typeof height === 'number' ? "".concat(height, "px") : height),
|
|
76
|
+
width: "".concat(typeof width === 'number' ? "".concat(width, "px") : width),
|
|
67
77
|
overflow: 'auto'
|
|
68
78
|
},
|
|
69
79
|
children: [isLoading ? /*#__PURE__*/_jsx__default["default"]("div", {
|
|
@@ -74,7 +84,7 @@ const TreeList = props => {
|
|
|
74
84
|
alignItems: 'center',
|
|
75
85
|
justifyContent: 'center'
|
|
76
86
|
}
|
|
77
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](
|
|
87
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsCircularProgressIndicator.DSCircularProgressIndicator, {
|
|
78
88
|
size: "xl",
|
|
79
89
|
loading: isLoading,
|
|
80
90
|
showLabel: true,
|
|
@@ -82,7 +92,7 @@ const TreeList = props => {
|
|
|
82
92
|
showTooltip: false
|
|
83
93
|
})) : null, !isLoading && virtualItems.length === 0 ? /*#__PURE__*/_jsx__default["default"](TreeListNoItems, {}, void 0, noItemsPlaceholder) : null, !isLoading && virtualItems.length !== 0 ? /*#__PURE__*/_jsx__default["default"]("div", {
|
|
84
94
|
style: {
|
|
85
|
-
height:
|
|
95
|
+
height: "".concat(totalSize, "px"),
|
|
86
96
|
width: '100%',
|
|
87
97
|
position: 'relative'
|
|
88
98
|
}
|
|
@@ -102,10 +112,10 @@ const TreeList = props => {
|
|
|
102
112
|
top: 0,
|
|
103
113
|
left: 0,
|
|
104
114
|
width: '100%',
|
|
105
|
-
transform:
|
|
115
|
+
transform: "translateY(".concat(start, "px)")
|
|
106
116
|
};
|
|
107
117
|
const listItemProps = {
|
|
108
|
-
key:
|
|
118
|
+
key: "DS-TreeView-List-Item-".concat(id),
|
|
109
119
|
virtualItemRef: measureRef,
|
|
110
120
|
index,
|
|
111
121
|
// this is consumed by the DnD HOC
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('react');
|
|
7
|
-
var
|
|
7
|
+
var dsForm = require('@elliemae/ds-form');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ function TreeViewSearchBar(props) {
|
|
|
20
20
|
totalResults,
|
|
21
21
|
value
|
|
22
22
|
} = props;
|
|
23
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
23
|
+
return /*#__PURE__*/_jsx__default["default"](dsForm.DSNavSearchBox, {
|
|
24
24
|
onChange: v => {
|
|
25
25
|
handleChange({
|
|
26
26
|
target: {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
|
|
5
7
|
// https://github.com/sindresorhus/array-move/blob/master/index.js
|
|
6
8
|
const arrayMoveMutate = (array, from, to) => {
|
|
7
9
|
const startIndex = from < 0 ? array.length + from : from;
|
package/cjs/utils/dnd-helpers.js
CHANGED
|
@@ -12,13 +12,14 @@ const keyCodes = {
|
|
|
12
12
|
up: [38, 37],
|
|
13
13
|
down: [40, 39]
|
|
14
14
|
};
|
|
15
|
-
const sameParentAsHoverItemDrop =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const sameParentAsHoverItemDrop = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
isBefore,
|
|
18
|
+
isAfter,
|
|
19
|
+
draggedItem,
|
|
20
|
+
overItem,
|
|
21
|
+
movementDirection
|
|
22
|
+
} = _ref;
|
|
22
23
|
const hoveredItemNodeNestedIndex = overItem.node.getIndex();
|
|
23
24
|
let newParentNode = treeHelpers.getItemsParentNode([overItem], true);
|
|
24
25
|
const {
|
|
@@ -44,13 +45,14 @@ const sameParentAsHoverItemDrop = ({
|
|
|
44
45
|
newParentNode
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
|
-
const inferHoverItemKinshipDrop =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const inferHoverItemKinshipDrop = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
isBefore,
|
|
51
|
+
isAfter,
|
|
52
|
+
draggedItem,
|
|
53
|
+
overItem,
|
|
54
|
+
movementDirection
|
|
55
|
+
} = _ref2;
|
|
54
56
|
const hoverItemModel = overItem.node.model;
|
|
55
57
|
const isGroupAndIsExpanded = hoverItemModel.isExpanded && hoverItemModel.children.length > 0;
|
|
56
58
|
|
|
@@ -79,13 +81,14 @@ const inferHoverItemKinshipDrop = ({
|
|
|
79
81
|
newParentNode: overItem.node
|
|
80
82
|
};
|
|
81
83
|
};
|
|
82
|
-
const isDropValid =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
const isDropValid = _ref3 => {
|
|
85
|
+
let {
|
|
86
|
+
isBefore,
|
|
87
|
+
isAfter,
|
|
88
|
+
draggedItem,
|
|
89
|
+
overItem,
|
|
90
|
+
restrictDragAndDrop
|
|
91
|
+
} = _ref3;
|
|
89
92
|
const {
|
|
90
93
|
id: movedId
|
|
91
94
|
} = draggedItem;
|
|
@@ -109,11 +112,12 @@ const isDropValid = ({
|
|
|
109
112
|
|
|
110
113
|
return true;
|
|
111
114
|
};
|
|
112
|
-
const inferKeyboardKinshipDrop =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
const inferKeyboardKinshipDrop = _ref4 => {
|
|
116
|
+
let {
|
|
117
|
+
items,
|
|
118
|
+
newIndex // movementDirection,
|
|
115
119
|
|
|
116
|
-
}
|
|
120
|
+
} = _ref4;
|
|
117
121
|
const kinship = {}; // const directionOffset = movementDirection === 'topToBottom' ? 0 : 0;
|
|
118
122
|
|
|
119
123
|
const itemBefore = items[newIndex];
|
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-params */
|
|
8
|
-
const toggleItemExpand = (itemToToggle, triggerTreeRerender
|
|
8
|
+
const toggleItemExpand = function (itemToToggle, triggerTreeRerender) {
|
|
9
|
+
let scrollTo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
|
|
9
10
|
const {
|
|
10
11
|
node: {
|
|
11
12
|
model: {
|
|
@@ -63,10 +64,11 @@ const toggleExpandAllHelper = (isExpand, treeRoot, triggerTreeRerender, setLates
|
|
|
63
64
|
}
|
|
64
65
|
setLatestToggledItem(null);
|
|
65
66
|
};
|
|
66
|
-
const useNotifyExpandedChange = (propsWithDefaults, {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const useNotifyExpandedChange = (propsWithDefaults, _ref) => {
|
|
68
|
+
let {
|
|
69
|
+
latestToggledItem,
|
|
70
|
+
expandedGroups
|
|
71
|
+
} = _ref;
|
|
70
72
|
const notifyExpandedChange = React.useCallback(expandedGroupHashmap => propsWithDefaults.onExpandChange(expandedGroupHashmap, latestToggledItem), [propsWithDefaults, latestToggledItem]);
|
|
71
73
|
React.useEffect(() => {
|
|
72
74
|
notifyExpandedChange(expandedGroups);
|
|
@@ -41,9 +41,12 @@ const useOnItemKeyDown = item => {
|
|
|
41
41
|
} = item;
|
|
42
42
|
const onItemFocusCurry = React.useCallback(newFocusItem => onItemFocus({
|
|
43
43
|
itemIndex: newFocusItem.virtualIndex,
|
|
44
|
-
scrollToItem: (
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
scrollToItem: function () {
|
|
45
|
+
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
46
|
+
align: 'start'
|
|
47
|
+
};
|
|
48
|
+
return scrollToIndex(newFocusItem.virtualIndex, opts);
|
|
49
|
+
},
|
|
47
50
|
item: newFocusItem
|
|
48
51
|
}), [onItemFocus]);
|
|
49
52
|
const onItemKeyDown = React.useCallback(e => {
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
|
|
5
13
|
/* eslint-disable no-sequences */
|
|
6
14
|
|
|
7
15
|
/* eslint-disable no-return-assign */
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
|
|
5
11
|
// allow multiple refs to be set to point to the same DOM element
|
|
6
|
-
const setMultipleRefs = (
|
|
12
|
+
const setMultipleRefs = function () {
|
|
13
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
refs[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
const filteredRefs = refs.filter(Boolean);
|
|
8
18
|
if (!filteredRefs.length) return null;
|
|
9
19
|
if (filteredRefs.length === 0) return filteredRefs[0];
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var treeHelpers = require('./tree-helpers.js');
|
|
7
12
|
|
|
@@ -27,7 +32,8 @@ const getGroupCheckState = node => {
|
|
|
27
32
|
if (anyChildChecked) return 'mixed';
|
|
28
33
|
return false;
|
|
29
34
|
};
|
|
30
|
-
const selectCheckboxItemModelParentsTillRoot = (modelToCheck
|
|
35
|
+
const selectCheckboxItemModelParentsTillRoot = function (modelToCheck) {
|
|
36
|
+
let triggerTreeRerender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
31
37
|
const newSelections = {};
|
|
32
38
|
const {
|
|
33
39
|
nodePath
|
|
@@ -40,7 +46,8 @@ const selectCheckboxItemModelParentsTillRoot = (modelToCheck, triggerTreeRerende
|
|
|
40
46
|
if (triggerTreeRerender) triggerTreeRerender();
|
|
41
47
|
return newSelections;
|
|
42
48
|
};
|
|
43
|
-
const toggleCheckboxItem = (itemToSelect
|
|
49
|
+
const toggleCheckboxItem = function (itemToSelect) {
|
|
50
|
+
let triggerTreeRerender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
44
51
|
const {
|
|
45
52
|
node: {
|
|
46
53
|
model: {
|
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.every.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.every.js');
|
|
5
13
|
var React = require('react');
|
|
6
14
|
var stringHelpers = require('./string-helpers.js');
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
const walkVisibles = function (node, callback) {
|
|
17
|
+
let skipRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
18
|
+
let highlightOnlyQuery = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
10
19
|
const {
|
|
11
20
|
children,
|
|
12
21
|
model
|
|
@@ -28,7 +37,8 @@ const walkVisibles = (node, callback, skipRoot = true, highlightOnlyQuery = fals
|
|
|
28
37
|
});
|
|
29
38
|
}
|
|
30
39
|
};
|
|
31
|
-
const walkParents = (nodePath, callback
|
|
40
|
+
const walkParents = function (nodePath, callback) {
|
|
41
|
+
let skipRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
32
42
|
const parents = [...nodePath].reverse();
|
|
33
43
|
parents.shift(); // remove current node from the parents array
|
|
34
44
|
|
|
@@ -36,7 +46,8 @@ const walkParents = (nodePath, callback, skipRoot = true) => {
|
|
|
36
46
|
|
|
37
47
|
parents.forEach(callback);
|
|
38
48
|
};
|
|
39
|
-
const walkAllNodeChildren = (node, callback
|
|
49
|
+
const walkAllNodeChildren = function (node, callback) {
|
|
50
|
+
let isFirst = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
40
51
|
const {
|
|
41
52
|
children = []
|
|
42
53
|
} = node;
|
|
@@ -54,7 +65,9 @@ const getNodeById = (treeRoot, id) => {
|
|
|
54
65
|
return nodes[0];
|
|
55
66
|
};
|
|
56
67
|
const cloneNode = (tree, node) => tree.parse(node.model);
|
|
57
|
-
const getItemsParentNode = (
|
|
68
|
+
const getItemsParentNode = function () {
|
|
69
|
+
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
70
|
+
let skipSameParentCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
58
71
|
if (items.length === 0) throw new Error("Received empty items, can't retrieve parent"); // in case we already know the items compared shares the same parent
|
|
59
72
|
|
|
60
73
|
if (!skipSameParentCheck) if (!itemsShareSameParent(items)) // if we don't know (default, we don't) check if they share the parent
|
|
@@ -71,7 +84,8 @@ const getItemsParentNode = (items = [], skipSameParentCheck = false) => {
|
|
|
71
84
|
const directParentNode = firstExistingItemPath[firstExistingItemPath.length - 2];
|
|
72
85
|
return directParentNode;
|
|
73
86
|
};
|
|
74
|
-
const itemsShareSameParent = (
|
|
87
|
+
const itemsShareSameParent = function () {
|
|
88
|
+
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
75
89
|
if (items.length === 0) throw new Error('Received empty items for comparison');
|
|
76
90
|
if (items.length === 1) return true; // when moving in first position we receive [undefined,...{items}]
|
|
77
91
|
// when moving in last position we receive [...{items}, undefined]
|
|
@@ -92,21 +106,25 @@ const itemsShareSameParent = (items = []) => {
|
|
|
92
106
|
return directParentNode === itemDirectParent;
|
|
93
107
|
});
|
|
94
108
|
};
|
|
95
|
-
const getNodeMatchesSearchQuery = (node
|
|
109
|
+
const getNodeMatchesSearchQuery = function (node) {
|
|
110
|
+
let searchQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
96
111
|
const standardizedName = stringHelpers.standardizeSearchQueryString(node.model.name);
|
|
97
112
|
const standardizedSearchQuery = stringHelpers.standardizeSearchQueryString(searchQuery);
|
|
98
113
|
return standardizedName.includes(standardizedSearchQuery);
|
|
99
114
|
};
|
|
100
|
-
const getChildrenMatchesSearchQuery = (parentNode
|
|
115
|
+
const getChildrenMatchesSearchQuery = function (parentNode) {
|
|
116
|
+
let searchQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
101
117
|
let anyChildMatch = false;
|
|
102
118
|
walkAllNodeChildren(parentNode, node => {
|
|
103
119
|
if (getNodeMatchesSearchQuery(node, searchQuery)) anyChildMatch = true;
|
|
104
120
|
});
|
|
105
121
|
return anyChildMatch;
|
|
106
122
|
};
|
|
107
|
-
const enrichNodeModelInPlace = (node
|
|
123
|
+
const enrichNodeModelInPlace = function (node) {
|
|
108
124
|
var _node$model, _node$model$children;
|
|
109
125
|
|
|
126
|
+
let searchQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
127
|
+
let selection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
110
128
|
const path = node.getPath();
|
|
111
129
|
const depth = path.length - 1;
|
|
112
130
|
node.model.nodePath = path;
|