@elliemae/ds-treeview 2.3.1 → 3.0.0-alpha.3
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/dist/cjs/TreeView.js +50 -0
- package/dist/cjs/TreeView.js.map +7 -0
- package/dist/cjs/TreeViewContext.js +116 -0
- package/dist/cjs/TreeViewContext.js.map +7 -0
- package/dist/cjs/config/cssClassesConstants.js +41 -0
- package/dist/cjs/config/cssClassesConstants.js.map +7 -0
- package/dist/cjs/config/useTreeview.js +163 -0
- package/dist/cjs/config/useTreeview.js.map +7 -0
- package/dist/cjs/hoc/DnDTreeContext.js +45 -0
- package/dist/cjs/hoc/DnDTreeContext.js.map +7 -0
- package/dist/cjs/hoc/SortableItemContext.js +46 -0
- package/dist/cjs/hoc/SortableItemContext.js.map +7 -0
- package/dist/cjs/hoc/WithConditionalDnDContext.js +134 -0
- package/dist/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js +83 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/CheckboxSelectable.js +111 -0
- package/dist/cjs/parts/CheckboxSelectable.js.map +7 -0
- package/dist/cjs/parts/ChildrenCountDisplayer.js +47 -0
- package/dist/cjs/parts/ChildrenCountDisplayer.js.map +7 -0
- package/dist/cjs/parts/DnDHandle.js +71 -0
- package/dist/cjs/parts/DnDHandle.js.map +7 -0
- package/dist/cjs/parts/DropIndicator.js +80 -0
- package/dist/cjs/parts/DropIndicator.js.map +7 -0
- package/dist/cjs/parts/ExpandCaret.js +96 -0
- package/dist/cjs/parts/ExpandCaret.js.map +7 -0
- package/dist/cjs/parts/Icon.js +52 -0
- package/dist/cjs/parts/Icon.js.map +7 -0
- package/dist/cjs/parts/NestingSpace.js +55 -0
- package/dist/cjs/parts/NestingSpace.js.map +7 -0
- package/dist/cjs/parts/RadioSelectable.js +74 -0
- package/dist/cjs/parts/RadioSelectable.js.map +7 -0
- package/dist/cjs/parts/TreeItem.js +180 -0
- package/dist/cjs/parts/TreeItem.js.map +7 -0
- package/dist/cjs/parts/TreeItemText.js +101 -0
- package/dist/cjs/parts/TreeItemText.js.map +7 -0
- package/dist/cjs/parts/TreeList.js +135 -0
- package/dist/cjs/parts/TreeList.js.map +7 -0
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js +35 -0
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/dist/cjs/plugins/dnd/index.js +28 -0
- package/dist/cjs/plugins/dnd/index.js.map +7 -0
- package/dist/cjs/plugins/index.js +34 -0
- package/dist/cjs/plugins/index.js.map +7 -0
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js +35 -0
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/dist/cjs/plugins/roving/index.js +28 -0
- package/dist/cjs/plugins/roving/index.js.map +7 -0
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js +35 -0
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/dist/cjs/plugins/searchable/index.js +28 -0
- package/dist/cjs/plugins/searchable/index.js.map +7 -0
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js +35 -0
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/dist/cjs/plugins/selectable/index.js +28 -0
- package/dist/cjs/plugins/selectable/index.js.map +7 -0
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js +35 -0
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/dist/cjs/plugins/toolbar/index.js +28 -0
- package/dist/cjs/plugins/toolbar/index.js.map +7 -0
- package/dist/cjs/plugins/tree/TreeDataPlugin.js +35 -0
- package/dist/cjs/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/dist/cjs/plugins/tree/index.js +28 -0
- package/dist/cjs/plugins/tree/index.js.map +7 -0
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +35 -0
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/dist/cjs/plugins/virtualization/index.js +28 -0
- package/dist/cjs/plugins/virtualization/index.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +85 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/related-components/TreeViewSearchBar.js +50 -0
- package/dist/cjs/related-components/TreeViewSearchBar.js.map +7 -0
- package/dist/cjs/sharedTypes.js +27 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/cjs/utils/array-helpers.js +48 -0
- package/dist/cjs/utils/array-helpers.js.map +7 -0
- package/dist/cjs/utils/group-expands-helpers.js +138 -0
- package/dist/cjs/utils/group-expands-helpers.js.map +7 -0
- package/dist/cjs/utils/keyboard-helpers.js +170 -0
- package/dist/cjs/utils/keyboard-helpers.js.map +7 -0
- package/dist/cjs/utils/object-helpers.js +76 -0
- package/dist/cjs/utils/object-helpers.js.map +7 -0
- package/dist/cjs/utils/refs-helpers.js +52 -0
- package/dist/cjs/utils/refs-helpers.js.map +7 -0
- package/dist/cjs/utils/selectable-helper.js +102 -0
- package/dist/cjs/utils/selectable-helper.js.map +7 -0
- package/dist/cjs/utils/string-helpers.js +35 -0
- package/dist/cjs/utils/string-helpers.js.map +7 -0
- package/dist/cjs/utils/tree-helpers.js +184 -0
- package/dist/cjs/utils/tree-helpers.js.map +7 -0
- package/dist/cjs/utils/useInstanceRefActions.js +98 -0
- package/dist/cjs/utils/useInstanceRefActions.js.map +7 -0
- package/dist/cjs/utils/useTree.js +123 -0
- package/dist/cjs/utils/useTree.js.map +7 -0
- package/dist/esm/TreeView.js +21 -0
- package/dist/esm/TreeView.js.map +7 -0
- package/{esm → dist/esm}/TreeViewContext.js +24 -29
- package/dist/esm/TreeViewContext.js.map +7 -0
- package/dist/esm/config/cssClassesConstants.js +12 -0
- package/dist/esm/config/cssClassesConstants.js.map +7 -0
- package/dist/esm/config/useTreeview.js +136 -0
- package/dist/esm/config/useTreeview.js.map +7 -0
- package/dist/esm/hoc/DnDTreeContext.js +16 -0
- package/dist/esm/hoc/DnDTreeContext.js.map +7 -0
- package/dist/esm/hoc/SortableItemContext.js +17 -0
- package/dist/esm/hoc/SortableItemContext.js.map +7 -0
- package/dist/esm/hoc/WithConditionalDnDContext.js +107 -0
- package/dist/esm/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js +56 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/CheckboxSelectable.js +84 -0
- package/dist/esm/parts/CheckboxSelectable.js.map +7 -0
- package/dist/esm/parts/ChildrenCountDisplayer.js +18 -0
- package/dist/esm/parts/ChildrenCountDisplayer.js.map +7 -0
- package/dist/esm/parts/DnDHandle.js +44 -0
- package/dist/esm/parts/DnDHandle.js.map +7 -0
- package/dist/esm/parts/DropIndicator.js +51 -0
- package/dist/esm/parts/DropIndicator.js.map +7 -0
- package/dist/esm/parts/ExpandCaret.js +67 -0
- package/dist/esm/parts/ExpandCaret.js.map +7 -0
- package/dist/esm/parts/Icon.js +23 -0
- package/dist/esm/parts/Icon.js.map +7 -0
- package/dist/esm/parts/NestingSpace.js +26 -0
- package/dist/esm/parts/NestingSpace.js.map +7 -0
- package/dist/esm/parts/RadioSelectable.js +45 -0
- package/dist/esm/parts/RadioSelectable.js.map +7 -0
- package/dist/esm/parts/TreeItem.js +153 -0
- package/dist/esm/parts/TreeItem.js.map +7 -0
- package/dist/esm/parts/TreeItemText.js +72 -0
- package/dist/esm/parts/TreeItemText.js.map +7 -0
- package/dist/esm/parts/TreeList.js +108 -0
- package/dist/esm/parts/TreeList.js.map +7 -0
- package/dist/esm/plugins/dnd/TreeDndPlugin.js +6 -0
- package/dist/esm/plugins/dnd/TreeDndPlugin.js.map +7 -0
- package/dist/esm/plugins/dnd/index.js +3 -0
- package/dist/esm/plugins/dnd/index.js.map +7 -0
- package/dist/esm/plugins/index.js +9 -0
- package/dist/esm/plugins/index.js.map +7 -0
- package/dist/esm/plugins/roving/TreeRovingPlugin.js +6 -0
- package/dist/esm/plugins/roving/TreeRovingPlugin.js.map +7 -0
- package/dist/esm/plugins/roving/index.js +3 -0
- package/dist/esm/plugins/roving/index.js.map +7 -0
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js +6 -0
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js.map +7 -0
- package/dist/esm/plugins/searchable/index.js +3 -0
- package/dist/esm/plugins/searchable/index.js.map +7 -0
- package/dist/esm/plugins/selectable/SelectablePluginTree.js +6 -0
- package/dist/esm/plugins/selectable/SelectablePluginTree.js.map +7 -0
- package/dist/esm/plugins/selectable/index.js +3 -0
- package/dist/esm/plugins/selectable/index.js.map +7 -0
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js +6 -0
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js.map +7 -0
- package/dist/esm/plugins/toolbar/index.js +3 -0
- package/dist/esm/plugins/toolbar/index.js.map +7 -0
- package/dist/esm/plugins/tree/TreeDataPlugin.js +6 -0
- package/dist/esm/plugins/tree/TreeDataPlugin.js.map +7 -0
- package/dist/esm/plugins/tree/index.js +3 -0
- package/dist/esm/plugins/tree/index.js.map +7 -0
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js +6 -0
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +7 -0
- package/dist/esm/plugins/virtualization/index.js +3 -0
- package/dist/esm/plugins/virtualization/index.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +56 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/related-components/TreeViewSearchBar.js +21 -0
- package/dist/esm/related-components/TreeViewSearchBar.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/{esm → dist/esm}/utils/array-helpers.js +6 -6
- package/dist/esm/utils/array-helpers.js.map +7 -0
- package/dist/esm/utils/group-expands-helpers.js +109 -0
- package/dist/esm/utils/group-expands-helpers.js.map +7 -0
- package/{esm → dist/esm}/utils/keyboard-helpers.js +43 -71
- package/dist/esm/utils/keyboard-helpers.js.map +7 -0
- package/dist/esm/utils/object-helpers.js +47 -0
- package/dist/esm/utils/object-helpers.js.map +7 -0
- package/dist/esm/utils/refs-helpers.js +23 -0
- package/dist/esm/utils/refs-helpers.js.map +7 -0
- package/dist/esm/utils/selectable-helper.js +75 -0
- package/dist/esm/utils/selectable-helper.js.map +7 -0
- package/dist/esm/utils/string-helpers.js +6 -0
- package/dist/esm/utils/string-helpers.js.map +7 -0
- package/dist/esm/utils/tree-helpers.js +155 -0
- package/dist/esm/utils/tree-helpers.js.map +7 -0
- package/{esm → dist/esm}/utils/useInstanceRefActions.js +21 -35
- package/dist/esm/utils/useInstanceRefActions.js.map +7 -0
- package/dist/esm/utils/useTree.js +96 -0
- package/dist/esm/utils/useTree.js.map +7 -0
- package/package.json +133 -123
- package/cjs/TreeView.js +0 -30
- package/cjs/TreeViewContext.js +0 -98
- package/cjs/config/cssClassesConstants.js +0 -13
- package/cjs/config/useTreeview.js +0 -127
- package/cjs/hoc/DnDTreeContext.js +0 -18
- package/cjs/hoc/SortableItemContext.js +0 -21
- package/cjs/hoc/WithConditionalDnDContext.js +0 -138
- package/cjs/hoc/WithDnDSortableItemContext.js +0 -70
- package/cjs/index.js +0 -26
- package/cjs/parts/CheckboxSelectable.js +0 -86
- package/cjs/parts/ChildrenCountDisplayer.js +0 -30
- package/cjs/parts/DnDHandle.js +0 -46
- package/cjs/parts/DropIndicator.js +0 -75
- package/cjs/parts/ExpandCaret.js +0 -94
- package/cjs/parts/Icon.js +0 -37
- package/cjs/parts/NestingSpace.js +0 -47
- package/cjs/parts/RadioSelectable.js +0 -59
- package/cjs/parts/TreeItem.js +0 -185
- package/cjs/parts/TreeItemText.js +0 -108
- package/cjs/parts/TreeList.js +0 -139
- package/cjs/plugins/dnd/TreeDndPlugin.js +0 -7
- package/cjs/plugins/dnd/index.js +0 -9
- package/cjs/plugins/index.js +0 -21
- package/cjs/plugins/roving/TreeRovingPlugin.js +0 -7
- package/cjs/plugins/roving/index.js +0 -9
- package/cjs/plugins/searchable/SearchableTreePlugin.js +0 -7
- package/cjs/plugins/searchable/index.js +0 -9
- package/cjs/plugins/selectable/SelectablePluginTree.js +0 -7
- package/cjs/plugins/selectable/index.js +0 -9
- package/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -7
- package/cjs/plugins/toolbar/index.js +0 -9
- package/cjs/plugins/tree/TreeDataPlugin.js +0 -7
- package/cjs/plugins/tree/index.js +0 -9
- package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -7
- package/cjs/plugins/virtualization/index.js +0 -9
- package/cjs/react-desc-prop-types.js +0 -56
- package/cjs/related-components/TreeViewSearchBar.js +0 -48
- package/cjs/sharedTypes.js +0 -2
- package/cjs/utils/array-helpers.js +0 -24
- package/cjs/utils/group-expands-helpers.js +0 -111
- package/cjs/utils/keyboard-helpers.js +0 -175
- package/cjs/utils/object-helpers.js +0 -69
- package/cjs/utils/refs-helpers.js +0 -31
- package/cjs/utils/selectable-helper.js +0 -80
- package/cjs/utils/string-helpers.js +0 -7
- package/cjs/utils/tree-helpers.js +0 -220
- package/cjs/utils/useInstanceRefActions.js +0 -87
- package/cjs/utils/useTree.js +0 -108
- package/esm/TreeView.js +0 -21
- package/esm/config/cssClassesConstants.js +0 -6
- package/esm/config/useTreeview.js +0 -119
- package/esm/hoc/DnDTreeContext.js +0 -14
- package/esm/hoc/SortableItemContext.js +0 -17
- package/esm/hoc/WithConditionalDnDContext.js +0 -128
- package/esm/hoc/WithDnDSortableItemContext.js +0 -61
- package/esm/index.js +0 -9
- package/esm/parts/CheckboxSelectable.js +0 -78
- package/esm/parts/ChildrenCountDisplayer.js +0 -22
- package/esm/parts/DnDHandle.js +0 -38
- package/esm/parts/DropIndicator.js +0 -68
- package/esm/parts/ExpandCaret.js +0 -85
- package/esm/parts/Icon.js +0 -29
- package/esm/parts/NestingSpace.js +0 -39
- package/esm/parts/RadioSelectable.js +0 -53
- package/esm/parts/TreeItem.js +0 -173
- package/esm/parts/TreeItemText.js +0 -99
- package/esm/parts/TreeList.js +0 -127
- package/esm/plugins/dnd/TreeDndPlugin.js +0 -3
- package/esm/plugins/dnd/index.js +0 -1
- package/esm/plugins/index.js +0 -7
- package/esm/plugins/roving/TreeRovingPlugin.js +0 -3
- package/esm/plugins/roving/index.js +0 -1
- package/esm/plugins/searchable/SearchableTreePlugin.js +0 -3
- package/esm/plugins/searchable/index.js +0 -1
- package/esm/plugins/selectable/SelectablePluginTree.js +0 -3
- package/esm/plugins/selectable/index.js +0 -1
- package/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -3
- package/esm/plugins/toolbar/index.js +0 -1
- package/esm/plugins/tree/TreeDataPlugin.js +0 -3
- package/esm/plugins/tree/index.js +0 -1
- package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -3
- package/esm/plugins/virtualization/index.js +0 -1
- package/esm/react-desc-prop-types.js +0 -52
- package/esm/related-components/TreeViewSearchBar.js +0 -40
- package/esm/sharedTypes.js +0 -1
- package/esm/utils/group-expands-helpers.js +0 -99
- package/esm/utils/object-helpers.js +0 -64
- package/esm/utils/refs-helpers.js +0 -27
- package/esm/utils/selectable-helper.js +0 -70
- package/esm/utils/string-helpers.js +0 -3
- package/esm/utils/tree-helpers.js +0 -205
- package/esm/utils/useTree.js +0 -99
- package/types/TreeView.d.ts +0 -13
- package/types/TreeViewContext.d.ts +0 -17
- package/types/config/cssClassesConstants.d.ts +0 -4
- package/types/config/useTreeview.d.ts +0 -7
- package/types/hoc/DnDTreeContext.d.ts +0 -14
- package/types/hoc/SortableItemContext.d.ts +0 -19
- package/types/hoc/WithConditionalDnDContext.d.ts +0 -4
- package/types/hoc/WithDnDSortableItemContext.d.ts +0 -4
- package/types/index.d.ts +0 -3
- package/types/parts/CheckboxSelectable.d.ts +0 -8
- package/types/parts/ChildrenCountDisplayer.d.ts +0 -7
- package/types/parts/DnDHandle.d.ts +0 -6
- package/types/parts/DropIndicator.d.ts +0 -10
- package/types/parts/ExpandCaret.d.ts +0 -7
- package/types/parts/Icon.d.ts +0 -7
- package/types/parts/NestingSpace.d.ts +0 -8
- package/types/parts/RadioSelectable.d.ts +0 -8
- package/types/parts/TreeItem.d.ts +0 -17
- package/types/parts/TreeItemText.d.ts +0 -7
- package/types/parts/TreeList.d.ts +0 -20
- package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -1
- package/types/plugins/dnd/index.d.ts +0 -1
- package/types/plugins/index.d.ts +0 -7
- package/types/plugins/roving/TreeRovingPlugin.d.ts +0 -1
- package/types/plugins/roving/index.d.ts +0 -1
- package/types/plugins/searchable/SearchableTreePlugin.d.ts +0 -1
- package/types/plugins/searchable/index.d.ts +0 -1
- package/types/plugins/selectable/SelectablePluginTree.d.ts +0 -1
- package/types/plugins/selectable/index.d.ts +0 -1
- package/types/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -1
- package/types/plugins/toolbar/index.d.ts +0 -1
- package/types/plugins/tree/TreeDataPlugin.d.ts +0 -1
- package/types/plugins/tree/index.d.ts +0 -1
- package/types/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -1
- package/types/plugins/virtualization/index.d.ts +0 -1
- package/types/react-desc-prop-types.d.ts +0 -210
- package/types/related-components/TreeViewSearchBar.d.ts +0 -16
- package/types/sharedTypes.d.ts +0 -47
- package/types/utils/array-helpers.d.ts +0 -2
- package/types/utils/group-expands-helpers.d.ts +0 -14
- package/types/utils/keyboard-helpers.d.ts +0 -6
- package/types/utils/object-helpers.d.ts +0 -6
- package/types/utils/refs-helpers.d.ts +0 -4
- package/types/utils/selectable-helper.d.ts +0 -7
- package/types/utils/string-helpers.d.ts +0 -1
- package/types/utils/tree-helpers.d.ts +0 -28
- package/types/utils/useInstanceRefActions.d.ts +0 -3
- package/types/utils/useTree.d.ts +0 -14
package/esm/parts/TreeItem.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
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';
|
|
6
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import { useContext, useMemo, useCallback } from 'react';
|
|
9
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
10
|
-
import RadioSelectable from './RadioSelectable.js';
|
|
11
|
-
import CheckboxSelectable from './CheckboxSelectable.js';
|
|
12
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
13
|
-
import { setMultipleRefs } from '../utils/refs-helpers.js';
|
|
14
|
-
import { useOnItemKeyDown } from '../utils/keyboard-helpers.js';
|
|
15
|
-
import { NestingSpace } from './NestingSpace.js';
|
|
16
|
-
import { Icon } from './Icon.js';
|
|
17
|
-
import { ExpandCaret } from './ExpandCaret.js';
|
|
18
|
-
import { TreeItemText } from './TreeItemText.js';
|
|
19
|
-
import { treeItemBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
|
|
20
|
-
import { DnDHandle } from './DnDHandle.js';
|
|
21
|
-
import { withDnDSortableItemContext } from '../hoc/WithDnDSortableItemContext.js';
|
|
22
|
-
import { SortableItemContext, DropIndicatorPosition } from '../hoc/SortableItemContext.js';
|
|
23
|
-
import DropIndicator from './DropIndicator.js';
|
|
24
|
-
import { jsxs } from 'react/jsx-runtime';
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
const TreeListItem = aggregatedClasses('li', {
|
|
30
|
-
'data-testid': treeItemBlockName,
|
|
31
|
-
role: 'treeitem' // temp fix untill we move to styled components
|
|
32
|
-
|
|
33
|
-
})(treeItemBlockName);
|
|
34
|
-
const TreeListItemAddonsWrapper = aggregatedClasses('div')(treeItemBlockName, 'addons' // temp fix untill we move to styled components
|
|
35
|
-
);
|
|
36
|
-
const TreeItem = props => {
|
|
37
|
-
const {
|
|
38
|
-
item,
|
|
39
|
-
itemIndex,
|
|
40
|
-
itemWrapperStyle = {},
|
|
41
|
-
virtualItemRef,
|
|
42
|
-
spaceForNestingLevel = 1.5,
|
|
43
|
-
isDragOverlay = false
|
|
44
|
-
} = props;
|
|
45
|
-
const {
|
|
46
|
-
id,
|
|
47
|
-
node
|
|
48
|
-
} = item;
|
|
49
|
-
const {
|
|
50
|
-
nodeItemRef
|
|
51
|
-
} = node.model;
|
|
52
|
-
const {
|
|
53
|
-
draggableProps
|
|
54
|
-
} = useContext(SortableItemContext);
|
|
55
|
-
const onItemKeyDown = useOnItemKeyDown(item, draggableProps);
|
|
56
|
-
const ctx = useContext(TreeViewContext);
|
|
57
|
-
const {
|
|
58
|
-
props: {
|
|
59
|
-
disableIcons,
|
|
60
|
-
rightAddons,
|
|
61
|
-
onItemClick,
|
|
62
|
-
onItemFocus,
|
|
63
|
-
rowSize,
|
|
64
|
-
labelOverflow
|
|
65
|
-
},
|
|
66
|
-
withRadioChecks,
|
|
67
|
-
withCheckboxChecks,
|
|
68
|
-
withDragAndDrop,
|
|
69
|
-
selectedItem,
|
|
70
|
-
selectedCheckboxes,
|
|
71
|
-
hoverItem,
|
|
72
|
-
virtualListHelpers: {
|
|
73
|
-
scrollToIndex
|
|
74
|
-
},
|
|
75
|
-
setHoverItem,
|
|
76
|
-
setSelectedItem,
|
|
77
|
-
setFocusedItem
|
|
78
|
-
} = ctx; // Sortable Items needs to update
|
|
79
|
-
// - the virtual list ref (for react-virtual requirement)
|
|
80
|
-
// - nodeItemRef which is a prop avaiable in the TreeModel nodes
|
|
81
|
-
// - the drag and drop node reference
|
|
82
|
-
|
|
83
|
-
const setItemRefs = ref => {
|
|
84
|
-
setMultipleRefs(virtualItemRef, !isDragOverlay && nodeItemRef, !isDragOverlay && draggableProps && draggableProps.setNodeRef)(ref);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
|
|
88
|
-
const isDropIndicatorPositionInside = dropIndicatorPosition === DropIndicatorPosition.Inside;
|
|
89
|
-
const isDragging = draggableProps && draggableProps.isDragging;
|
|
90
|
-
const isDropValid = draggableProps && draggableProps.isDropValid;
|
|
91
|
-
const dropPreviewClassName = useMemo(() => {
|
|
92
|
-
if (isDropIndicatorPositionInside) {
|
|
93
|
-
const className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName).concat(isDropValid ? '--valid' : '--invalid', "-drop-in");
|
|
94
|
-
return className;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return '';
|
|
98
|
-
}, [isDropIndicatorPositionInside, isDropValid]);
|
|
99
|
-
const dragOverlayClassName = useMemo(() => isDragOverlay ? 'drag-overlay' : '', [isDragOverlay]);
|
|
100
|
-
const selectedClassName = useMemo(() => (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) === item.id && !isDragOverlay ? 'selected' : '', [isDragOverlay, item.id, selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id]);
|
|
101
|
-
const hoverClassName = useMemo(() => !isDragOverlay && ((hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) === item.id || isDragging) ? 'hover' : '', [isDragOverlay, hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id, item.id, isDragging]);
|
|
102
|
-
const fixedHeightClassname = useMemo(() => {
|
|
103
|
-
if (labelOverflow === 'truncate') {
|
|
104
|
-
if (rowSize === 'compact') return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height-compact");
|
|
105
|
-
return "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "--fixed-height");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return '';
|
|
109
|
-
}, [labelOverflow, rowSize]);
|
|
110
|
-
const finalClassName = useMemo(() => "".concat(dropPreviewClassName, " ").concat(fixedHeightClassname, " ").concat(selectedClassName, " ").concat(hoverClassName, " ").concat(dragOverlayClassName), [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName]);
|
|
111
|
-
const handleItemClick = useCallback(e => {
|
|
112
|
-
onItemClick(item, e);
|
|
113
|
-
setFocusedItem(item);
|
|
114
|
-
setSelectedItem(item);
|
|
115
|
-
const itemVirtualIndex = typeof item.virtualIndex === 'number' ? item.virtualIndex : -1;
|
|
116
|
-
onItemFocus({
|
|
117
|
-
itemIndex: itemVirtualIndex,
|
|
118
|
-
scrollToItem: function () {
|
|
119
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
120
|
-
align: 'start'
|
|
121
|
-
};
|
|
122
|
-
return scrollToIndex(itemVirtualIndex, opts);
|
|
123
|
-
},
|
|
124
|
-
item
|
|
125
|
-
});
|
|
126
|
-
}, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
|
|
127
|
-
return /*#__PURE__*/jsxs(TreeListItem, {
|
|
128
|
-
tabIndex: 0,
|
|
129
|
-
onMouseLeave: () => {
|
|
130
|
-
if ((hoverItem === null || hoverItem === void 0 ? void 0 : hoverItem.id) === item.id) {
|
|
131
|
-
setHoverItem(null);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
onMouseEnter: () => {
|
|
135
|
-
setHoverItem(item);
|
|
136
|
-
},
|
|
137
|
-
onClick: handleItemClick,
|
|
138
|
-
onBlur: () => setFocusedItem(null),
|
|
139
|
-
ref: setItemRefs,
|
|
140
|
-
style: _objectSpread({}, itemWrapperStyle),
|
|
141
|
-
className: finalClassName,
|
|
142
|
-
"aria-expanded": !!item.isExpanded,
|
|
143
|
-
"aria-selected": !!selectedCheckboxes[item.id],
|
|
144
|
-
"data-id": item.id,
|
|
145
|
-
"data-index": item.virtualIndex,
|
|
146
|
-
onKeyDown: onItemKeyDown,
|
|
147
|
-
children: [/*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, withDragAndDrop ? /*#__PURE__*/_jsx(DnDHandle, {
|
|
148
|
-
id: id,
|
|
149
|
-
isDragOverlay: isDragOverlay
|
|
150
|
-
}) : null, withRadioChecks && !isDragOverlay ? /*#__PURE__*/_jsx(RadioSelectable, {
|
|
151
|
-
item: item,
|
|
152
|
-
itemIndex: itemIndex
|
|
153
|
-
}) : null, withCheckboxChecks && !isDragOverlay ? /*#__PURE__*/_jsx(CheckboxSelectable, {
|
|
154
|
-
item: item,
|
|
155
|
-
itemIndex: itemIndex
|
|
156
|
-
}) : null, !isDragOverlay && /*#__PURE__*/_jsx(NestingSpace, {
|
|
157
|
-
item: item,
|
|
158
|
-
spaceForNestingLevel: spaceForNestingLevel
|
|
159
|
-
}), !isDragOverlay && /*#__PURE__*/_jsx(ExpandCaret, {
|
|
160
|
-
item: item
|
|
161
|
-
}), !disableIcons ? /*#__PURE__*/_jsx(Icon, {
|
|
162
|
-
item: item
|
|
163
|
-
}) : null), /*#__PURE__*/_jsx(TreeItemText, {
|
|
164
|
-
item: item
|
|
165
|
-
}), rightAddons && /*#__PURE__*/_jsx(TreeListItemAddonsWrapper, {}, void 0, typeof rightAddons === 'function' ? rightAddons(item) : rightAddons), /*#__PURE__*/_jsx(DropIndicator, {
|
|
166
|
-
dropIndicatorPosition: dropIndicatorPosition,
|
|
167
|
-
isDropValid: isDropValid
|
|
168
|
-
})]
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
var TreeItem$1 = withDnDSortableItemContext(TreeItem);
|
|
172
|
-
|
|
173
|
-
export { TreeItem, TreeListItem, TreeListItemAddonsWrapper, TreeItem$1 as default };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import { useContext, useMemo } from 'react';
|
|
3
|
-
import Highlighter from 'react-highlight-words';
|
|
4
|
-
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
5
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
6
|
-
import { ChildrenCountDisplayer } from './ChildrenCountDisplayer.js';
|
|
7
|
-
import { treeItemBlockName, DSTreeViewPrefix } from '../config/cssClassesConstants.js';
|
|
8
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
9
|
-
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
const ItemContent = aggregatedClasses('div')("".concat(treeItemBlockName, "-content"));
|
|
12
|
-
const ItemValue = aggregatedClasses('span')(treeItemBlockName, 'value'); // const wrapperClassName = `${DSTreeViewPrefix}-${treeItemBlockName}-content`;
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
};
|
|
26
|
-
|
|
27
|
-
function TreeItemText(props) {
|
|
28
|
-
var _ChildrenCountDisplay, _ChildrenCountDisplay2, _ChildrenCountDisplay3, _ChildrenCountDisplay4;
|
|
29
|
-
|
|
30
|
-
const {
|
|
31
|
-
item
|
|
32
|
-
} = props;
|
|
33
|
-
const ctx = useContext(TreeViewContext);
|
|
34
|
-
const {
|
|
35
|
-
props: {
|
|
36
|
-
searchQuery,
|
|
37
|
-
showChildrenAmount,
|
|
38
|
-
labelOverflow,
|
|
39
|
-
nameKey
|
|
40
|
-
}
|
|
41
|
-
} = ctx;
|
|
42
|
-
const Text = useMemo(() => {
|
|
43
|
-
const itemLabelText = item[nameKey];
|
|
44
|
-
|
|
45
|
-
if (searchQuery) {
|
|
46
|
-
if (labelOverflow === 'truncate') {
|
|
47
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
48
|
-
value: /*#__PURE__*/jsxs(Fragment, {
|
|
49
|
-
children: [/*#__PURE__*/_jsx(Highlighter, {
|
|
50
|
-
autoEscape: true,
|
|
51
|
-
highlightTag: CustomHighlight,
|
|
52
|
-
searchWords: [searchQuery],
|
|
53
|
-
textToHighlight: itemLabelText
|
|
54
|
-
}), showChildrenAmount ? _ChildrenCountDisplay || (_ChildrenCountDisplay = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
|
|
55
|
-
item: item
|
|
56
|
-
})) : null]
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
62
|
-
children: [/*#__PURE__*/_jsx(Highlighter, {
|
|
63
|
-
autoEscape: true,
|
|
64
|
-
highlightTag: CustomHighlight,
|
|
65
|
-
searchWords: [searchQuery],
|
|
66
|
-
textToHighlight: itemLabelText
|
|
67
|
-
}), showChildrenAmount ? _ChildrenCountDisplay2 || (_ChildrenCountDisplay2 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
|
|
68
|
-
item: item
|
|
69
|
-
})) : null]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (labelOverflow === 'truncate') {
|
|
74
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
75
|
-
value: /*#__PURE__*/jsxs(Fragment, {
|
|
76
|
-
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay3 || (_ChildrenCountDisplay3 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
|
|
77
|
-
item: item
|
|
78
|
-
})) : null]
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
84
|
-
children: [itemLabelText, showChildrenAmount ? _ChildrenCountDisplay4 || (_ChildrenCountDisplay4 = /*#__PURE__*/_jsx(ChildrenCountDisplayer, {
|
|
85
|
-
item: item
|
|
86
|
-
})) : null]
|
|
87
|
-
});
|
|
88
|
-
}, [item, searchQuery, nameKey, showChildrenAmount, labelOverflow]);
|
|
89
|
-
let className = '';
|
|
90
|
-
if (labelOverflow === 'wrap-all') className += "".concat(classNameModifierWrapAll, " ");
|
|
91
|
-
if (labelOverflow === 'truncate') className += "".concat(classNameModifierTruncate, " ");
|
|
92
|
-
return /*#__PURE__*/_jsx(ItemContent, {
|
|
93
|
-
"data-testid": "".concat(treeItemBlockName, "-content")
|
|
94
|
-
}, void 0, /*#__PURE__*/_jsx(ItemValue, {
|
|
95
|
-
className: className
|
|
96
|
-
}, void 0, Text));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { TreeItemText };
|
package/esm/parts/TreeList.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
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 = () => {
|
|
44
|
-
const ctx = useContext(TreeViewContext);
|
|
45
|
-
const {
|
|
46
|
-
virtualListRef,
|
|
47
|
-
virtualListHelpers,
|
|
48
|
-
visibleItems: flattenedVisibleItems,
|
|
49
|
-
props: {
|
|
50
|
-
width,
|
|
51
|
-
height,
|
|
52
|
-
rowSize,
|
|
53
|
-
noItemsPlaceholder,
|
|
54
|
-
isLoading
|
|
55
|
-
}
|
|
56
|
-
} = ctx;
|
|
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, {
|
|
66
|
-
ref: virtualListRef,
|
|
67
|
-
className: className,
|
|
68
|
-
style: {
|
|
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
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const TreeList = withConditionalDnDRowContext(TreeListComp);
|
|
126
|
-
|
|
127
|
-
export { TreeList, TreeListNoItems, TreeListWrapper, treeListNoItemsBn };
|
package/esm/plugins/dnd/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TreeDndPlugin } from './TreeDndPlugin.js';
|
package/esm/plugins/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export { TreeRovingPlugin } from './TreeRovingPlugin.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SearchableTreePlugin } from './SearchableTreePlugin.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SelectablePluginTree } from './SelectablePluginTree.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TreeToolbarPlugin } from './TreeToolbarPlugin.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TreePluginList } from './TreeDataPlugin.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TreeVirtualizationPlugin } from './TreeVirtualizationPlugin.js';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-lines */
|
|
4
|
-
const TreeViewPropTypes = {
|
|
5
|
-
data: PropTypes.arrayOf(PropTypes.shape({
|
|
6
|
-
children: PropTypes.arrayOf(PropTypes.object),
|
|
7
|
-
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
8
|
-
isGroup: PropTypes.oneOfType([PropTypes.oneOf([undefined, null]), PropTypes.bool]),
|
|
9
|
-
name: PropTypes.string,
|
|
10
|
-
node: PropTypes.object
|
|
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),
|
|
15
|
-
instanceRef: PropTypes.shape({
|
|
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)
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export { TreeViewPropTypes };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { DSNavSearchBox } from '@elliemae/ds-form';
|
|
4
|
-
|
|
5
|
-
function TreeViewSearchBar(props) {
|
|
6
|
-
const {
|
|
7
|
-
handleChange,
|
|
8
|
-
onNext,
|
|
9
|
-
onPrevious,
|
|
10
|
-
onClear,
|
|
11
|
-
currentResultIndex,
|
|
12
|
-
totalResults,
|
|
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
|
|
29
|
-
});
|
|
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 };
|
package/esm/sharedTypes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-params */
|
|
4
|
-
const updateExpandedState = (treeRoot, onExpandChange) => {
|
|
5
|
-
const shouldContinueWalking = true;
|
|
6
|
-
const newExpandedHashMap = {
|
|
7
|
-
__ds_tree_root: true
|
|
8
|
-
};
|
|
9
|
-
treeRoot.walk(node => {
|
|
10
|
-
if (!node.isRoot() && node.model.isGroup && node.model.isExpanded) {
|
|
11
|
-
newExpandedHashMap[node.model.id] = true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return shouldContinueWalking;
|
|
15
|
-
});
|
|
16
|
-
if (onExpandChange) onExpandChange(newExpandedHashMap, null);
|
|
17
|
-
};
|
|
18
|
-
const toggleItemExpand = function (itemToToggle, triggerTreeRerender, updateUserExpandedState) {
|
|
19
|
-
let scrollTo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : () => {};
|
|
20
|
-
const {
|
|
21
|
-
node: {
|
|
22
|
-
model: {
|
|
23
|
-
isExpanded
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
virtualIndex
|
|
27
|
-
} = itemToToggle;
|
|
28
|
-
|
|
29
|
-
if (itemToToggle.node.model.isGroup) {
|
|
30
|
-
itemToToggle.node.model.isExpanded = !isExpanded;
|
|
31
|
-
triggerTreeRerender();
|
|
32
|
-
updateUserExpandedState();
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
if (typeof virtualIndex === 'number') scrollTo(virtualIndex, {
|
|
35
|
-
align: 'start'
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const expandItemModel = modelToExpand => {
|
|
41
|
-
if (modelToExpand.isGroup) modelToExpand.isExpanded = true;
|
|
42
|
-
};
|
|
43
|
-
const collapseItemModel = modelToCollapse => {
|
|
44
|
-
if (modelToCollapse.isGroup) modelToCollapse.isExpanded = false;
|
|
45
|
-
};
|
|
46
|
-
const expandAll = (treeRoot, triggerTreeRerender) => {
|
|
47
|
-
const shouldContinueWalking = true;
|
|
48
|
-
treeRoot.walk(node => {
|
|
49
|
-
if (!node.isRoot()) expandItemModel(node.model);
|
|
50
|
-
return shouldContinueWalking;
|
|
51
|
-
});
|
|
52
|
-
triggerTreeRerender();
|
|
53
|
-
};
|
|
54
|
-
const collapseAll = (treeRoot, triggerTreeRerender) => {
|
|
55
|
-
const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking
|
|
56
|
-
|
|
57
|
-
treeRoot.walk(node => {
|
|
58
|
-
if (!node.isRoot()) collapseItemModel(node.model);
|
|
59
|
-
return shouldContinueWalking;
|
|
60
|
-
});
|
|
61
|
-
triggerTreeRerender();
|
|
62
|
-
};
|
|
63
|
-
const getToggleExpandShouldExpand = treeRoot => {
|
|
64
|
-
let shouldExpand = false;
|
|
65
|
-
const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking
|
|
66
|
-
|
|
67
|
-
treeRoot.walk(node => {
|
|
68
|
-
if (!node.isRoot()) {
|
|
69
|
-
if (!node.model.isExpanded && node.model.isGroup) {
|
|
70
|
-
shouldExpand = true; // eslint-disable-next-line no-useless-return
|
|
71
|
-
|
|
72
|
-
return shouldContinueWalking;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return shouldContinueWalking;
|
|
77
|
-
});
|
|
78
|
-
return shouldExpand;
|
|
79
|
-
};
|
|
80
|
-
const toggleExpandAllHelper = (isExpand, treeRoot, triggerTreeRerender, setLatestToggledItem, updateUserExpandedState) => {
|
|
81
|
-
if (isExpand === true) expandAll(treeRoot, triggerTreeRerender);else if (isExpand === false) collapseAll(treeRoot, triggerTreeRerender);else {
|
|
82
|
-
const shouldExpand = getToggleExpandShouldExpand(treeRoot);
|
|
83
|
-
if (shouldExpand === true) expandAll(treeRoot, triggerTreeRerender);else collapseAll(treeRoot, triggerTreeRerender);
|
|
84
|
-
}
|
|
85
|
-
setLatestToggledItem(null);
|
|
86
|
-
updateUserExpandedState();
|
|
87
|
-
};
|
|
88
|
-
const useNotifyExpandedChange = (propsWithDefaults, _ref) => {
|
|
89
|
-
let {
|
|
90
|
-
latestToggledItem,
|
|
91
|
-
expandedGroups
|
|
92
|
-
} = _ref;
|
|
93
|
-
const notifyExpandedChange = useCallback(expandedGroupHashmap => propsWithDefaults === null || propsWithDefaults === void 0 ? void 0 : propsWithDefaults.onExpandChange(expandedGroupHashmap || {}, latestToggledItem), [propsWithDefaults, latestToggledItem]);
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (!propsWithDefaults.expanded) notifyExpandedChange(expandedGroups);
|
|
96
|
-
}, [expandedGroups, notifyExpandedChange, propsWithDefaults.expanded]);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export { collapseAll, collapseItemModel, expandAll, expandItemModel, getToggleExpandShouldExpand, toggleExpandAllHelper, toggleItemExpand, updateExpandedState, useNotifyExpandedChange };
|