@elliemae/ds-treeview 2.0.0-alpha.1 → 2.0.0-alpha.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 +9 -3
- package/cjs/TreeViewContext.js +1 -1
- package/cjs/config/cssClassesConstants.js +1 -1
- package/cjs/deprecated/TreeView.js +11 -5
- package/cjs/deprecated/__testUtils__/utils.js +13 -4
- package/cjs/deprecated/plugins/dnd/TreeDndPlugin.js +17 -10
- package/cjs/deprecated/plugins/dnd/renderers/DraggableItem.js +13 -8
- package/cjs/deprecated/plugins/dnd/renderers/DroppableList.js +26 -20
- package/cjs/deprecated/plugins/dnd/utils.js +43 -35
- package/cjs/deprecated/plugins/roving/TreeRovingPlugin.js +18 -8
- package/cjs/deprecated/plugins/searchable/SearchableTreePlugin.js +7 -5
- package/cjs/deprecated/plugins/searchable/utils.js +1 -1
- package/cjs/deprecated/plugins/selectable/SelectablePluginTree.js +55 -35
- package/cjs/deprecated/plugins/toolbar/TreeToolbarPlugin.js +18 -14
- package/cjs/deprecated/plugins/tree/TreeDataPlugin.js +51 -40
- package/cjs/deprecated/plugins/tree/useExpandTreeState.js +10 -6
- package/cjs/deprecated/plugins/tree/utils.js +21 -8
- package/cjs/deprecated/plugins/tree/walkTreeStrategy.js +13 -9
- package/cjs/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js +27 -13
- package/cjs/deprecated/renderers.js +19 -11
- package/cjs/parts/CheckboxSelectable.js +10 -6
- package/cjs/parts/ChildrenCountDisplayer.js +3 -3
- package/cjs/parts/ExpandCaret.js +14 -14
- package/cjs/parts/Icon.js +4 -4
- package/cjs/parts/NestingSpace.js +8 -3
- package/cjs/parts/RadioSelectable.js +4 -5
- package/cjs/parts/TreeItem.js +44 -33
- package/cjs/parts/TreeItemText.js +27 -24
- package/cjs/parts/TreeList.js +30 -20
- package/cjs/plugins/dnd/TreeDndPlugin.js +2 -2
- package/cjs/prop-types.js +20 -20
- 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 +7 -4
- package/cjs/utils/object-helpers.js +8 -0
- package/cjs/utils/refs-helpers.js +11 -1
- package/cjs/utils/selectable-helper.js +10 -3
- package/cjs/utils/tree-helpers.js +27 -9
- package/cjs/utils/useDnDHelpers.js +22 -15
- package/cjs/utils/useInstanceRefActions.js +14 -10
- package/cjs/utils/useTree.js +8 -2
- 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 +14 -13
- package/types/TreeView.d.ts +118 -28
- package/types/deprecated/__testUtils__/utils.d.ts +49 -49
- package/types/deprecated/plugins/tree/useExpandTreeState.d.ts +12 -2
- package/types/react-desc-prop-types.d.ts +113 -27
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -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;
|
|
@@ -36,7 +39,7 @@ function TreeItemText(props) {
|
|
|
36
39
|
const {
|
|
37
40
|
item
|
|
38
41
|
} = props;
|
|
39
|
-
const ctx = React.useContext(TreeViewContext[
|
|
42
|
+
const ctx = React.useContext(TreeViewContext["default"]);
|
|
40
43
|
const {
|
|
41
44
|
props: {
|
|
42
45
|
searchQuery,
|
|
@@ -50,14 +53,14 @@ function TreeItemText(props) {
|
|
|
50
53
|
|
|
51
54
|
if (searchQuery) {
|
|
52
55
|
if (labelOverflow === 'truncate') {
|
|
53
|
-
return /*#__PURE__*/_jsx__default[
|
|
56
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
54
57
|
value: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
55
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
58
|
+
children: [/*#__PURE__*/_jsx__default["default"](Highlighter__default["default"], {
|
|
56
59
|
autoEscape: true,
|
|
57
60
|
highlightTag: CustomHighlight,
|
|
58
61
|
searchWords: [searchQuery],
|
|
59
62
|
textToHighlight: itemLabelText
|
|
60
|
-
}), showChildrenAmount ? _ChildrenCountDisplay || (_ChildrenCountDisplay = /*#__PURE__*/_jsx__default[
|
|
63
|
+
}), showChildrenAmount ? _ChildrenCountDisplay || (_ChildrenCountDisplay = /*#__PURE__*/_jsx__default["default"](ChildrenCountDisplayer.ChildrenCountDisplayer, {
|
|
61
64
|
item: item
|
|
62
65
|
})) : null]
|
|
63
66
|
})
|
|
@@ -65,21 +68,21 @@ function TreeItemText(props) {
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
68
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
71
|
+
children: [/*#__PURE__*/_jsx__default["default"](Highlighter__default["default"], {
|
|
69
72
|
autoEscape: true,
|
|
70
73
|
highlightTag: CustomHighlight,
|
|
71
74
|
searchWords: [searchQuery],
|
|
72
75
|
textToHighlight: itemLabelText
|
|
73
|
-
}), showChildrenAmount ? _ChildrenCountDisplay2 || (_ChildrenCountDisplay2 = /*#__PURE__*/_jsx__default[
|
|
76
|
+
}), showChildrenAmount ? _ChildrenCountDisplay2 || (_ChildrenCountDisplay2 = /*#__PURE__*/_jsx__default["default"](ChildrenCountDisplayer.ChildrenCountDisplayer, {
|
|
74
77
|
item: item
|
|
75
78
|
})) : null]
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
if (labelOverflow === 'truncate') {
|
|
80
|
-
return /*#__PURE__*/_jsx__default[
|
|
83
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
81
84
|
value: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
82
|
-
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay3 || (_ChildrenCountDisplay3 = /*#__PURE__*/_jsx__default[
|
|
85
|
+
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay3 || (_ChildrenCountDisplay3 = /*#__PURE__*/_jsx__default["default"](ChildrenCountDisplayer.ChildrenCountDisplayer, {
|
|
83
86
|
item: item
|
|
84
87
|
})) : null]
|
|
85
88
|
})
|
|
@@ -87,17 +90,17 @@ function TreeItemText(props) {
|
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
90
|
-
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay4 || (_ChildrenCountDisplay4 = /*#__PURE__*/_jsx__default[
|
|
93
|
+
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay4 || (_ChildrenCountDisplay4 = /*#__PURE__*/_jsx__default["default"](ChildrenCountDisplayer.ChildrenCountDisplayer, {
|
|
91
94
|
item: item
|
|
92
95
|
})) : null]
|
|
93
96
|
});
|
|
94
97
|
}, [item, searchQuery, nameKey, showChildrenAmount, labelOverflow]);
|
|
95
98
|
let className = '';
|
|
96
|
-
if (labelOverflow === 'wrap-all') className +=
|
|
97
|
-
if (labelOverflow === 'truncate') className +=
|
|
98
|
-
return /*#__PURE__*/_jsx__default[
|
|
99
|
-
"data-testid":
|
|
100
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
99
|
+
if (labelOverflow === 'wrap-all') className += "".concat(classNameModifierWrapAll, " ");
|
|
100
|
+
if (labelOverflow === 'truncate') className += "".concat(classNameModifierTruncate, " ");
|
|
101
|
+
return /*#__PURE__*/_jsx__default["default"](ItemContent, {
|
|
102
|
+
"data-testid": "".concat(cssClassesConstants.treeItemBlockName, "-content")
|
|
103
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](ItemValue, {
|
|
101
104
|
className: className
|
|
102
105
|
}, void 0, Text));
|
|
103
106
|
}
|
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');
|
|
@@ -20,26 +27,29 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
20
27
|
|
|
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
|
-
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[
|
|
24
|
-
const treeListNoItemsBn =
|
|
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; }
|
|
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
|
|
41
51
|
} = props;
|
|
42
|
-
const ctx = React.useContext(TreeViewContext[
|
|
52
|
+
const ctx = React.useContext(TreeViewContext["default"]);
|
|
43
53
|
const {
|
|
44
54
|
virtualListRef,
|
|
45
55
|
virtualListHelpers,
|
|
@@ -57,16 +67,16 @@ 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
|
-
children: [isLoading ? /*#__PURE__*/_jsx__default[
|
|
79
|
+
children: [isLoading ? /*#__PURE__*/_jsx__default["default"]("div", {
|
|
70
80
|
style: {
|
|
71
81
|
width: '100%',
|
|
72
82
|
height: '100%',
|
|
@@ -74,15 +84,15 @@ const TreeList = props => {
|
|
|
74
84
|
alignItems: 'center',
|
|
75
85
|
justifyContent: 'center'
|
|
76
86
|
}
|
|
77
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
87
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsCircularProgressIndicator.DSCircularProgressIndicator, {
|
|
78
88
|
size: "xl",
|
|
79
89
|
loading: isLoading,
|
|
80
90
|
showLabel: true,
|
|
81
91
|
waiting: false,
|
|
82
92
|
showTooltip: false
|
|
83
|
-
})) : null, !isLoading && virtualItems.length === 0 ? /*#__PURE__*/_jsx__default[
|
|
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
|
|
@@ -20,11 +20,11 @@ const TreeDnD = () => {
|
|
|
20
20
|
onMouseDragOverItem,
|
|
21
21
|
onSortEnd
|
|
22
22
|
} = useDnDHelpers.useDnDHelpers();
|
|
23
|
-
const ctx = React.useContext(TreeViewContext[
|
|
23
|
+
const ctx = React.useContext(TreeViewContext["default"]);
|
|
24
24
|
const {
|
|
25
25
|
virtualListRef
|
|
26
26
|
} = ctx;
|
|
27
|
-
return /*#__PURE__*/_jsx__default[
|
|
27
|
+
return /*#__PURE__*/_jsx__default["default"](TreeList.DragAndDropTreeList, {
|
|
28
28
|
useDragHandle: true,
|
|
29
29
|
transitionDuration: 0,
|
|
30
30
|
keyboardSortingTransitionDuration: 0,
|
package/cjs/prop-types.js
CHANGED
|
@@ -9,46 +9,46 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
10
10
|
|
|
11
11
|
/* eslint-disable max-lines */
|
|
12
|
-
const InstanceActionsPropTypes = PropTypes__default[
|
|
13
|
-
toggleExpandAll: PropTypes__default[
|
|
14
|
-
scrollTo: PropTypes__default[
|
|
12
|
+
const InstanceActionsPropTypes = PropTypes__default["default"].shape({
|
|
13
|
+
toggleExpandAll: PropTypes__default["default"].func,
|
|
14
|
+
scrollTo: PropTypes__default["default"].func
|
|
15
15
|
});
|
|
16
|
-
const TreeViewInstancePropType = PropTypes__default[
|
|
17
|
-
current: PropTypes__default[
|
|
16
|
+
const TreeViewInstancePropType = PropTypes__default["default"].shape({
|
|
17
|
+
current: PropTypes__default["default"].oneOfType([PropTypes__default["default"].oneOf([null]), PropTypes__default["default"].shape({
|
|
18
18
|
actions: InstanceActionsPropTypes.isRequired
|
|
19
19
|
})])
|
|
20
20
|
});
|
|
21
|
-
const TreeViewItemPropType = PropTypes__default[
|
|
22
|
-
children: PropTypes__default[
|
|
23
|
-
id: PropTypes__default[
|
|
24
|
-
isGroup: PropTypes__default[
|
|
25
|
-
name: PropTypes__default[
|
|
26
|
-
node: PropTypes__default[
|
|
21
|
+
const TreeViewItemPropType = PropTypes__default["default"].shape({
|
|
22
|
+
children: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
|
|
23
|
+
id: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
24
|
+
isGroup: PropTypes__default["default"].oneOfType([PropTypes__default["default"].oneOf([undefined, null]), PropTypes__default["default"].bool]),
|
|
25
|
+
name: PropTypes__default["default"].string,
|
|
26
|
+
node: PropTypes__default["default"].object
|
|
27
27
|
});
|
|
28
28
|
const TreeListPropTypes = {
|
|
29
29
|
// required when drag and drop is enabled, tracks the drag and drop results after drop and visual feedback borders
|
|
30
30
|
// passed down to TreeItem
|
|
31
|
-
onMouseDragOverItem: PropTypes__default[
|
|
31
|
+
onMouseDragOverItem: PropTypes__default["default"].func
|
|
32
32
|
};
|
|
33
33
|
const TreeItemPropTypes = {
|
|
34
34
|
item: TreeViewItemPropType.isRequired,
|
|
35
|
-
index: PropTypes__default[
|
|
36
|
-
itemIndex: PropTypes__default[
|
|
37
|
-
itemWrapperStyle: PropTypes__default[
|
|
38
|
-
virtualItemRef: PropTypes__default[
|
|
39
|
-
spaceForNestingLevel: PropTypes__default[
|
|
40
|
-
onMouseDragOverItem: PropTypes__default[
|
|
35
|
+
index: PropTypes__default["default"].number,
|
|
36
|
+
itemIndex: PropTypes__default["default"].number,
|
|
37
|
+
itemWrapperStyle: PropTypes__default["default"].object,
|
|
38
|
+
virtualItemRef: PropTypes__default["default"].func,
|
|
39
|
+
spaceForNestingLevel: PropTypes__default["default"].number,
|
|
40
|
+
onMouseDragOverItem: PropTypes__default["default"].func
|
|
41
41
|
};
|
|
42
42
|
const TreeItemExpandCaretPropTypes = {
|
|
43
43
|
item: TreeViewItemPropType.isRequired
|
|
44
44
|
};
|
|
45
45
|
const TreeItemNestingSpacePropTypes = {
|
|
46
46
|
item: TreeViewItemPropType.isRequired,
|
|
47
|
-
spaceForNestingLevel: PropTypes__default[
|
|
47
|
+
spaceForNestingLevel: PropTypes__default["default"].number.isRequired
|
|
48
48
|
};
|
|
49
49
|
const TreeItemCheckboxPropTypes = {
|
|
50
50
|
item: TreeViewItemPropType.isRequired,
|
|
51
|
-
itemIndex: PropTypes__default[
|
|
51
|
+
itemIndex: PropTypes__default["default"].number.isRequired
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
exports.InstanceActionsPropTypes = InstanceActionsPropTypes;
|
|
@@ -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[
|
|
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);
|
|
@@ -20,7 +20,7 @@ var groupExpandsHelpers = require('./group-expands-helpers.js');
|
|
|
20
20
|
// 106 (NumPad) *
|
|
21
21
|
|
|
22
22
|
const useOnItemKeyDown = item => {
|
|
23
|
-
const ctx = React.useContext(TreeViewContext[
|
|
23
|
+
const ctx = React.useContext(TreeViewContext["default"]);
|
|
24
24
|
const {
|
|
25
25
|
props: {
|
|
26
26
|
onItemFocus
|
|
@@ -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
|
|
|
@@ -11,7 +16,7 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
11
16
|
|
|
12
17
|
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; }
|
|
13
18
|
|
|
14
|
-
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[
|
|
19
|
+
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; }
|
|
15
20
|
const getGroupCheckState = node => {
|
|
16
21
|
let childAllChecked = true;
|
|
17
22
|
let anyChildChecked = false;
|
|
@@ -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: {
|