@elliemae/ds-treeview 2.2.0-alpha.4 → 3.0.0-next.2

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.
Files changed (206) hide show
  1. package/cjs/TreeView.js +27 -49
  2. package/cjs/TreeViewContext.js +37 -61
  3. package/cjs/config/cssClassesConstants.js +13 -41
  4. package/cjs/config/useTreeview.js +78 -116
  5. package/cjs/hoc/DnDTreeContext.js +18 -0
  6. package/cjs/hoc/SortableItemContext.js +21 -0
  7. package/cjs/hoc/WithConditionalDnDContext.js +138 -0
  8. package/cjs/hoc/WithDnDSortableItemContext.js +70 -0
  9. package/cjs/index.js +26 -37
  10. package/cjs/parts/CheckboxSelectable.js +59 -70
  11. package/cjs/parts/ChildrenCountDisplayer.js +28 -45
  12. package/cjs/parts/DnDHandle.js +46 -0
  13. package/cjs/parts/DropIndicator.js +75 -0
  14. package/cjs/parts/ExpandCaret.js +83 -85
  15. package/cjs/parts/Icon.js +31 -46
  16. package/cjs/parts/NestingSpace.js +35 -43
  17. package/cjs/parts/RadioSelectable.js +37 -52
  18. package/cjs/parts/TreeItem.js +141 -147
  19. package/cjs/parts/TreeItemText.js +95 -88
  20. package/cjs/parts/TreeList.js +130 -119
  21. package/cjs/plugins/dnd/TreeDndPlugin.js +7 -59
  22. package/cjs/plugins/dnd/index.js +9 -28
  23. package/cjs/plugins/index.js +21 -34
  24. package/cjs/plugins/roving/TreeRovingPlugin.js +7 -35
  25. package/cjs/plugins/roving/index.js +9 -28
  26. package/cjs/plugins/searchable/SearchableTreePlugin.js +7 -35
  27. package/cjs/plugins/searchable/index.js +9 -28
  28. package/cjs/plugins/selectable/SelectablePluginTree.js +7 -35
  29. package/cjs/plugins/selectable/index.js +9 -28
  30. package/cjs/plugins/toolbar/TreeToolbarPlugin.js +7 -35
  31. package/cjs/plugins/toolbar/index.js +9 -28
  32. package/cjs/plugins/tree/TreeDataPlugin.js +7 -35
  33. package/cjs/plugins/tree/index.js +9 -28
  34. package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +7 -35
  35. package/cjs/plugins/virtualization/index.js +9 -28
  36. package/cjs/react-desc-prop-types.js +54 -82
  37. package/cjs/related-components/TreeViewSearchBar.js +40 -42
  38. package/cjs/sharedTypes.js +2 -27
  39. package/cjs/utils/array-helpers.js +11 -35
  40. package/cjs/utils/group-expands-helpers.js +59 -86
  41. package/cjs/utils/keyboard-helpers.js +90 -85
  42. package/cjs/utils/object-helpers.js +36 -43
  43. package/cjs/utils/refs-helpers.js +22 -43
  44. package/cjs/utils/selectable-helper.js +53 -61
  45. package/cjs/utils/string-helpers.js +7 -35
  46. package/cjs/utils/tree-helpers.js +161 -105
  47. package/cjs/utils/useInstanceRefActions.js +43 -54
  48. package/cjs/utils/useTree.js +80 -76
  49. package/esm/TreeView.js +16 -18
  50. package/esm/TreeViewContext.js +31 -32
  51. package/esm/config/cssClassesConstants.js +6 -12
  52. package/esm/config/useTreeview.js +56 -73
  53. package/esm/hoc/DnDTreeContext.js +14 -0
  54. package/esm/hoc/SortableItemContext.js +17 -0
  55. package/esm/hoc/WithConditionalDnDContext.js +128 -0
  56. package/esm/hoc/WithDnDSortableItemContext.js +61 -0
  57. package/esm/index.js +9 -8
  58. package/esm/parts/CheckboxSelectable.js +46 -36
  59. package/esm/parts/ChildrenCountDisplayer.js +20 -16
  60. package/esm/parts/DnDHandle.js +38 -0
  61. package/esm/parts/DropIndicator.js +68 -0
  62. package/esm/parts/ExpandCaret.js +72 -54
  63. package/esm/parts/Icon.js +22 -16
  64. package/esm/parts/NestingSpace.js +27 -14
  65. package/esm/parts/RadioSelectable.js +28 -20
  66. package/esm/parts/TreeItem.js +125 -114
  67. package/esm/parts/TreeItemText.js +85 -58
  68. package/esm/parts/TreeList.js +119 -91
  69. package/esm/plugins/dnd/TreeDndPlugin.js +3 -30
  70. package/esm/plugins/dnd/index.js +1 -3
  71. package/esm/plugins/index.js +7 -9
  72. package/esm/plugins/roving/TreeRovingPlugin.js +3 -6
  73. package/esm/plugins/roving/index.js +1 -3
  74. package/esm/plugins/searchable/SearchableTreePlugin.js +3 -6
  75. package/esm/plugins/searchable/index.js +1 -3
  76. package/esm/plugins/selectable/SelectablePluginTree.js +3 -6
  77. package/esm/plugins/selectable/index.js +1 -3
  78. package/esm/plugins/toolbar/TreeToolbarPlugin.js +3 -6
  79. package/esm/plugins/toolbar/index.js +1 -3
  80. package/esm/plugins/tree/TreeDataPlugin.js +3 -6
  81. package/esm/plugins/tree/index.js +1 -3
  82. package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +3 -6
  83. package/esm/plugins/virtualization/index.js +1 -3
  84. package/esm/react-desc-prop-types.js +44 -47
  85. package/esm/related-components/TreeViewSearchBar.js +32 -13
  86. package/esm/sharedTypes.js +1 -2
  87. package/esm/utils/array-helpers.js +6 -6
  88. package/esm/utils/group-expands-helpers.js +46 -56
  89. package/esm/utils/keyboard-helpers.js +74 -46
  90. package/esm/utils/object-helpers.js +31 -14
  91. package/esm/utils/refs-helpers.js +19 -15
  92. package/esm/utils/selectable-helper.js +43 -32
  93. package/esm/utils/string-helpers.js +3 -6
  94. package/esm/utils/tree-helpers.js +143 -73
  95. package/esm/utils/useInstanceRefActions.js +35 -21
  96. package/esm/utils/useTree.js +59 -35
  97. package/package.json +35 -19
  98. package/types/hoc/DnDTreeContext.d.ts +14 -0
  99. package/types/hoc/SortableItemContext.d.ts +19 -0
  100. package/types/hoc/WithConditionalDnDContext.d.ts +4 -0
  101. package/types/hoc/WithDnDSortableItemContext.d.ts +4 -0
  102. package/types/parts/DnDHandle.d.ts +6 -0
  103. package/types/parts/DropIndicator.d.ts +10 -0
  104. package/types/parts/TreeItem.d.ts +4 -11
  105. package/types/parts/TreeList.d.ts +0 -4
  106. package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -2
  107. package/types/react-desc-prop-types.d.ts +17 -3
  108. package/types/sharedTypes.d.ts +1 -8
  109. package/types/utils/keyboard-helpers.d.ts +2 -1
  110. package/types/utils/refs-helpers.d.ts +1 -1
  111. package/types/utils/tree-helpers.d.ts +4 -1
  112. package/types/utils/useTree.d.ts +1 -0
  113. package/cjs/TreeView.js.map +0 -7
  114. package/cjs/TreeViewContext.js.map +0 -7
  115. package/cjs/config/cssClassesConstants.js.map +0 -7
  116. package/cjs/config/useTreeview.js.map +0 -7
  117. package/cjs/index.js.map +0 -7
  118. package/cjs/parts/CheckboxSelectable.js.map +0 -7
  119. package/cjs/parts/ChildrenCountDisplayer.js.map +0 -7
  120. package/cjs/parts/ExpandCaret.js.map +0 -7
  121. package/cjs/parts/Icon.js.map +0 -7
  122. package/cjs/parts/NestingSpace.js.map +0 -7
  123. package/cjs/parts/RadioSelectable.js.map +0 -7
  124. package/cjs/parts/TreeItem.js.map +0 -7
  125. package/cjs/parts/TreeItemText.js.map +0 -7
  126. package/cjs/parts/TreeList.js.map +0 -7
  127. package/cjs/plugins/dnd/TreeDndPlugin.js.map +0 -7
  128. package/cjs/plugins/dnd/index.js.map +0 -7
  129. package/cjs/plugins/index.js.map +0 -7
  130. package/cjs/plugins/roving/TreeRovingPlugin.js.map +0 -7
  131. package/cjs/plugins/roving/index.js.map +0 -7
  132. package/cjs/plugins/searchable/SearchableTreePlugin.js.map +0 -7
  133. package/cjs/plugins/searchable/index.js.map +0 -7
  134. package/cjs/plugins/selectable/SelectablePluginTree.js.map +0 -7
  135. package/cjs/plugins/selectable/index.js.map +0 -7
  136. package/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
  137. package/cjs/plugins/toolbar/index.js.map +0 -7
  138. package/cjs/plugins/tree/TreeDataPlugin.js.map +0 -7
  139. package/cjs/plugins/tree/index.js.map +0 -7
  140. package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
  141. package/cjs/plugins/virtualization/index.js.map +0 -7
  142. package/cjs/react-desc-prop-types.js.map +0 -7
  143. package/cjs/related-components/TreeViewSearchBar.js.map +0 -7
  144. package/cjs/sharedTypes.js.map +0 -7
  145. package/cjs/utils/array-helpers.js.map +0 -7
  146. package/cjs/utils/dnd-helpers.js +0 -146
  147. package/cjs/utils/dnd-helpers.js.map +0 -7
  148. package/cjs/utils/group-expands-helpers.js.map +0 -7
  149. package/cjs/utils/keyboard-helpers.js.map +0 -7
  150. package/cjs/utils/object-helpers.js.map +0 -7
  151. package/cjs/utils/refs-helpers.js.map +0 -7
  152. package/cjs/utils/selectable-helper.js.map +0 -7
  153. package/cjs/utils/string-helpers.js.map +0 -7
  154. package/cjs/utils/tree-helpers.js.map +0 -7
  155. package/cjs/utils/useDnDHelpers.js +0 -199
  156. package/cjs/utils/useDnDHelpers.js.map +0 -7
  157. package/cjs/utils/useInstanceRefActions.js.map +0 -7
  158. package/cjs/utils/useTree.js.map +0 -7
  159. package/esm/TreeView.js.map +0 -7
  160. package/esm/TreeViewContext.js.map +0 -7
  161. package/esm/config/cssClassesConstants.js.map +0 -7
  162. package/esm/config/useTreeview.js.map +0 -7
  163. package/esm/index.js.map +0 -7
  164. package/esm/parts/CheckboxSelectable.js.map +0 -7
  165. package/esm/parts/ChildrenCountDisplayer.js.map +0 -7
  166. package/esm/parts/ExpandCaret.js.map +0 -7
  167. package/esm/parts/Icon.js.map +0 -7
  168. package/esm/parts/NestingSpace.js.map +0 -7
  169. package/esm/parts/RadioSelectable.js.map +0 -7
  170. package/esm/parts/TreeItem.js.map +0 -7
  171. package/esm/parts/TreeItemText.js.map +0 -7
  172. package/esm/parts/TreeList.js.map +0 -7
  173. package/esm/plugins/dnd/TreeDndPlugin.js.map +0 -7
  174. package/esm/plugins/dnd/index.js.map +0 -7
  175. package/esm/plugins/index.js.map +0 -7
  176. package/esm/plugins/roving/TreeRovingPlugin.js.map +0 -7
  177. package/esm/plugins/roving/index.js.map +0 -7
  178. package/esm/plugins/searchable/SearchableTreePlugin.js.map +0 -7
  179. package/esm/plugins/searchable/index.js.map +0 -7
  180. package/esm/plugins/selectable/SelectablePluginTree.js.map +0 -7
  181. package/esm/plugins/selectable/index.js.map +0 -7
  182. package/esm/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
  183. package/esm/plugins/toolbar/index.js.map +0 -7
  184. package/esm/plugins/tree/TreeDataPlugin.js.map +0 -7
  185. package/esm/plugins/tree/index.js.map +0 -7
  186. package/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
  187. package/esm/plugins/virtualization/index.js.map +0 -7
  188. package/esm/react-desc-prop-types.js.map +0 -7
  189. package/esm/related-components/TreeViewSearchBar.js.map +0 -7
  190. package/esm/sharedTypes.js.map +0 -7
  191. package/esm/utils/array-helpers.js.map +0 -7
  192. package/esm/utils/dnd-helpers.js +0 -117
  193. package/esm/utils/dnd-helpers.js.map +0 -7
  194. package/esm/utils/group-expands-helpers.js.map +0 -7
  195. package/esm/utils/keyboard-helpers.js.map +0 -7
  196. package/esm/utils/object-helpers.js.map +0 -7
  197. package/esm/utils/refs-helpers.js.map +0 -7
  198. package/esm/utils/selectable-helper.js.map +0 -7
  199. package/esm/utils/string-helpers.js.map +0 -7
  200. package/esm/utils/tree-helpers.js.map +0 -7
  201. package/esm/utils/useDnDHelpers.js +0 -170
  202. package/esm/utils/useDnDHelpers.js.map +0 -7
  203. package/esm/utils/useInstanceRefActions.js.map +0 -7
  204. package/esm/utils/useTree.js.map +0 -7
  205. package/types/utils/dnd-helpers.d.ts +0 -39
  206. package/types/utils/useDnDHelpers.d.ts +0 -26
@@ -1,99 +1,127 @@
1
- import * as React from "react";
2
- import React2, { useContext } from "react";
3
- import { SortableContainer } from "@elliemae/react-sortable-hoc";
4
- import { aggregatedClasses } from "@elliemae/ds-classnames";
5
- import { DSCircularProgressIndicator } from "@elliemae/ds-circular-progress-indicator";
6
- import TreeViewContext from "../TreeViewContext";
7
- import { DSTreeViewPrefix, treeListBlockName } from "../config/cssClassesConstants";
8
- import { TreeItem, DragAndDropTreeItem } from "./TreeItem";
9
- const treeListNoItemsBn = `${treeListBlockName}-no-items`;
10
- const TreeListNoItems = aggregatedClasses("div", {
11
- "data-testid": treeListNoItemsBn
12
- })(treeListNoItemsBn);
13
- const TreeListWrapper = aggregatedClasses("ul", {
14
- "data-testid": treeListBlockName,
15
- role: "tree"
16
- })(treeListBlockName, null, ({ rowSize }) => ({
17
- [`rowsize-${rowSize}`]: rowSize
18
- }));
19
- const compactRowClass = `${DSTreeViewPrefix}-tv-row-size-compact`;
20
- const normaRowClass = `${DSTreeViewPrefix}-tv-row-size-normal`;
21
- const TreeList = (props) => {
22
- const { onMouseDragOverItem } = props;
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
3
+ import 'core-js/modules/esnext.async-iterator.map.js';
4
+ import 'core-js/modules/esnext.iterator.map.js';
5
+ import 'core-js/modules/esnext.async-iterator.filter.js';
6
+ import 'core-js/modules/esnext.iterator.constructor.js';
7
+ import 'core-js/modules/esnext.iterator.filter.js';
8
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
9
+ import 'core-js/modules/esnext.iterator.for-each.js';
10
+ import { useContext } from 'react';
11
+ import { aggregatedClasses } from '@elliemae/ds-classnames';
12
+ import { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';
13
+ import TreeViewContext from '../TreeViewContext.js';
14
+ import { treeListBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
15
+ import TreeItem from './TreeItem.js';
16
+ import { withConditionalDnDRowContext } from '../hoc/WithConditionalDnDContext.js';
17
+ import { DnDTreeContext } from '../hoc/DnDTreeContext.js';
18
+ import { jsxs, jsx } from 'react/jsx-runtime';
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
+ const treeListNoItemsBn = "".concat(treeListBlockName, "-no-items");
24
+ const TreeListNoItems = aggregatedClasses('div', {
25
+ 'data-testid': treeListNoItemsBn
26
+ })(treeListNoItemsBn); // React.ComponentProps<'ul'> uses LegacyRef typings that existed pre-hook era
27
+ // we omit the LegacyRef typings in favor of hook-era typings
28
+
29
+ const TreeListWrapper = aggregatedClasses('ul', {
30
+ 'data-testid': treeListBlockName,
31
+ role: 'tree'
32
+ })(treeListBlockName, null, _ref => {
33
+ let {
34
+ rowSize
35
+ } = _ref;
36
+ return {
37
+ ["rowsize-".concat(rowSize)]: rowSize
38
+ };
39
+ });
40
+ const compactRowClass = "".concat(DSTreeViewPrefix, "-tv-row-size-compact");
41
+ const normaRowClass = "".concat(DSTreeViewPrefix, "-tv-row-size-normal");
42
+
43
+ const TreeListComp = () => {
23
44
  const ctx = useContext(TreeViewContext);
24
45
  const {
25
46
  virtualListRef,
26
47
  virtualListHelpers,
27
- visibleItems,
28
- withDragAndDrop,
29
- props: { width, height, rowSize, noItemsPlaceholder, isLoading }
48
+ visibleItems: flattenedVisibleItems,
49
+ props: {
50
+ width,
51
+ height,
52
+ rowSize,
53
+ noItemsPlaceholder,
54
+ isLoading
55
+ }
30
56
  } = ctx;
31
- const { totalSize, virtualItems } = virtualListHelpers;
32
- const className = `${rowSize === "compact" ? `${compactRowClass}` : `${normaRowClass}`}`;
33
- return /* @__PURE__ */ React2.createElement(TreeListWrapper, {
57
+ const {
58
+ totalSize,
59
+ virtualItems
60
+ } = virtualListHelpers;
61
+ const className = "".concat(rowSize === 'compact' ? "".concat(compactRowClass) : "".concat(normaRowClass));
62
+ const {
63
+ visibleItems
64
+ } = useContext(DnDTreeContext);
65
+ return /*#__PURE__*/jsxs(TreeListWrapper, {
34
66
  ref: virtualListRef,
35
- className,
36
- style: {
37
- height: `${typeof height === "number" ? `${height}px` : height}`,
38
- width: `${typeof width === "number" ? `${width}px` : width}`,
39
- overflow: "auto"
40
- }
41
- }, isLoading ? /* @__PURE__ */ React2.createElement("div", {
67
+ className: className,
42
68
  style: {
43
- width: "100%",
44
- height: "100%",
45
- display: "flex",
46
- alignItems: "center",
47
- justifyContent: "center"
48
- }
49
- }, /* @__PURE__ */ React2.createElement(DSCircularProgressIndicator, {
50
- size: "xl",
51
- loading: isLoading,
52
- showLabel: true,
53
- waiting: false,
54
- showTooltip: false
55
- })) : null, !isLoading && virtualItems.length === 0 ? /* @__PURE__ */ React2.createElement(TreeListNoItems, null, noItemsPlaceholder) : null, !isLoading && virtualItems.length !== 0 ? /* @__PURE__ */ React2.createElement("div", {
56
- style: {
57
- height: `${totalSize}px`,
58
- width: "100%",
59
- position: "relative"
60
- }
61
- }, virtualItems.map((virtualItem) => {
62
- const { index, measureRef, start } = virtualItem;
63
- const item = visibleItems[index];
64
- item.virtualIndex = index;
65
- const { id } = item;
66
- const style = {
67
- position: "absolute",
68
- top: 0,
69
- left: 0,
70
- width: "100%",
71
- transform: `translateY(${start}px)`
72
- };
73
- const listItemProps = {
74
- key: `DS-TreeView-List-Item-${id}`,
75
- virtualItemRef: measureRef,
76
- index,
77
- itemIndex: index,
78
- item,
79
- itemWrapperStyle: style
80
- };
81
- if (withDragAndDrop)
82
- return /* @__PURE__ */ React2.createElement(DragAndDropTreeItem, {
83
- ...listItemProps,
84
- onMouseDragOverItem
85
- });
86
- return /* @__PURE__ */ React2.createElement(TreeItem, {
87
- ...listItemProps
88
- });
89
- })) : null);
90
- };
91
- const DragAndDropTreeList = SortableContainer(TreeList);
92
- export {
93
- DragAndDropTreeList,
94
- TreeList,
95
- TreeListNoItems,
96
- TreeListWrapper,
97
- treeListNoItemsBn
69
+ height: "".concat(typeof height === 'number' ? "".concat(height, "px") : height),
70
+ width: "".concat(typeof width === 'number' ? "".concat(width, "px") : width),
71
+ overflow: 'auto'
72
+ },
73
+ children: [isLoading ? /*#__PURE__*/_jsx("div", {
74
+ style: {
75
+ width: '100%',
76
+ height: '100%',
77
+ display: 'flex',
78
+ alignItems: 'center',
79
+ justifyContent: 'center'
80
+ }
81
+ }, void 0, /*#__PURE__*/_jsx(DSCircularProgressIndicator, {
82
+ size: "xl",
83
+ loading: isLoading,
84
+ showLabel: true,
85
+ waiting: false,
86
+ showTooltip: false
87
+ })) : null, !isLoading && virtualItems.length === 0 ? /*#__PURE__*/_jsx(TreeListNoItems, {}, void 0, noItemsPlaceholder) : null, !isLoading && virtualItems.length !== 0 ? /*#__PURE__*/_jsx("div", {
88
+ style: {
89
+ height: "".concat(totalSize, "px"),
90
+ width: '100%',
91
+ position: 'relative'
92
+ }
93
+ }, void 0, virtualItems.map(virtualItem => {
94
+ const {
95
+ index,
96
+ measureRef,
97
+ start
98
+ } = virtualItem;
99
+ const item = (visibleItems || flattenedVisibleItems)[index];
100
+ if (!item) return null;
101
+ item.virtualIndex = index;
102
+ const {
103
+ id
104
+ } = item;
105
+ const style = {
106
+ position: 'absolute',
107
+ top: "".concat(start, "px"),
108
+ left: 0,
109
+ width: '100%'
110
+ };
111
+ const listItemProps = {
112
+ key: "DS-TreeView-List-Item-".concat(id),
113
+ virtualItemRef: measureRef,
114
+ index,
115
+ // this is consumed by the DnD HOC
116
+ itemIndex: index,
117
+ item,
118
+ itemWrapperStyle: style
119
+ };
120
+ return /*#__PURE__*/jsx(TreeItem, _objectSpread({}, listItemProps));
121
+ })) : null]
122
+ });
98
123
  };
99
- //# sourceMappingURL=TreeList.js.map
124
+
125
+ const TreeList = withConditionalDnDRowContext(TreeListComp);
126
+
127
+ export { TreeList, TreeListNoItems, TreeListWrapper, treeListNoItemsBn };
@@ -1,30 +1,3 @@
1
- import * as React from "react";
2
- import React2, { useContext } from "react";
3
- import { DragAndDropTreeList } from "../../parts/TreeList";
4
- import { useDnDHelpers } from "../../utils/useDnDHelpers";
5
- import { keyCodes } from "../../utils/dnd-helpers";
6
- import TreeViewContext from "../../TreeViewContext";
7
- const TreeDnD = () => {
8
- const { updateBeforeSortStart, onSortStart, onMouseDragOverItem, onSortEnd } = useDnDHelpers();
9
- const ctx = useContext(TreeViewContext);
10
- const { virtualListRef } = ctx;
11
- return /* @__PURE__ */ React2.createElement(DragAndDropTreeList, {
12
- useDragHandle: true,
13
- transitionDuration: 0,
14
- keyboardSortingTransitionDuration: 0,
15
- hideSortableGhost: false,
16
- disableAnimation: true,
17
- updateBeforeSortStart,
18
- onSortStart,
19
- onMouseDragOverItem,
20
- onSortEnd,
21
- getContainer: () => virtualListRef?.current,
22
- keyCodes
23
- });
24
- };
25
- const TreeDndPlugin = "tree-dnd";
26
- export {
27
- TreeDnD,
28
- TreeDndPlugin
29
- };
30
- //# sourceMappingURL=TreeDndPlugin.js.map
1
+ const TreeDndPlugin = 'tree-dnd';
2
+
3
+ export { TreeDndPlugin };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./TreeDndPlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { TreeDndPlugin } from './TreeDndPlugin.js';
@@ -1,9 +1,7 @@
1
- import * as React from "react";
2
- export * from "./dnd";
3
- export * from "./roving";
4
- export * from "./selectable";
5
- export * from "./toolbar";
6
- export * from "./tree";
7
- export * from "./virtualization";
8
- export * from "./searchable";
9
- //# sourceMappingURL=index.js.map
1
+ export { TreeDndPlugin } from './dnd/TreeDndPlugin.js';
2
+ export { TreeRovingPlugin } from './roving/TreeRovingPlugin.js';
3
+ export { SelectablePluginTree } from './selectable/SelectablePluginTree.js';
4
+ export { TreeToolbarPlugin } from './toolbar/TreeToolbarPlugin.js';
5
+ export { TreePluginList } from './tree/TreeDataPlugin.js';
6
+ export { TreeVirtualizationPlugin } from './virtualization/TreeVirtualizationPlugin.js';
7
+ export { SearchableTreePlugin } from './searchable/SearchableTreePlugin.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const TreeRovingPlugin = "tree-roving";
3
- export {
4
- TreeRovingPlugin
5
- };
6
- //# sourceMappingURL=TreeRovingPlugin.js.map
1
+ const TreeRovingPlugin = 'tree-roving';
2
+
3
+ export { TreeRovingPlugin };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./TreeRovingPlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { TreeRovingPlugin } from './TreeRovingPlugin.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const SearchableTreePlugin = "tree-searchable";
3
- export {
4
- SearchableTreePlugin
5
- };
6
- //# sourceMappingURL=SearchableTreePlugin.js.map
1
+ const SearchableTreePlugin = 'tree-searchable';
2
+
3
+ export { SearchableTreePlugin };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./SearchableTreePlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { SearchableTreePlugin } from './SearchableTreePlugin.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const SelectablePluginTree = "tree-selectable";
3
- export {
4
- SelectablePluginTree
5
- };
6
- //# sourceMappingURL=SelectablePluginTree.js.map
1
+ const SelectablePluginTree = 'tree-selectable';
2
+
3
+ export { SelectablePluginTree };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./SelectablePluginTree";
3
- //# sourceMappingURL=index.js.map
1
+ export { SelectablePluginTree } from './SelectablePluginTree.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const TreeToolbarPlugin = "tree-toolbar";
3
- export {
4
- TreeToolbarPlugin
5
- };
6
- //# sourceMappingURL=TreeToolbarPlugin.js.map
1
+ const TreeToolbarPlugin = 'tree-toolbar';
2
+
3
+ export { TreeToolbarPlugin };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./TreeToolbarPlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { TreeToolbarPlugin } from './TreeToolbarPlugin.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const TreePluginList = "tree-data";
3
- export {
4
- TreePluginList
5
- };
6
- //# sourceMappingURL=TreeDataPlugin.js.map
1
+ const TreePluginList = 'tree-data';
2
+
3
+ export { TreePluginList };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./TreeDataPlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { TreePluginList } from './TreeDataPlugin.js';
@@ -1,6 +1,3 @@
1
- import * as React from "react";
2
- const TreeVirtualizationPlugin = "tree-virtualization";
3
- export {
4
- TreeVirtualizationPlugin
5
- };
6
- //# sourceMappingURL=TreeVirtualizationPlugin.js.map
1
+ const TreeVirtualizationPlugin = 'tree-virtualization';
2
+
3
+ export { TreeVirtualizationPlugin };
@@ -1,3 +1 @@
1
- import * as React from "react";
2
- export * from "./TreeVirtualizationPlugin";
3
- //# sourceMappingURL=index.js.map
1
+ export { TreeVirtualizationPlugin } from './TreeVirtualizationPlugin.js';
@@ -1,55 +1,52 @@
1
- import * as React from "react";
2
- import { PropTypes } from "react-desc";
1
+ import { PropTypes } from 'react-desc';
2
+
3
+ /* eslint-disable max-lines */
3
4
  const TreeViewPropTypes = {
4
5
  data: PropTypes.arrayOf(PropTypes.shape({
5
6
  children: PropTypes.arrayOf(PropTypes.object),
6
7
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
7
- isGroup: PropTypes.oneOfType([PropTypes.oneOf([void 0, null]), PropTypes.bool]),
8
+ isGroup: PropTypes.oneOfType([PropTypes.oneOf([undefined, null]), PropTypes.bool]),
8
9
  name: PropTypes.string,
9
10
  node: PropTypes.object
10
- })).description("data to populate tree view").isRequired,
11
- plugins: PropTypes.arrayOf(PropTypes.string).description("list of enabled plugins").defaultValue([]),
12
- selection: PropTypes.object.description("pre selected items").defaultValue({}),
13
- expanded: PropTypes.object.description("control what items are expanded").defaultValue(void 0),
11
+ })).description('data to populate tree view').isRequired,
12
+ plugins: PropTypes.arrayOf(PropTypes.string).description('list of enabled plugins').defaultValue([]),
13
+ selection: PropTypes.object.description('pre selected items').defaultValue({}),
14
+ expanded: PropTypes.object.description('control what items are expanded').defaultValue(undefined),
14
15
  instanceRef: PropTypes.shape({
15
- current: PropTypes.oneOfType([
16
- PropTypes.oneOf([null, void 0]),
17
- PropTypes.shape({
18
- actions: PropTypes.shape({
19
- toggleExpandAll: PropTypes.func,
20
- scrollTo: PropTypes.func
21
- }).description("").isRequired
22
- })
23
- ])
24
- }).description("instance ref"),
25
- isItemDisabled: PropTypes.func.description("Function that receives an item, and returns whether that item should be disabled").defaultValue("() => false"),
26
- disableIcons: PropTypes.bool.description("disable icons").defaultValue(false),
27
- fluid: PropTypes.bool.description("whether is fluid or not").defaultValue(false),
28
- isMultiSelect: PropTypes.bool.description("whether the tree view is multi select or not").defaultValue(false),
29
- isSingleSelect: PropTypes.bool.description("wheter the tree view is single select or not").defaultValue(false),
30
- isLoading: PropTypes.bool.description("wheter the tree should show the loading state or not").defaultValue(false),
31
- restrictDragAndDrop: PropTypes.bool.description("whether to restrict DnD functionality or not").defaultValue(false),
32
- showChildrenAmount: PropTypes.bool.description("whether to show the amount of children or not").defaultValue(false),
33
- sortable: PropTypes.bool.description("whether the sortable functionality is active or not").defaultValue(false),
34
- onItemClick: PropTypes.func.description("function executed when clicking on an item").defaultValue("() => {}"),
35
- onItemFocus: PropTypes.func.description("function executed when focusing on an item").defaultValue("() => {}"),
36
- onVisibleItemsChange: PropTypes.func.description("function executed when the visible items change").defaultValue("() => {}"),
37
- onOrderChange: PropTypes.func.description("function executed when the items order changes").defaultValue("() => {}"),
38
- onSelectionChange: PropTypes.func.description("function executed when the selection changes").defaultValue("() => {}"),
39
- onExpandChange: PropTypes.func.description("function executed when expanding an item").defaultValue("() => {}"),
40
- onInstanceRefInitialized: PropTypes.func.description("function executed when instanceRef has terminated instanciation").defaultValue("() => {}"),
41
- rowSize: PropTypes.oneOf(["normal", "compact"]).description("size of the row").defaultValue("normal"),
42
- labelOverflow: PropTypes.oneOf(["wrap", "wrap-all", "truncate"]).description("label truncation preference").defaultValue("wrap"),
43
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("components width").defaultValue("100%"),
44
- height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("components height").defaultValue("100%"),
45
- groupIcon: PropTypes.node.description("icon for groups"),
46
- itemIcon: PropTypes.node.description("icon for items"),
47
- searchQuery: PropTypes.string.description("search query value"),
48
- noItemsPlaceholder: PropTypes.string.description("message to be shown when there are no items in the treeview to be displayed").defaultValue("No items found"),
49
- name: PropTypes.string.description("property key to identifier for items labels").defaultValue("name"),
50
- highlightOnlyQuery: PropTypes.bool.description("whether to highlight results or not").defaultValue(false)
16
+ current: PropTypes.oneOfType([PropTypes.oneOf([null, undefined]), PropTypes.shape({
17
+ actions: PropTypes.shape({
18
+ toggleExpandAll: PropTypes.func,
19
+ scrollTo: PropTypes.func
20
+ }).description('').isRequired
21
+ })])
22
+ }).description('instance ref'),
23
+ isItemDisabled: PropTypes.func.description('Function that receives an item, and returns whether that item should be disabled').defaultValue('() => false'),
24
+ disableIcons: PropTypes.bool.description('disable icons').defaultValue(false),
25
+ fluid: PropTypes.bool.description('whether is fluid or not').defaultValue(false),
26
+ isMultiSelect: PropTypes.bool.description('whether the tree view is multi select or not').defaultValue(false),
27
+ isSingleSelect: PropTypes.bool.description('wheter the tree view is single select or not').defaultValue(false),
28
+ isLoading: PropTypes.bool.description('wheter the tree should show the loading state or not').defaultValue(false),
29
+ getIsDropValid: PropTypes.func.description("Function that returns true if the drop is valid and false if it's not").defaultValue('() => true'),
30
+ restrictDragAndDrop: PropTypes.bool.description('whether to restrict DnD functionality or not').defaultValue(false),
31
+ showChildrenAmount: PropTypes.bool.description('whether to show the amount of children or not').defaultValue(false),
32
+ sortable: PropTypes.bool.description('whether the sortable functionality is active or not').defaultValue(false),
33
+ onItemClick: PropTypes.func.description('function executed when clicking on an item').defaultValue('() => {}'),
34
+ onItemFocus: PropTypes.func.description('function executed when focusing on an item').defaultValue('() => {}'),
35
+ onVisibleItemsChange: PropTypes.func.description('function executed when the visible items change').defaultValue('() => {}'),
36
+ onOrderChange: PropTypes.func.description('function executed when the items order changes').defaultValue('() => {}'),
37
+ onSelectionChange: PropTypes.func.description('function executed when the selection changes').defaultValue('() => {}'),
38
+ onExpandChange: PropTypes.func.description('function executed when expanding an item').defaultValue('() => {}'),
39
+ onInstanceRefInitialized: PropTypes.func.description('function executed when instanceRef has terminated instanciation').defaultValue('() => {}'),
40
+ rowSize: PropTypes.oneOf(['normal', 'compact']).description('size of the row').defaultValue('normal'),
41
+ labelOverflow: PropTypes.oneOf(['wrap', 'wrap-all', 'truncate']).description('label truncation preference').defaultValue('wrap'),
42
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('components width').defaultValue('100%'),
43
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('components height').defaultValue('100%'),
44
+ groupIcon: PropTypes.node.description('icon for groups'),
45
+ itemIcon: PropTypes.node.description('icon for items'),
46
+ searchQuery: PropTypes.string.description('search query value'),
47
+ noItemsPlaceholder: PropTypes.string.description('message to be shown when there are no items in the treeview to be displayed').defaultValue('No items found'),
48
+ name: PropTypes.string.description('property key to identifier for items labels').defaultValue('name'),
49
+ highlightOnlyQuery: PropTypes.bool.description('whether to highlight results or not').defaultValue(false)
51
50
  };
52
- export {
53
- TreeViewPropTypes
54
- };
55
- //# sourceMappingURL=react-desc-prop-types.js.map
51
+
52
+ export { TreeViewPropTypes };
@@ -1,21 +1,40 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { DSNavSearchBox } from "@elliemae/ds-form";
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'react';
3
+ import { DSNavSearchBox } from '@elliemae/ds-form';
4
+
4
5
  function TreeViewSearchBar(props) {
5
- const { handleChange, onNext, onPrevious, onClear, currentResultIndex, totalResults, value } = props;
6
- return /* @__PURE__ */ React2.createElement(DSNavSearchBox, {
7
- onChange: (v) => {
8
- handleChange({ target: { value: v } });
9
- },
6
+ const {
7
+ handleChange,
10
8
  onNext,
11
9
  onPrevious,
12
10
  onClear,
13
11
  currentResultIndex,
14
12
  totalResults,
15
13
  value
14
+ } = props;
15
+ return /*#__PURE__*/_jsx(DSNavSearchBox, {
16
+ onChange: v => {
17
+ handleChange({
18
+ target: {
19
+ value: v
20
+ }
21
+ });
22
+ },
23
+ onNext: onNext,
24
+ onPrevious: onPrevious,
25
+ onClear: onClear,
26
+ currentResultIndex: currentResultIndex,
27
+ totalResults: totalResults,
28
+ value: value
16
29
  });
17
- }
18
- export {
19
- TreeViewSearchBar
20
- };
21
- //# sourceMappingURL=TreeViewSearchBar.js.map
30
+ } // TreeViewSearchBar.propTypes = {
31
+ // value: PropTypes.string.isRequired,
32
+ // handleChange: PropTypes.func.isRequired,
33
+ // onNext: PropTypes.func.isRequired,
34
+ // onPrevious: PropTypes.func.isRequired,
35
+ // onClear: PropTypes.func.isRequired,
36
+ // currentResultIndex: PropTypes.number.isRequired,
37
+ // totalResults: PropTypes.number.isRequired,
38
+ // };
39
+
40
+ export { TreeViewSearchBar };
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=sharedTypes.js.map
1
+
@@ -1,6 +1,9 @@
1
- import * as React from "react";
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+
3
+ // https://github.com/sindresorhus/array-move/blob/master/index.js
2
4
  const arrayMoveMutate = (array, from, to) => {
3
5
  const startIndex = from < 0 ? array.length + from : from;
6
+
4
7
  if (startIndex >= 0 && startIndex < array.length) {
5
8
  const endIndex = to < 0 ? array.length + to : to;
6
9
  const [item] = array.splice(from, 1);
@@ -12,8 +15,5 @@ const arrayMove = (array, from, to) => {
12
15
  arrayMoveMutate(newArray, from, to);
13
16
  return newArray;
14
17
  };
15
- export {
16
- arrayMove,
17
- arrayMoveMutate
18
- };
19
- //# sourceMappingURL=array-helpers.js.map
18
+
19
+ export { arrayMove, arrayMoveMutate };