@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
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
5
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.some.js';
|
|
10
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
11
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
12
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
3
13
|
import React, { useCallback } from 'react';
|
|
4
|
-
import { cx, isFunction } from '@elliemae/ds-utilities
|
|
5
|
-
import Button from '@elliemae/ds-
|
|
6
|
-
import ArrowheadDown from '@elliemae/ds-icons
|
|
7
|
-
import ArrowheadRight from '@elliemae/ds-icons/ArrowheadRight';
|
|
14
|
+
import { cx, isFunction } from '@elliemae/ds-utilities';
|
|
15
|
+
import Button from '@elliemae/ds-button';
|
|
16
|
+
import { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';
|
|
8
17
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
9
18
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
10
19
|
import { walkTreeStrategy } from './walkTreeStrategy.js';
|
|
@@ -17,7 +26,7 @@ var _ArrowheadDown, _ArrowheadRight;
|
|
|
17
26
|
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; }
|
|
18
27
|
|
|
19
28
|
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; }
|
|
20
|
-
const ItemContent = aggregatedClasses('div')(
|
|
29
|
+
const ItemContent = aggregatedClasses('div')("".concat(treeItemBlockName, "-content"));
|
|
21
30
|
const ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value');
|
|
22
31
|
|
|
23
32
|
const noop = () => null;
|
|
@@ -31,7 +40,7 @@ const getItemNestingLeftPadding = (level, opts) => {
|
|
|
31
40
|
}, opts);
|
|
32
41
|
|
|
33
42
|
const groupLeftPadding = spaceForNestingLevel * (level - 1);
|
|
34
|
-
return isChild ?
|
|
43
|
+
return isChild ? "".concat(groupLeftPadding + spaceForNestingLevel - 0.1, "em") : "".concat(groupLeftPadding, "em");
|
|
35
44
|
};
|
|
36
45
|
|
|
37
46
|
const itemRenderer = (value, itemProps, instance) => {
|
|
@@ -52,9 +61,9 @@ const itemRenderer = (value, itemProps, instance) => {
|
|
|
52
61
|
const amountChildren = Number(getItemChildrenLength(record));
|
|
53
62
|
const renderedLabel = isFunction(labelRenderer) && labelRenderer(value, itemProps) || value;
|
|
54
63
|
return /*#__PURE__*/_jsx(ItemContent, {
|
|
55
|
-
"data-testid":
|
|
64
|
+
"data-testid": "".concat(treeItemBlockName, "-content"),
|
|
56
65
|
onClick: handleItemClick
|
|
57
|
-
}, void 0, /*#__PURE__*/_jsx(ItemValue, {}, void 0, renderedLabel, showChildrenAmount && record.isGroup &&
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx(ItemValue, {}, void 0, renderedLabel, showChildrenAmount && record.isGroup && " (".concat(amountChildren, ")")));
|
|
58
67
|
};
|
|
59
68
|
|
|
60
69
|
itemRenderer.order = 100;
|
|
@@ -79,9 +88,10 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
79
88
|
}));
|
|
80
89
|
},
|
|
81
90
|
|
|
82
|
-
getItemProps(props, instance, {
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
getItemProps(props, instance, _ref) {
|
|
92
|
+
let {
|
|
93
|
+
record
|
|
94
|
+
} = _ref;
|
|
85
95
|
const {
|
|
86
96
|
nestingLevel
|
|
87
97
|
} = record;
|
|
@@ -120,7 +130,7 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
120
130
|
size: "s",
|
|
121
131
|
tabIndex: -1 // eslint-disable-next-line max-lines
|
|
122
132
|
|
|
123
|
-
},
|
|
133
|
+
}, "".concat(record.id, "-expand-addon"));
|
|
124
134
|
|
|
125
135
|
const iconAddon = icon && /*#__PURE__*/React.cloneElement(icon, {
|
|
126
136
|
'data-testid': record.isGroup ? 'tree-item-group-icon' : 'tree-item-icon',
|
|
@@ -132,7 +142,7 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
132
142
|
style: {
|
|
133
143
|
width: itemNestingLeftPadding
|
|
134
144
|
}
|
|
135
|
-
},
|
|
145
|
+
}, "".concat(record.id, "-space-addon"));
|
|
136
146
|
|
|
137
147
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
138
148
|
'data-id': record.id,
|
|
@@ -158,9 +168,10 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
158
168
|
},
|
|
159
169
|
|
|
160
170
|
hotKeys(instance) {
|
|
161
|
-
function handleExpand({
|
|
162
|
-
|
|
163
|
-
|
|
171
|
+
function handleExpand(_ref2) {
|
|
172
|
+
let {
|
|
173
|
+
index
|
|
174
|
+
} = _ref2;
|
|
164
175
|
const {
|
|
165
176
|
records,
|
|
166
177
|
actions: {
|
|
@@ -171,9 +182,10 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
171
182
|
if (record && record.data.children.length > 0) _toggleExpand(record.data);
|
|
172
183
|
}
|
|
173
184
|
|
|
174
|
-
function handleCollapse({
|
|
175
|
-
|
|
176
|
-
|
|
185
|
+
function handleCollapse(_ref3) {
|
|
186
|
+
let {
|
|
187
|
+
index
|
|
188
|
+
} = _ref3;
|
|
177
189
|
const {
|
|
178
190
|
records,
|
|
179
191
|
actions: {
|
|
@@ -225,9 +237,10 @@ const TreePluginList = createInstancePlugin('tree-data', {
|
|
|
225
237
|
handler: handleCollapse
|
|
226
238
|
}, {
|
|
227
239
|
key: 'enter',
|
|
228
|
-
handler:
|
|
229
|
-
|
|
230
|
-
|
|
240
|
+
handler: _ref4 => {
|
|
241
|
+
let {
|
|
242
|
+
index
|
|
243
|
+
} = _ref4;
|
|
231
244
|
const {
|
|
232
245
|
records,
|
|
233
246
|
actions: {
|
|
@@ -1,7 +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 { useRef, useState, useEffect } from 'react';
|
|
3
|
-
import useExpandState from '@elliemae/ds-utilities
|
|
4
|
-
import { isFunction } from '@elliemae/ds-utilities/utils';
|
|
9
|
+
import { useExpandState, isFunction } from '@elliemae/ds-utilities';
|
|
5
10
|
import { walkTreeStrategy } from './walkTreeStrategy.js';
|
|
6
11
|
|
|
7
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
1
4
|
import get from 'lodash/get';
|
|
2
5
|
|
|
3
6
|
const getParentId = record => get(record, ['parentNode', 'id']);
|
|
4
|
-
const findItemOnDocument = id => document.querySelector(
|
|
5
|
-
const getListFromDocument = () => document.querySelector(
|
|
6
|
-
const getParentChildren = (record
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const findItemOnDocument = id => document.querySelector("[data-id=\"".concat(id, "\"]"));
|
|
8
|
+
const getListFromDocument = () => document.querySelector("[data-testid=\"tree-list\"]");
|
|
9
|
+
const getParentChildren = function (record) {
|
|
10
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
11
|
+
return get(record, ['parentNode', 'data', childrenKey]);
|
|
12
|
+
};
|
|
13
|
+
const getItemLabel = function (record) {
|
|
14
|
+
let nameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'name';
|
|
15
|
+
return get(record, ['data', nameKey]);
|
|
16
|
+
};
|
|
17
|
+
const getItemChildren = function (record) {
|
|
18
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
19
|
+
return get(record, ['data', childrenKey]);
|
|
20
|
+
};
|
|
21
|
+
const getItemChildrenLength = function (record) {
|
|
22
|
+
let childrenKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
10
23
|
const children = get(record, ['data', childrenKey]);
|
|
11
24
|
return children && children.length;
|
|
12
25
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
|
|
1
3
|
function getPath(parentNode, index, childrenKey) {
|
|
2
4
|
if (!parentNode) return [index];
|
|
3
5
|
return [...parentNode.path, childrenKey, index];
|
|
4
6
|
}
|
|
5
7
|
|
|
6
|
-
function walkTreeStrategy({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
function walkTreeStrategy(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
data,
|
|
11
|
+
childrenKey = 'children',
|
|
12
|
+
level = 0,
|
|
13
|
+
getId = item => item.id,
|
|
14
|
+
parentNode,
|
|
15
|
+
shouldWalkChildren = () => true,
|
|
16
|
+
cb
|
|
17
|
+
} = _ref;
|
|
18
|
+
|
|
15
19
|
// eslint-disable-next-line no-plusplus
|
|
16
20
|
for (let i = 0; i < data.length; i++) {
|
|
17
21
|
const currLevel = level + 1;
|
|
@@ -1,3 +1,8 @@
|
|
|
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 _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
@@ -49,11 +54,12 @@ function areEqualRecords(prevProps, nextProps) {
|
|
|
49
54
|
// https://react-window.now.sh/#/examples/list/memoized-list-items
|
|
50
55
|
|
|
51
56
|
|
|
52
|
-
const VirtualizedTreeItem = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
const VirtualizedTreeItem = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
58
|
+
let {
|
|
59
|
+
index,
|
|
60
|
+
style,
|
|
61
|
+
data
|
|
62
|
+
} = _ref;
|
|
57
63
|
const {
|
|
58
64
|
instance,
|
|
59
65
|
records,
|
|
@@ -84,13 +90,13 @@ const VirtualizedTreeItem = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardR
|
|
|
84
90
|
}));
|
|
85
91
|
}), areEqualRecords); // eslint-disable-next-line react/display-name
|
|
86
92
|
|
|
87
|
-
const VirtualizedTree = (renderers, instance) =>
|
|
93
|
+
const VirtualizedTree = (renderers, instance) => _ref2 => {
|
|
88
94
|
let {
|
|
89
95
|
records,
|
|
90
96
|
itemRenderer,
|
|
91
97
|
innerRef
|
|
92
|
-
} =
|
|
93
|
-
rest = _objectWithoutProperties(
|
|
98
|
+
} = _ref2,
|
|
99
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
94
100
|
|
|
95
101
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
96
102
|
const {
|
|
@@ -152,17 +158,25 @@ const TreeVirtualizationPlugin = createInstancePlugin('tree-virtualization', {
|
|
|
152
158
|
listRef
|
|
153
159
|
},
|
|
154
160
|
actions: {
|
|
155
|
-
scrollTo: (
|
|
161
|
+
scrollTo: function () {
|
|
156
162
|
var _listRef$current;
|
|
157
163
|
|
|
158
164
|
if (listRef !== null && listRef !== void 0 && (_listRef$current = listRef.current) !== null && _listRef$current !== void 0 && _listRef$current.scrollTo) {
|
|
165
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
166
|
+
args[_key] = arguments[_key];
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
listRef.current.scrollTo(args);
|
|
160
170
|
}
|
|
161
171
|
},
|
|
162
|
-
scrollToItem: (
|
|
172
|
+
scrollToItem: function () {
|
|
163
173
|
var _listRef$current2;
|
|
164
174
|
|
|
165
175
|
if (listRef !== null && listRef !== void 0 && (_listRef$current2 = listRef.current) !== null && _listRef$current2 !== void 0 && _listRef$current2.scrollToItem) {
|
|
176
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
177
|
+
args[_key2] = arguments[_key2];
|
|
178
|
+
}
|
|
179
|
+
|
|
166
180
|
listRef.current.scrollToItem(args);
|
|
167
181
|
}
|
|
168
182
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
@@ -12,7 +17,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
17
|
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; }
|
|
13
18
|
const treeListBlockName = 'tree-list';
|
|
14
19
|
const treeItemBlockName = 'tree-item';
|
|
15
|
-
const treeListNoItemsBn =
|
|
20
|
+
const treeListNoItemsBn = "".concat(treeListBlockName, "-no-items");
|
|
16
21
|
const TreeListItem = aggregatedClasses('li', {
|
|
17
22
|
'data-testid': treeItemBlockName,
|
|
18
23
|
role: 'treeitem'
|
|
@@ -21,22 +26,25 @@ const TreeListItemAddonsWrapper = aggregatedClasses('div')(treeItemBlockName, 'a
|
|
|
21
26
|
const TreeList = aggregatedClasses('ul', {
|
|
22
27
|
'data-testid': treeListBlockName,
|
|
23
28
|
role: 'tree'
|
|
24
|
-
})(treeListBlockName, null,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
})(treeListBlockName, null, _ref => {
|
|
30
|
+
let {
|
|
31
|
+
rowSize
|
|
32
|
+
} = _ref;
|
|
33
|
+
return {
|
|
34
|
+
["rowsize-".concat(rowSize)]: rowSize
|
|
35
|
+
};
|
|
36
|
+
});
|
|
29
37
|
const TreeListNoItems = aggregatedClasses('div', {
|
|
30
38
|
'data-testid': treeListNoItemsBn
|
|
31
39
|
})(treeListNoItemsBn);
|
|
32
40
|
|
|
33
|
-
function TreeItem(
|
|
41
|
+
function TreeItem(_ref2) {
|
|
34
42
|
let {
|
|
35
43
|
leftAddons,
|
|
36
44
|
rightAddons,
|
|
37
45
|
children
|
|
38
|
-
} =
|
|
39
|
-
rest = _objectWithoutProperties(
|
|
46
|
+
} = _ref2,
|
|
47
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
40
48
|
|
|
41
49
|
return /*#__PURE__*/jsxs(TreeListItem, _objectSpread(_objectSpread({}, rest), {}, {
|
|
42
50
|
children: [leftAddons && /*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, leftAddons), children, rightAddons && /*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, rightAddons)]
|
|
@@ -1,7 +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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import { useContext, useCallback, useMemo } from 'react';
|
|
4
|
-
import
|
|
9
|
+
import { DSCheckbox } from '@elliemae/ds-form';
|
|
5
10
|
import styled from 'styled-components';
|
|
6
11
|
import TreeViewContext from '../TreeViewContext.js';
|
|
7
12
|
import { toggleCheckboxItem } from '../utils/selectable-helper.js';
|
|
@@ -62,7 +67,7 @@ function CheckboxSelectable(props) {
|
|
|
62
67
|
|
|
63
68
|
return false;
|
|
64
69
|
}, [selectedCheckboxes, id]);
|
|
65
|
-
return /*#__PURE__*/_jsx(StyledCheckboxWrapper, {}, void 0, /*#__PURE__*/_jsx(
|
|
70
|
+
return /*#__PURE__*/_jsx(StyledCheckboxWrapper, {}, void 0, /*#__PURE__*/_jsx(DSCheckbox, {
|
|
66
71
|
checked: isChecked,
|
|
67
72
|
disabled: item.isGroup ? disableGroups : disableLeafs,
|
|
68
73
|
className: "em-ds-tree-item-checkbox",
|
|
@@ -2,7 +2,7 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants.js';
|
|
4
4
|
|
|
5
|
-
const className =
|
|
5
|
+
const className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "-children-count-displayer");
|
|
6
6
|
const ChildrenCountDisplayer = props => {
|
|
7
7
|
const {
|
|
8
8
|
item
|
|
@@ -16,7 +16,7 @@ const ChildrenCountDisplayer = props => {
|
|
|
16
16
|
return /*#__PURE__*/_jsx("span", {
|
|
17
17
|
"data-testid": "tree-item-children-count-displayer",
|
|
18
18
|
className: className
|
|
19
|
-
}, void 0,
|
|
19
|
+
}, void 0, " | ".concat(children.length, " Items"));
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export { ChildrenCountDisplayer };
|
package/esm/parts/ExpandCaret.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useCallback, useContext } from 'react';
|
|
3
|
-
import Button from '@elliemae/ds-
|
|
4
|
-
import ArrowheadDown from '@elliemae/ds-icons
|
|
5
|
-
import ArrowheadRight from '@elliemae/ds-icons/ArrowheadRight';
|
|
3
|
+
import Button from '@elliemae/ds-button';
|
|
4
|
+
import { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';
|
|
6
5
|
import { toggleItemExpand } from '../utils/group-expands-helpers.js';
|
|
7
6
|
import { focusItem } from '../utils/tree-helpers.js';
|
|
8
7
|
import TreeViewContext from '../TreeViewContext.js';
|
|
@@ -56,9 +55,12 @@ const ExpandCaret = props => {
|
|
|
56
55
|
setLatestToggledItem(item);
|
|
57
56
|
onItemFocus({
|
|
58
57
|
itemIndex: item.virtualIndex,
|
|
59
|
-
scrollToItem: (
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
scrollToItem: function () {
|
|
59
|
+
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
60
|
+
align: 'start'
|
|
61
|
+
};
|
|
62
|
+
return scrollToIndex(item.virtualIndex, opts);
|
|
63
|
+
},
|
|
62
64
|
item
|
|
63
65
|
});
|
|
64
66
|
setFocusedItem(item);
|
|
@@ -66,7 +68,7 @@ const ExpandCaret = props => {
|
|
|
66
68
|
},
|
|
67
69
|
size: "s",
|
|
68
70
|
tabIndex: -1
|
|
69
|
-
},
|
|
71
|
+
}, "".concat(id, "-expand-addon"));
|
|
70
72
|
return /*#__PURE__*/_jsx("div", {
|
|
71
73
|
style: {
|
|
72
74
|
width: '24px'
|
package/esm/parts/Icon.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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 'react';
|
|
@@ -15,7 +20,7 @@ const getItemNestingLeftPadding = (level, opts) => {
|
|
|
15
20
|
const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1; // root level left-padding would be negative and would not be applied
|
|
16
21
|
// if "root-level" nesting, then defaults to 0 left-padding.
|
|
17
22
|
|
|
18
|
-
return finalLeftPadding > 0 ?
|
|
23
|
+
return finalLeftPadding > 0 ? "".concat(finalLeftPadding, "em") : '0';
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
const NestingSpace = props => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useContext, useCallback, useMemo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { DSRadio } from '@elliemae/ds-form';
|
|
4
4
|
import TreeViewContext from '../TreeViewContext.js';
|
|
5
5
|
|
|
6
6
|
function RadioSelectable(props) {
|
|
@@ -40,8 +40,8 @@ function RadioSelectable(props) {
|
|
|
40
40
|
};
|
|
41
41
|
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
42
42
|
}, [item, id, onSelectionChange, scrollToIndex]);
|
|
43
|
-
const radioName = useMemo(() =>
|
|
44
|
-
return /*#__PURE__*/_jsx(
|
|
43
|
+
const radioName = useMemo(() => "radios-".concat(uniqueTreeViewUUID), [uniqueTreeViewUUID]);
|
|
44
|
+
return /*#__PURE__*/_jsx(DSRadio, {
|
|
45
45
|
checked: selectedCheckboxes[id] === true,
|
|
46
46
|
name: radioName,
|
|
47
47
|
disabled: item.isGroup ? disableGroups : disableLeafs,
|
package/esm/parts/TreeItem.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
9
|
import { useRef, useState, useContext, useMemo, useCallback } from 'react';
|
|
4
10
|
import { SortableHandle, SortableElement } from '@elliemae/react-sortable-hoc';
|
|
5
11
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
6
|
-
import GripperVertical from '@elliemae/ds-icons
|
|
12
|
+
import { GripperVertical } from '@elliemae/ds-icons';
|
|
7
13
|
import RadioSelectable from './RadioSelectable.js';
|
|
8
14
|
import CheckboxSelectable from './CheckboxSelectable.js';
|
|
9
15
|
import TreeViewContext from '../TreeViewContext.js';
|
|
@@ -24,20 +30,23 @@ const TreeListItem = aggregatedClasses('li', {
|
|
|
24
30
|
role: 'treeitem'
|
|
25
31
|
})(treeItemBlockName);
|
|
26
32
|
const TreeListItemAddonsWrapper = aggregatedClasses('div')(treeItemBlockName, 'addons');
|
|
27
|
-
const DnDHandle = SortableHandle(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
33
|
+
const DnDHandle = SortableHandle(_ref => {
|
|
34
|
+
let {
|
|
35
|
+
id
|
|
36
|
+
} = _ref;
|
|
37
|
+
return /*#__PURE__*/_jsx(GripperVertical, {
|
|
38
|
+
"data-testid": "drag-handle",
|
|
39
|
+
className: "drag-handle",
|
|
40
|
+
size: "s",
|
|
41
|
+
onMouseDown: e => {
|
|
42
|
+
// prevent focusing the drag-handle to avoid borders
|
|
43
|
+
if (e) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
tabIndex: "0"
|
|
48
|
+
}, "".concat(id, "-drag-handle"));
|
|
49
|
+
});
|
|
41
50
|
const TreeItem = props => {
|
|
42
51
|
const {
|
|
43
52
|
item,
|
|
@@ -96,7 +105,7 @@ const TreeItem = props => {
|
|
|
96
105
|
isAfter,
|
|
97
106
|
isValid
|
|
98
107
|
} = relativeMouseCord;
|
|
99
|
-
let className =
|
|
108
|
+
let className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName).concat(isValid ? '--valid' : '--invalid');
|
|
100
109
|
if (isBefore) className += '-drop-before';else if (isAfter) className += '-drop-after';else className += '-drop-in';
|
|
101
110
|
return className;
|
|
102
111
|
}, [withDragAndDrop, relativeMouseCord, isDraggingOverThis]);
|
|
@@ -104,22 +113,25 @@ const TreeItem = props => {
|
|
|
104
113
|
const hoverClassName = useMemo(() => (hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) !== item.id || withDragAndDrop && isDragging ? '' : 'hover', [hoverItem, withDragAndDrop, isDragging]);
|
|
105
114
|
const fixedHeightClassname = useMemo(() => {
|
|
106
115
|
if (labelOverflow === 'truncate') {
|
|
107
|
-
if (rowSize === 'compact') return
|
|
108
|
-
return
|
|
116
|
+
if (rowSize === 'compact') return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height-compact");
|
|
117
|
+
return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height");
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
return '';
|
|
112
121
|
}, [labelOverflow, rowSize]);
|
|
113
|
-
const finalClassName = useMemo(() =>
|
|
122
|
+
const finalClassName = useMemo(() => "".concat(dropPreviewClassName, " ").concat(fixedHeightClassname, " ").concat(selectedClassName, " ").concat(hoverClassName), [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname]);
|
|
114
123
|
const handleItemClick = useCallback(e => {
|
|
115
124
|
onItemClick(item, e);
|
|
116
125
|
setFocusedItem(item);
|
|
117
126
|
setSelectedItem(item);
|
|
118
127
|
onItemFocus({
|
|
119
128
|
itemIndex: item.virtualIndex,
|
|
120
|
-
scrollToItem: (
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
scrollToItem: function () {
|
|
130
|
+
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
131
|
+
align: 'start'
|
|
132
|
+
};
|
|
133
|
+
return scrollToIndex(item.virtualIndex, opts);
|
|
134
|
+
},
|
|
123
135
|
item
|
|
124
136
|
});
|
|
125
137
|
}, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useContext, useMemo } from 'react';
|
|
3
3
|
import Highlighter from 'react-highlight-words';
|
|
4
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-
|
|
4
|
+
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
5
5
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
6
6
|
import { ChildrenCountDisplayer } from './ChildrenCountDisplayer.js';
|
|
7
7
|
import { treeItemBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
|
|
8
8
|
import TreeViewContext from '../TreeViewContext.js';
|
|
9
9
|
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
|
-
const ItemContent = aggregatedClasses('div')(
|
|
11
|
+
const ItemContent = aggregatedClasses('div')("".concat(treeItemBlockName, "-content"));
|
|
12
12
|
const ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value'); // const wrapperClassName = `${DSTreeViewPrefix}-${treeItemBlockName}-content`;
|
|
13
13
|
|
|
14
|
-
const classNameModifierWrapAll =
|
|
15
|
-
const classNameModifierTruncate =
|
|
14
|
+
const classNameModifierWrapAll = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "__value--wrap-all");
|
|
15
|
+
const classNameModifierTruncate = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "__value--truncate"); // eslint-disable-next-line react/prop-types
|
|
16
16
|
|
|
17
|
-
const CustomHighlight =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
17
|
+
const CustomHighlight = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_jsx("mark", {
|
|
22
|
+
className: "tree-text-highlight",
|
|
23
|
+
"data-testid": "tree-text-highlight"
|
|
24
|
+
}, void 0, children);
|
|
25
|
+
};
|
|
23
26
|
|
|
24
27
|
function TreeItemText(props) {
|
|
25
28
|
var _ChildrenCountDisplay, _ChildrenCountDisplay2, _ChildrenCountDisplay3, _ChildrenCountDisplay4;
|
|
@@ -84,10 +87,10 @@ function TreeItemText(props) {
|
|
|
84
87
|
});
|
|
85
88
|
}, [item, searchQuery, nameKey, showChildrenAmount, labelOverflow]);
|
|
86
89
|
let className = '';
|
|
87
|
-
if (labelOverflow === 'wrap-all') className +=
|
|
88
|
-
if (labelOverflow === 'truncate') className +=
|
|
90
|
+
if (labelOverflow === 'wrap-all') className += "".concat(classNameModifierWrapAll, " ");
|
|
91
|
+
if (labelOverflow === 'truncate') className += "".concat(classNameModifierTruncate, " ");
|
|
89
92
|
return /*#__PURE__*/_jsx(ItemContent, {
|
|
90
|
-
"data-testid":
|
|
93
|
+
"data-testid": "".concat(treeItemBlockName, "-content")
|
|
91
94
|
}, void 0, /*#__PURE__*/_jsx(ItemValue, {
|
|
92
95
|
className: className
|
|
93
96
|
}, void 0, Text));
|