@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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
let DropIndicatorPosition;
|
|
4
|
-
|
|
5
|
-
(function (DropIndicatorPosition) {
|
|
6
|
-
DropIndicatorPosition[DropIndicatorPosition["None"] = 0] = "None";
|
|
7
|
-
DropIndicatorPosition[DropIndicatorPosition["Before"] = 1] = "Before";
|
|
8
|
-
DropIndicatorPosition[DropIndicatorPosition["After"] = 2] = "After";
|
|
9
|
-
DropIndicatorPosition[DropIndicatorPosition["Inside"] = 3] = "Inside";
|
|
10
|
-
})(DropIndicatorPosition || (DropIndicatorPosition = {}));
|
|
11
|
-
|
|
12
|
-
/** Context for cross component communication */
|
|
13
|
-
const SortableItemContext = /*#__PURE__*/createContext({
|
|
14
|
-
draggableProps: false
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export { DropIndicatorPosition, SortableItemContext };
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
4
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
5
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
6
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
8
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
10
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
11
|
-
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
12
|
-
import 'core-js/modules/esnext.iterator.find.js';
|
|
13
|
-
import React, { useContext, useMemo, useCallback } from 'react';
|
|
14
|
-
import { DndContext, DragOverlay } from '@dnd-kit/core';
|
|
15
|
-
import { SortableContext } from '@dnd-kit/sortable';
|
|
16
|
-
import { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';
|
|
17
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
18
|
-
import { TreeItem } from '../parts/TreeItem.js';
|
|
19
|
-
import { DnDTreeContext } from './DnDTreeContext.js';
|
|
20
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
const ensure = function (argument) {
|
|
27
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'This should never happen';
|
|
28
|
-
|
|
29
|
-
if (argument === undefined || argument === null) {
|
|
30
|
-
throw new TypeError(message);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return argument;
|
|
34
|
-
}; // only wraps in "DnDContext" and "DnDTreeContext" if any Drag and Drop functionality is requested
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const withConditionalDnDRowContext = Component => props => {
|
|
38
|
-
const [lastActiveId, setLastActiveId] = React.useState('');
|
|
39
|
-
const {
|
|
40
|
-
props: {
|
|
41
|
-
data,
|
|
42
|
-
onOrderChange,
|
|
43
|
-
getIsDropValid
|
|
44
|
-
},
|
|
45
|
-
flattenedItems,
|
|
46
|
-
visibleItems: flattenedVisibleTree,
|
|
47
|
-
withDragAndDrop
|
|
48
|
-
} = useContext(TreeViewContext);
|
|
49
|
-
const flattenedVisibleTreeForDnD = useMemo(() => flattenedVisibleTree.map((item, index) => {
|
|
50
|
-
var _item$treeDepth, _item$children$length, _item$children, _item$node$parent$mod, _item$node$parent, _item$node$parent$mod2, _item$node$parent$mod3;
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
uid: item.id.toString(),
|
|
54
|
-
depth: ((_item$treeDepth = item.treeDepth) !== null && _item$treeDepth !== void 0 ? _item$treeDepth : 1) - 1,
|
|
55
|
-
realIndex: index,
|
|
56
|
-
childrenCount: (_item$children$length = (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) !== null && _item$children$length !== void 0 ? _item$children$length : 0,
|
|
57
|
-
parentId: (_item$node$parent$mod = (_item$node$parent = item.node.parent) === null || _item$node$parent === void 0 ? void 0 : (_item$node$parent$mod2 = _item$node$parent.model) === null || _item$node$parent$mod2 === void 0 ? void 0 : (_item$node$parent$mod3 = _item$node$parent$mod2.id) === null || _item$node$parent$mod3 === void 0 ? void 0 : _item$node$parent$mod3.toString()) !== null && _item$node$parent$mod !== void 0 ? _item$node$parent$mod : null,
|
|
58
|
-
original: item
|
|
59
|
-
};
|
|
60
|
-
}), [flattenedVisibleTree]);
|
|
61
|
-
const onReorder = useCallback((tree, indexes) => {
|
|
62
|
-
// Pull the row's original data into an object
|
|
63
|
-
const nodes = {};
|
|
64
|
-
tree.forEach(item => {
|
|
65
|
-
const originalItem = item.original;
|
|
66
|
-
originalItem.children = [];
|
|
67
|
-
nodes[item.uid] = item.original;
|
|
68
|
-
});
|
|
69
|
-
const newUserTree = [];
|
|
70
|
-
tree.forEach(item => {
|
|
71
|
-
// If row has parent, insert it to it's subrows
|
|
72
|
-
// otherwise append it to the new user data
|
|
73
|
-
if (item.parentId !== null && item.parentId !== undefined && item.parentId !== '__ds_tree_root') {
|
|
74
|
-
var _parentNode$children;
|
|
75
|
-
|
|
76
|
-
const parentNode = nodes[item.parentId];
|
|
77
|
-
(_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.push(item.original);
|
|
78
|
-
} else if (item.uid !== '__ds_tree_root') newUserTree.push(item.original);
|
|
79
|
-
}); // Tell the user that the order has change, he can chose to commit it or not
|
|
80
|
-
|
|
81
|
-
onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);
|
|
82
|
-
}, [onOrderChange, data, flattenedItems]);
|
|
83
|
-
const {
|
|
84
|
-
dndContextProps,
|
|
85
|
-
sortableContextProps,
|
|
86
|
-
activeId,
|
|
87
|
-
activeIndex,
|
|
88
|
-
depth,
|
|
89
|
-
dropIndicatorPosition,
|
|
90
|
-
visibleItems,
|
|
91
|
-
isDropValid
|
|
92
|
-
} = useTreeDndkitConfig({
|
|
93
|
-
flattenedItems,
|
|
94
|
-
visibleItems: flattenedVisibleTreeForDnD,
|
|
95
|
-
isHorizontalDnD: false,
|
|
96
|
-
isExpandable: true,
|
|
97
|
-
onReorder,
|
|
98
|
-
getIsDropValid,
|
|
99
|
-
maxDragAndDropLevel: Infinity
|
|
100
|
-
});
|
|
101
|
-
if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);
|
|
102
|
-
if (withDragAndDrop) return /*#__PURE__*/jsxs(DndContext, _objectSpread(_objectSpread({}, dndContextProps), {}, {
|
|
103
|
-
children: [/*#__PURE__*/jsx(SortableContext, _objectSpread(_objectSpread({}, sortableContextProps), {}, {
|
|
104
|
-
children: /*#__PURE__*/_jsx(DnDTreeContext.Provider, {
|
|
105
|
-
value: {
|
|
106
|
-
activeIndex,
|
|
107
|
-
depth,
|
|
108
|
-
visibleItems: visibleItems.map(item => item.original),
|
|
109
|
-
dropIndicatorPosition,
|
|
110
|
-
lastActiveId,
|
|
111
|
-
setLastActiveId,
|
|
112
|
-
isDropValid
|
|
113
|
-
}
|
|
114
|
-
}, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)))
|
|
115
|
-
})), /*#__PURE__*/_jsx(DragOverlay, {
|
|
116
|
-
style: {
|
|
117
|
-
width: 'auto'
|
|
118
|
-
}
|
|
119
|
-
}, void 0, activeId ? /*#__PURE__*/_jsx(TreeItem, {
|
|
120
|
-
itemIndex: activeIndex,
|
|
121
|
-
item: ensure(flattenedVisibleTree.find(item => item.id.toString() === activeId)),
|
|
122
|
-
isDragOverlay: true
|
|
123
|
-
}) : null)]
|
|
124
|
-
}));
|
|
125
|
-
return /*#__PURE__*/jsx(Component, _objectSpread({}, props));
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export { withConditionalDnDRowContext };
|
|
@@ -1,61 +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 } from 'react';
|
|
9
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
10
|
-
import { SortableItemContext } from './SortableItemContext.js';
|
|
11
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
12
|
-
import { DnDTreeContext } from './DnDTreeContext.js';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
const withDnDSortableItemContext = Component => props => {
|
|
19
|
-
const {
|
|
20
|
-
withDragAndDrop
|
|
21
|
-
} = useContext(TreeViewContext);
|
|
22
|
-
const {
|
|
23
|
-
dropIndicatorPosition,
|
|
24
|
-
lastActiveId,
|
|
25
|
-
setLastActiveId,
|
|
26
|
-
isDropValid
|
|
27
|
-
} = useContext(DnDTreeContext);
|
|
28
|
-
const id = props.item.id.toString(); // onMount generate unique options, so everyting is only ran once
|
|
29
|
-
|
|
30
|
-
const draggableOptions = useMemo(() => ({
|
|
31
|
-
id
|
|
32
|
-
}), [id]);
|
|
33
|
-
const useSortableHelpers = useSortable(draggableOptions); // calculate all the "useSortable" values as per required
|
|
34
|
-
|
|
35
|
-
const draggableProps = useMemo(() => {
|
|
36
|
-
if (!withDragAndDrop) return false;
|
|
37
|
-
const {
|
|
38
|
-
index,
|
|
39
|
-
overIndex
|
|
40
|
-
} = useSortableHelpers;
|
|
41
|
-
return _objectSpread(_objectSpread({}, useSortableHelpers), {}, {
|
|
42
|
-
shouldShowDropIndicatorPosition: overIndex === index,
|
|
43
|
-
dropIndicatorPosition,
|
|
44
|
-
lastActiveId,
|
|
45
|
-
setLastActiveId,
|
|
46
|
-
isDropValid
|
|
47
|
-
});
|
|
48
|
-
}, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]); // we use a context so we can easly access information wherever without bubbling down
|
|
49
|
-
// this context is all Memoized so as long as component is not re-mounted,
|
|
50
|
-
// the context won't trigger un-required renders per-se...
|
|
51
|
-
|
|
52
|
-
const ctx = useMemo(() => ({
|
|
53
|
-
draggableProps
|
|
54
|
-
}), [draggableProps]); // we always add the context, if draggableProps===false we don't have the DnD enabled.
|
|
55
|
-
|
|
56
|
-
return /*#__PURE__*/_jsx(SortableItemContext.Provider, {
|
|
57
|
-
value: ctx
|
|
58
|
-
}, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { withDnDSortableItemContext };
|
package/esm/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { TreeView, TreeViewWithSchema } from './TreeView.js';
|
|
2
|
-
export { TreeDndPlugin } from './plugins/dnd/TreeDndPlugin.js';
|
|
3
|
-
export { TreeRovingPlugin } from './plugins/roving/TreeRovingPlugin.js';
|
|
4
|
-
export { SelectablePluginTree } from './plugins/selectable/SelectablePluginTree.js';
|
|
5
|
-
export { TreeToolbarPlugin } from './plugins/toolbar/TreeToolbarPlugin.js';
|
|
6
|
-
export { TreePluginList } from './plugins/tree/TreeDataPlugin.js';
|
|
7
|
-
export { TreeVirtualizationPlugin } from './plugins/virtualization/TreeVirtualizationPlugin.js';
|
|
8
|
-
export { SearchableTreePlugin } from './plugins/searchable/SearchableTreePlugin.js';
|
|
9
|
-
export { TreeViewSearchBar } from './related-components/TreeViewSearchBar.js';
|
|
@@ -1,78 +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, useCallback, useMemo } from 'react';
|
|
9
|
-
import { DSCheckbox } from '@elliemae/ds-form';
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
12
|
-
import { toggleCheckboxItem } from '../utils/selectable-helper.js';
|
|
13
|
-
import { filterObject } from '../utils/object-helpers.js';
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
const StyledCheckboxWrapper = /*#__PURE__*/styled.span.withConfig({
|
|
19
|
-
componentId: "sc-1tyhs3t-0"
|
|
20
|
-
})(["padding-top:3px;"]);
|
|
21
|
-
|
|
22
|
-
function CheckboxSelectable(props) {
|
|
23
|
-
const {
|
|
24
|
-
item,
|
|
25
|
-
itemIndex
|
|
26
|
-
} = props;
|
|
27
|
-
const {
|
|
28
|
-
id
|
|
29
|
-
} = item;
|
|
30
|
-
const ctx = useContext(TreeViewContext);
|
|
31
|
-
const {
|
|
32
|
-
props: {
|
|
33
|
-
onSelectionChange,
|
|
34
|
-
isItemDisabled
|
|
35
|
-
},
|
|
36
|
-
virtualListHelpers: {
|
|
37
|
-
scrollToIndex
|
|
38
|
-
},
|
|
39
|
-
triggerTreeRerender,
|
|
40
|
-
selectedCheckboxes,
|
|
41
|
-
setSelectedCheckboxes
|
|
42
|
-
} = ctx;
|
|
43
|
-
const onCheckboxChange = useCallback(() => {
|
|
44
|
-
const newSelections = toggleCheckboxItem(item);
|
|
45
|
-
const newSelectionHasmap = filterObject(_objectSpread(_objectSpread({}, selectedCheckboxes), newSelections), value => value !== false);
|
|
46
|
-
setSelectedCheckboxes(newSelectionHasmap);
|
|
47
|
-
triggerTreeRerender();
|
|
48
|
-
const indexAndScrollTo = {
|
|
49
|
-
scrollToItem: () => {
|
|
50
|
-
if (typeof item.virtualIndex === 'number') scrollToIndex(item.virtualIndex);
|
|
51
|
-
},
|
|
52
|
-
itemIndex
|
|
53
|
-
};
|
|
54
|
-
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
55
|
-
}, [item, triggerTreeRerender, onSelectionChange, itemIndex, scrollToIndex, selectedCheckboxes, setSelectedCheckboxes]);
|
|
56
|
-
const isChecked = useMemo(() => {
|
|
57
|
-
if (selectedCheckboxes[id] === 'mixed') {
|
|
58
|
-
return 'mixed';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (selectedCheckboxes[id] === true) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return false;
|
|
66
|
-
}, [selectedCheckboxes, id]);
|
|
67
|
-
const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
68
|
-
return /*#__PURE__*/_jsx(StyledCheckboxWrapper, {}, void 0, /*#__PURE__*/_jsx(DSCheckbox, {
|
|
69
|
-
checked: isChecked,
|
|
70
|
-
disabled: isDisabled,
|
|
71
|
-
className: "em-ds-tree-item-checkbox",
|
|
72
|
-
"data-testid": "tree-item-checkbox",
|
|
73
|
-
onChange: onCheckboxChange,
|
|
74
|
-
tabIndex: "0"
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export { CheckboxSelectable as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants.js';
|
|
4
|
-
|
|
5
|
-
const className = "".concat(DSTreeViewPrefix, "-").concat(treeItemBlockName, "-children-count-displayer");
|
|
6
|
-
const ChildrenCountDisplayer = props => {
|
|
7
|
-
const {
|
|
8
|
-
item
|
|
9
|
-
} = props;
|
|
10
|
-
const {
|
|
11
|
-
isGroup,
|
|
12
|
-
children
|
|
13
|
-
} = item;
|
|
14
|
-
if (!isGroup) return null; // return ` | ${children.length} Items`;
|
|
15
|
-
|
|
16
|
-
return /*#__PURE__*/_jsx("span", {
|
|
17
|
-
"data-testid": "tree-item-children-count-displayer",
|
|
18
|
-
className: className
|
|
19
|
-
}, void 0, " | ".concat(children.length, " Items"));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { ChildrenCountDisplayer };
|
package/esm/parts/DnDHandle.js
DELETED
|
@@ -1,38 +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 _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import { useContext, createElement } from 'react';
|
|
8
|
-
import { GripperVertical } from '@elliemae/ds-icons';
|
|
9
|
-
import { SortableItemContext } from '../hoc/SortableItemContext.js';
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
const DnDHandle = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
id,
|
|
17
|
-
isDragOverlay
|
|
18
|
-
} = _ref;
|
|
19
|
-
const {
|
|
20
|
-
draggableProps
|
|
21
|
-
} = useContext(SortableItemContext);
|
|
22
|
-
const isDragging = draggableProps && draggableProps.isDragging;
|
|
23
|
-
return /*#__PURE__*/createElement(GripperVertical, _objectSpread(_objectSpread({
|
|
24
|
-
role: "button"
|
|
25
|
-
}, draggableProps && _objectSpread(_objectSpread({}, draggableProps.listeners), draggableProps.attributes)), {}, {
|
|
26
|
-
"data-testid": "drag-handle",
|
|
27
|
-
"data-isactive": draggableProps && !!draggableProps.active,
|
|
28
|
-
"data-isdragoverlay": isDragOverlay,
|
|
29
|
-
id: "".concat(id, "-drag-handle"),
|
|
30
|
-
key: "".concat(id, "-drag-handle"),
|
|
31
|
-
className: "drag-handle ".concat(isDragging ? '' : 'focuseable'),
|
|
32
|
-
color: ['brand-primary', '800'],
|
|
33
|
-
size: "s",
|
|
34
|
-
tabIndex: 0
|
|
35
|
-
}));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { DnDHandle };
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { DropIndicatorPosition } from '../hoc/SortableItemContext.js';
|
|
5
|
-
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
const getPositionStyles = _ref => {
|
|
8
|
-
let {
|
|
9
|
-
dropIndicatorPosition
|
|
10
|
-
} = _ref;
|
|
11
|
-
return "\n top: ".concat(dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset', ";\n bottom: ").concat(dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset', ";\n left: -2px;\n ");
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const getCircleStyles = _ref2 => {
|
|
15
|
-
let {
|
|
16
|
-
dropIndicatorPosition
|
|
17
|
-
} = _ref2;
|
|
18
|
-
return {
|
|
19
|
-
position: 'absolute',
|
|
20
|
-
zIndex: 20,
|
|
21
|
-
top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',
|
|
22
|
-
bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',
|
|
23
|
-
left: '0px',
|
|
24
|
-
opacity: 1
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const StyledIndicator = /*#__PURE__*/styled.div.withConfig({
|
|
29
|
-
componentId: "sc-1812zh0-0"
|
|
30
|
-
})(["position:absolute;", " box-sizing:border-box;width:", ";height:", ";background-color:", ";z-index:20;"], getPositionStyles, props => props.vertical ? '2px' : '100%', props => props.vertical ? '100%' : '2px', _ref3 => {
|
|
31
|
-
let {
|
|
32
|
-
isDropValid,
|
|
33
|
-
theme
|
|
34
|
-
} = _ref3;
|
|
35
|
-
return isDropValid ? theme.colors.brand[600] : theme.colors.danger[900];
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const CircleIndicator = (style, isDropValid) => /*#__PURE__*/_jsx("svg", {
|
|
39
|
-
height: "6",
|
|
40
|
-
width: "6",
|
|
41
|
-
style: style
|
|
42
|
-
}, void 0, /*#__PURE__*/_jsx("circle", {
|
|
43
|
-
cx: "3",
|
|
44
|
-
cy: "3",
|
|
45
|
-
r: "3",
|
|
46
|
-
strokeWidth: "0",
|
|
47
|
-
fill: isDropValid ? '#1E79C2' : '#C64252'
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
const DropIndicator = _ref4 => {
|
|
51
|
-
let {
|
|
52
|
-
dropIndicatorPosition,
|
|
53
|
-
isLast,
|
|
54
|
-
isDropValid
|
|
55
|
-
} = _ref4;
|
|
56
|
-
if (![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(dropIndicatorPosition)) return null;
|
|
57
|
-
const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;
|
|
58
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
59
|
-
children: [CircleIndicator(getCircleStyles({
|
|
60
|
-
dropIndicatorPosition: safeDropIndicatorPosition
|
|
61
|
-
}), isDropValid), /*#__PURE__*/_jsx(StyledIndicator, {
|
|
62
|
-
dropIndicatorPosition: safeDropIndicatorPosition,
|
|
63
|
-
isDropValid: isDropValid
|
|
64
|
-
})]
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { DropIndicator as default };
|
package/esm/parts/ExpandCaret.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import { useCallback, useContext } from 'react';
|
|
3
|
-
import Button from '@elliemae/ds-button';
|
|
4
|
-
import { ArrowheadDown, ArrowheadRight } from '@elliemae/ds-icons';
|
|
5
|
-
import { toggleItemExpand } from '../utils/group-expands-helpers.js';
|
|
6
|
-
import { focusItem } from '../utils/tree-helpers.js';
|
|
7
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
8
|
-
|
|
9
|
-
var _ArrowheadDown, _ArrowheadRight;
|
|
10
|
-
const ExpandCaret = props => {
|
|
11
|
-
const defaultHandleExpandGroup = useCallback(toggleItemExpand, []);
|
|
12
|
-
const {
|
|
13
|
-
item
|
|
14
|
-
} = props;
|
|
15
|
-
const {
|
|
16
|
-
id,
|
|
17
|
-
isExpanded,
|
|
18
|
-
isGroup,
|
|
19
|
-
children
|
|
20
|
-
} = item;
|
|
21
|
-
const isGroupOrHasChildrens = isGroup || Array.isArray(children) && children.length > 0;
|
|
22
|
-
const ctx = useContext(TreeViewContext);
|
|
23
|
-
const {
|
|
24
|
-
props: {
|
|
25
|
-
onItemFocus
|
|
26
|
-
},
|
|
27
|
-
handleExpandGroup = defaultHandleExpandGroup,
|
|
28
|
-
triggerTreeRerender,
|
|
29
|
-
updateUserExpandedState,
|
|
30
|
-
setLatestToggledItem,
|
|
31
|
-
setFocusedItem,
|
|
32
|
-
virtualListHelpers: {
|
|
33
|
-
scrollToIndex
|
|
34
|
-
}
|
|
35
|
-
} = ctx;
|
|
36
|
-
if (isGroupOrHasChildrens) return /*#__PURE__*/_jsx(Button, {
|
|
37
|
-
buttonType: "text",
|
|
38
|
-
className: "expandable-arrow",
|
|
39
|
-
"data-testid": "tree-item-expand-toggle",
|
|
40
|
-
icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx(ArrowheadDown, {
|
|
41
|
-
size: "s",
|
|
42
|
-
"data-testid": "ic-arrow-head-down"
|
|
43
|
-
})) : _ArrowheadRight || (_ArrowheadRight = /*#__PURE__*/_jsx(ArrowheadRight, {
|
|
44
|
-
size: "s",
|
|
45
|
-
"data-testid": "ic-arrow-head-right"
|
|
46
|
-
})),
|
|
47
|
-
onMouseDown: e => {
|
|
48
|
-
// prevent focusing the caret
|
|
49
|
-
if (e) {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
onClick: e => {
|
|
54
|
-
e.stopPropagation();
|
|
55
|
-
if (e) handleExpandGroup(item, triggerTreeRerender, updateUserExpandedState, scrollToIndex, e);
|
|
56
|
-
setLatestToggledItem(item);
|
|
57
|
-
const itemVitualIndex = item.virtualIndex;
|
|
58
|
-
|
|
59
|
-
if (typeof itemVitualIndex === 'number') {
|
|
60
|
-
onItemFocus({
|
|
61
|
-
itemIndex: itemVitualIndex,
|
|
62
|
-
scrollToItem: function () {
|
|
63
|
-
let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
64
|
-
align: 'start'
|
|
65
|
-
};
|
|
66
|
-
return scrollToIndex(itemVitualIndex, opts);
|
|
67
|
-
},
|
|
68
|
-
item
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
setFocusedItem(item);
|
|
73
|
-
focusItem(item);
|
|
74
|
-
},
|
|
75
|
-
size: "s",
|
|
76
|
-
tabIndex: -1
|
|
77
|
-
}, "".concat(id, "-expand-addon"));
|
|
78
|
-
return /*#__PURE__*/_jsx("div", {
|
|
79
|
-
style: {
|
|
80
|
-
width: '24px'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export { ExpandCaret };
|
package/esm/parts/Icon.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { cx } from '@elliemae/ds-utilities';
|
|
3
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
4
|
-
|
|
5
|
-
const Icon = props => {
|
|
6
|
-
const {
|
|
7
|
-
item
|
|
8
|
-
} = props;
|
|
9
|
-
const isGroupOrHasChildrens = item.isGroup || Array.isArray(item.children) && item.children.length > 0;
|
|
10
|
-
const ctx = useContext(TreeViewContext);
|
|
11
|
-
const {
|
|
12
|
-
props: {
|
|
13
|
-
groupIcon,
|
|
14
|
-
itemIcon
|
|
15
|
-
}
|
|
16
|
-
} = ctx;
|
|
17
|
-
const icon = isGroupOrHasChildrens ? groupIcon : itemIcon;
|
|
18
|
-
if (!icon) return null;
|
|
19
|
-
return /*#__PURE__*/React.cloneElement(icon, {
|
|
20
|
-
'data-testid': isGroupOrHasChildrens ? 'tree-item-group-icon' : 'tree-item-icon',
|
|
21
|
-
// legacy class-name way of handling things,
|
|
22
|
-
// this will eventually be deprecated in favor of styled components
|
|
23
|
-
// untill then, just eslint-ignore and move on
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
|
25
|
-
className: cx(icon.props.className, 'tree-item-icon')
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export { Icon };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
|
|
4
|
-
const getItemNestingLeftPadding = (level, opts) => {
|
|
5
|
-
const {
|
|
6
|
-
spaceForNestingLevel = 1.5
|
|
7
|
-
} = opts;
|
|
8
|
-
const groupLeftPadding = spaceForNestingLevel * (level - 1);
|
|
9
|
-
const finalLeftPadding = groupLeftPadding + spaceForNestingLevel - 0.1; // root level left-padding would be negative and would not be applied
|
|
10
|
-
// if "root-level" nesting, then defaults to 0 left-padding.
|
|
11
|
-
|
|
12
|
-
return finalLeftPadding > 0 ? "".concat(finalLeftPadding, "em") : '0';
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const NestingSpace = props => {
|
|
16
|
-
const {
|
|
17
|
-
item,
|
|
18
|
-
spaceForNestingLevel
|
|
19
|
-
} = props;
|
|
20
|
-
const {
|
|
21
|
-
treeDepth
|
|
22
|
-
} = item;
|
|
23
|
-
|
|
24
|
-
if (treeDepth) {
|
|
25
|
-
const itemNestingLeftPadding = getItemNestingLeftPadding(treeDepth - 1, {
|
|
26
|
-
spaceForNestingLevel
|
|
27
|
-
});
|
|
28
|
-
return /*#__PURE__*/_jsx("div", {
|
|
29
|
-
"data-testid": "tree-item-nested-space",
|
|
30
|
-
style: {
|
|
31
|
-
width: itemNestingLeftPadding
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return null;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { NestingSpace };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import { useContext, useCallback, useMemo } from 'react';
|
|
3
|
-
import { DSRadio } from '@elliemae/ds-form';
|
|
4
|
-
import TreeViewContext from '../TreeViewContext.js';
|
|
5
|
-
|
|
6
|
-
function RadioSelectable(props) {
|
|
7
|
-
const {
|
|
8
|
-
item,
|
|
9
|
-
itemIndex
|
|
10
|
-
} = props;
|
|
11
|
-
const ctx = useContext(TreeViewContext);
|
|
12
|
-
const {
|
|
13
|
-
props: {
|
|
14
|
-
onSelectionChange,
|
|
15
|
-
isItemDisabled
|
|
16
|
-
},
|
|
17
|
-
virtualListHelpers: {
|
|
18
|
-
scrollToIndex
|
|
19
|
-
},
|
|
20
|
-
uniqueTreeViewUUID,
|
|
21
|
-
selectedCheckboxes,
|
|
22
|
-
setSelectedCheckboxes
|
|
23
|
-
} = ctx;
|
|
24
|
-
const {
|
|
25
|
-
id
|
|
26
|
-
} = item;
|
|
27
|
-
const onRadioChange = useCallback(() => {
|
|
28
|
-
const newSelectionHasmap = {
|
|
29
|
-
[id]: true
|
|
30
|
-
};
|
|
31
|
-
setSelectedCheckboxes(newSelectionHasmap);
|
|
32
|
-
const indexAndScrollTo = {
|
|
33
|
-
scrollToItem: () => {
|
|
34
|
-
if (item.virtualIndex) scrollToIndex(item.virtualIndex);
|
|
35
|
-
},
|
|
36
|
-
itemIndex
|
|
37
|
-
};
|
|
38
|
-
if (onSelectionChange) onSelectionChange(newSelectionHasmap, item, indexAndScrollTo);
|
|
39
|
-
}, [id, setSelectedCheckboxes, itemIndex, onSelectionChange, item, scrollToIndex]);
|
|
40
|
-
const radioName = useMemo(() => "radios-".concat(uniqueTreeViewUUID), [uniqueTreeViewUUID]);
|
|
41
|
-
const isDisabled = useMemo(() => isItemDisabled(item), [item, isItemDisabled]);
|
|
42
|
-
return /*#__PURE__*/_jsx(DSRadio, {
|
|
43
|
-
checked: selectedCheckboxes[id] === true,
|
|
44
|
-
name: radioName,
|
|
45
|
-
disabled: isDisabled,
|
|
46
|
-
className: "em-ds-tree-item-radio",
|
|
47
|
-
"data-testid": "tree-item-radio",
|
|
48
|
-
onChange: onRadioChange,
|
|
49
|
-
tabIndex: 0
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { RadioSelectable as default };
|