@elliemae/ds-treeview 2.3.0-alpha.8 → 2.3.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/TreeView.js +30 -0
- package/cjs/TreeViewContext.js +98 -0
- package/cjs/config/cssClassesConstants.js +13 -0
- package/cjs/config/useTreeview.js +127 -0
- package/cjs/hoc/DnDTreeContext.js +18 -0
- package/cjs/hoc/SortableItemContext.js +21 -0
- package/cjs/hoc/WithConditionalDnDContext.js +138 -0
- package/cjs/hoc/WithDnDSortableItemContext.js +70 -0
- package/cjs/index.js +26 -0
- package/cjs/parts/CheckboxSelectable.js +86 -0
- package/cjs/parts/ChildrenCountDisplayer.js +30 -0
- package/cjs/parts/DnDHandle.js +46 -0
- package/cjs/parts/DropIndicator.js +75 -0
- package/cjs/parts/ExpandCaret.js +94 -0
- package/cjs/parts/Icon.js +37 -0
- package/cjs/parts/NestingSpace.js +47 -0
- package/cjs/parts/RadioSelectable.js +59 -0
- package/cjs/parts/TreeItem.js +185 -0
- package/cjs/parts/TreeItemText.js +108 -0
- package/cjs/parts/TreeList.js +139 -0
- package/cjs/plugins/dnd/TreeDndPlugin.js +7 -0
- package/cjs/plugins/dnd/index.js +9 -0
- package/cjs/plugins/index.js +21 -0
- package/cjs/plugins/roving/TreeRovingPlugin.js +7 -0
- package/cjs/plugins/roving/index.js +9 -0
- package/cjs/plugins/searchable/SearchableTreePlugin.js +7 -0
- package/cjs/plugins/searchable/index.js +9 -0
- package/cjs/plugins/selectable/SelectablePluginTree.js +7 -0
- package/cjs/plugins/selectable/index.js +9 -0
- package/cjs/plugins/toolbar/TreeToolbarPlugin.js +7 -0
- package/cjs/plugins/toolbar/index.js +9 -0
- package/cjs/plugins/tree/TreeDataPlugin.js +7 -0
- package/cjs/plugins/tree/index.js +9 -0
- package/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +7 -0
- package/cjs/plugins/virtualization/index.js +9 -0
- package/cjs/react-desc-prop-types.js +56 -0
- package/cjs/related-components/TreeViewSearchBar.js +48 -0
- package/cjs/sharedTypes.js +2 -0
- package/cjs/utils/array-helpers.js +24 -0
- package/cjs/utils/group-expands-helpers.js +111 -0
- package/cjs/utils/keyboard-helpers.js +175 -0
- package/cjs/utils/object-helpers.js +69 -0
- package/cjs/utils/refs-helpers.js +31 -0
- package/cjs/utils/selectable-helper.js +80 -0
- package/cjs/utils/string-helpers.js +7 -0
- package/cjs/utils/tree-helpers.js +220 -0
- package/cjs/utils/useInstanceRefActions.js +87 -0
- package/cjs/utils/useTree.js +108 -0
- package/esm/TreeView.js +21 -0
- package/{dist/esm → esm}/TreeViewContext.js +29 -24
- package/esm/config/cssClassesConstants.js +6 -0
- package/esm/config/useTreeview.js +119 -0
- package/esm/hoc/DnDTreeContext.js +14 -0
- package/esm/hoc/SortableItemContext.js +17 -0
- package/esm/hoc/WithConditionalDnDContext.js +128 -0
- package/esm/hoc/WithDnDSortableItemContext.js +61 -0
- package/esm/index.js +9 -0
- package/esm/parts/CheckboxSelectable.js +78 -0
- package/esm/parts/ChildrenCountDisplayer.js +22 -0
- package/esm/parts/DnDHandle.js +38 -0
- package/esm/parts/DropIndicator.js +68 -0
- package/esm/parts/ExpandCaret.js +85 -0
- package/esm/parts/Icon.js +29 -0
- package/esm/parts/NestingSpace.js +39 -0
- package/esm/parts/RadioSelectable.js +53 -0
- package/esm/parts/TreeItem.js +173 -0
- package/esm/parts/TreeItemText.js +99 -0
- package/esm/parts/TreeList.js +127 -0
- package/esm/plugins/dnd/TreeDndPlugin.js +3 -0
- package/esm/plugins/dnd/index.js +1 -0
- package/esm/plugins/index.js +7 -0
- package/esm/plugins/roving/TreeRovingPlugin.js +3 -0
- package/esm/plugins/roving/index.js +1 -0
- package/esm/plugins/searchable/SearchableTreePlugin.js +3 -0
- package/esm/plugins/searchable/index.js +1 -0
- package/esm/plugins/selectable/SelectablePluginTree.js +3 -0
- package/esm/plugins/selectable/index.js +1 -0
- package/esm/plugins/toolbar/TreeToolbarPlugin.js +3 -0
- package/esm/plugins/toolbar/index.js +1 -0
- package/esm/plugins/tree/TreeDataPlugin.js +3 -0
- package/esm/plugins/tree/index.js +1 -0
- package/esm/plugins/virtualization/TreeVirtualizationPlugin.js +3 -0
- package/esm/plugins/virtualization/index.js +1 -0
- package/esm/react-desc-prop-types.js +52 -0
- package/esm/related-components/TreeViewSearchBar.js +40 -0
- package/esm/sharedTypes.js +1 -0
- package/{dist/esm → esm}/utils/array-helpers.js +6 -6
- package/esm/utils/group-expands-helpers.js +99 -0
- package/{dist/esm → esm}/utils/keyboard-helpers.js +71 -43
- package/esm/utils/object-helpers.js +64 -0
- package/esm/utils/refs-helpers.js +27 -0
- package/esm/utils/selectable-helper.js +70 -0
- package/esm/utils/string-helpers.js +3 -0
- package/esm/utils/tree-helpers.js +205 -0
- package/{dist/esm → esm}/utils/useInstanceRefActions.js +35 -21
- package/esm/utils/useTree.js +99 -0
- package/package.json +121 -124
- package/types/TreeView.d.ts +13 -0
- package/types/TreeViewContext.d.ts +17 -0
- package/types/config/cssClassesConstants.d.ts +4 -0
- package/types/config/useTreeview.d.ts +7 -0
- package/types/hoc/DnDTreeContext.d.ts +14 -0
- package/types/hoc/SortableItemContext.d.ts +19 -0
- package/types/hoc/WithConditionalDnDContext.d.ts +4 -0
- package/types/hoc/WithDnDSortableItemContext.d.ts +4 -0
- package/types/index.d.ts +3 -0
- package/types/parts/CheckboxSelectable.d.ts +8 -0
- package/types/parts/ChildrenCountDisplayer.d.ts +7 -0
- package/types/parts/DnDHandle.d.ts +6 -0
- package/types/parts/DropIndicator.d.ts +10 -0
- package/types/parts/ExpandCaret.d.ts +7 -0
- package/types/parts/Icon.d.ts +7 -0
- package/types/parts/NestingSpace.d.ts +8 -0
- package/types/parts/RadioSelectable.d.ts +8 -0
- package/types/parts/TreeItem.d.ts +17 -0
- package/types/parts/TreeItemText.d.ts +7 -0
- package/types/parts/TreeList.d.ts +20 -0
- package/types/plugins/dnd/TreeDndPlugin.d.ts +1 -0
- package/types/plugins/dnd/index.d.ts +1 -0
- package/types/plugins/index.d.ts +7 -0
- package/types/plugins/roving/TreeRovingPlugin.d.ts +1 -0
- package/types/plugins/roving/index.d.ts +1 -0
- package/types/plugins/searchable/SearchableTreePlugin.d.ts +1 -0
- package/types/plugins/searchable/index.d.ts +1 -0
- package/types/plugins/selectable/SelectablePluginTree.d.ts +1 -0
- package/types/plugins/selectable/index.d.ts +1 -0
- package/types/plugins/toolbar/TreeToolbarPlugin.d.ts +1 -0
- package/types/plugins/toolbar/index.d.ts +1 -0
- package/types/plugins/tree/TreeDataPlugin.d.ts +1 -0
- package/types/plugins/tree/index.d.ts +1 -0
- package/types/plugins/virtualization/TreeVirtualizationPlugin.d.ts +1 -0
- package/types/plugins/virtualization/index.d.ts +1 -0
- package/types/react-desc-prop-types.d.ts +210 -0
- package/types/related-components/TreeViewSearchBar.d.ts +16 -0
- package/types/sharedTypes.d.ts +47 -0
- package/types/utils/array-helpers.d.ts +2 -0
- package/types/utils/group-expands-helpers.d.ts +14 -0
- package/types/utils/keyboard-helpers.d.ts +6 -0
- package/types/utils/object-helpers.d.ts +6 -0
- package/types/utils/refs-helpers.d.ts +4 -0
- package/types/utils/selectable-helper.d.ts +7 -0
- package/types/utils/string-helpers.d.ts +1 -0
- package/types/utils/tree-helpers.d.ts +28 -0
- package/types/utils/useInstanceRefActions.d.ts +3 -0
- package/types/utils/useTree.d.ts +14 -0
- package/dist/cjs/TreeView.js +0 -50
- package/dist/cjs/TreeView.js.map +0 -7
- package/dist/cjs/TreeViewContext.js +0 -116
- package/dist/cjs/TreeViewContext.js.map +0 -7
- package/dist/cjs/config/cssClassesConstants.js +0 -41
- package/dist/cjs/config/cssClassesConstants.js.map +0 -7
- package/dist/cjs/config/useTreeview.js +0 -151
- package/dist/cjs/config/useTreeview.js.map +0 -7
- package/dist/cjs/hoc/DnDTreeContext.js +0 -45
- package/dist/cjs/hoc/DnDTreeContext.js.map +0 -7
- package/dist/cjs/hoc/SortableItemContext.js +0 -46
- package/dist/cjs/hoc/SortableItemContext.js.map +0 -7
- package/dist/cjs/hoc/WithConditionalDnDContext.js +0 -128
- package/dist/cjs/hoc/WithConditionalDnDContext.js.map +0 -7
- package/dist/cjs/hoc/WithDnDSortableItemContext.js +0 -69
- package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +0 -7
- package/dist/cjs/index.js +0 -37
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/parts/CheckboxSelectable.js +0 -97
- package/dist/cjs/parts/CheckboxSelectable.js.map +0 -7
- package/dist/cjs/parts/ChildrenCountDisplayer.js +0 -47
- package/dist/cjs/parts/ChildrenCountDisplayer.js.map +0 -7
- package/dist/cjs/parts/DnDHandle.js +0 -57
- package/dist/cjs/parts/DnDHandle.js.map +0 -7
- package/dist/cjs/parts/DropIndicator.js +0 -80
- package/dist/cjs/parts/DropIndicator.js.map +0 -7
- package/dist/cjs/parts/ExpandCaret.js +0 -96
- package/dist/cjs/parts/ExpandCaret.js.map +0 -7
- package/dist/cjs/parts/Icon.js +0 -52
- package/dist/cjs/parts/Icon.js.map +0 -7
- package/dist/cjs/parts/NestingSpace.js +0 -55
- package/dist/cjs/parts/NestingSpace.js.map +0 -7
- package/dist/cjs/parts/RadioSelectable.js +0 -74
- package/dist/cjs/parts/RadioSelectable.js.map +0 -7
- package/dist/cjs/parts/TreeItem.js +0 -166
- package/dist/cjs/parts/TreeItem.js.map +0 -7
- package/dist/cjs/parts/TreeItemText.js +0 -101
- package/dist/cjs/parts/TreeItemText.js.map +0 -7
- package/dist/cjs/parts/TreeList.js +0 -123
- package/dist/cjs/parts/TreeList.js.map +0 -7
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js +0 -35
- package/dist/cjs/plugins/dnd/TreeDndPlugin.js.map +0 -7
- package/dist/cjs/plugins/dnd/index.js +0 -28
- package/dist/cjs/plugins/dnd/index.js.map +0 -7
- package/dist/cjs/plugins/index.js +0 -34
- package/dist/cjs/plugins/index.js.map +0 -7
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js +0 -35
- package/dist/cjs/plugins/roving/TreeRovingPlugin.js.map +0 -7
- package/dist/cjs/plugins/roving/index.js +0 -28
- package/dist/cjs/plugins/roving/index.js.map +0 -7
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js +0 -35
- package/dist/cjs/plugins/searchable/SearchableTreePlugin.js.map +0 -7
- package/dist/cjs/plugins/searchable/index.js +0 -28
- package/dist/cjs/plugins/searchable/index.js.map +0 -7
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js +0 -35
- package/dist/cjs/plugins/selectable/SelectablePluginTree.js.map +0 -7
- package/dist/cjs/plugins/selectable/index.js +0 -28
- package/dist/cjs/plugins/selectable/index.js.map +0 -7
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js +0 -35
- package/dist/cjs/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
- package/dist/cjs/plugins/toolbar/index.js +0 -28
- package/dist/cjs/plugins/toolbar/index.js.map +0 -7
- package/dist/cjs/plugins/tree/TreeDataPlugin.js +0 -35
- package/dist/cjs/plugins/tree/TreeDataPlugin.js.map +0 -7
- package/dist/cjs/plugins/tree/index.js +0 -28
- package/dist/cjs/plugins/tree/index.js.map +0 -7
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js +0 -35
- package/dist/cjs/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
- package/dist/cjs/plugins/virtualization/index.js +0 -28
- package/dist/cjs/plugins/virtualization/index.js.map +0 -7
- package/dist/cjs/react-desc-prop-types.js +0 -85
- package/dist/cjs/react-desc-prop-types.js.map +0 -7
- package/dist/cjs/related-components/TreeViewSearchBar.js +0 -50
- package/dist/cjs/related-components/TreeViewSearchBar.js.map +0 -7
- package/dist/cjs/sharedTypes.js +0 -27
- package/dist/cjs/sharedTypes.js.map +0 -7
- package/dist/cjs/utils/array-helpers.js +0 -48
- package/dist/cjs/utils/array-helpers.js.map +0 -7
- package/dist/cjs/utils/group-expands-helpers.js +0 -138
- package/dist/cjs/utils/group-expands-helpers.js.map +0 -7
- package/dist/cjs/utils/keyboard-helpers.js +0 -170
- package/dist/cjs/utils/keyboard-helpers.js.map +0 -7
- package/dist/cjs/utils/object-helpers.js +0 -76
- package/dist/cjs/utils/object-helpers.js.map +0 -7
- package/dist/cjs/utils/refs-helpers.js +0 -52
- package/dist/cjs/utils/refs-helpers.js.map +0 -7
- package/dist/cjs/utils/selectable-helper.js +0 -88
- package/dist/cjs/utils/selectable-helper.js.map +0 -7
- package/dist/cjs/utils/string-helpers.js +0 -35
- package/dist/cjs/utils/string-helpers.js.map +0 -7
- package/dist/cjs/utils/tree-helpers.js +0 -184
- package/dist/cjs/utils/tree-helpers.js.map +0 -7
- package/dist/cjs/utils/useInstanceRefActions.js +0 -98
- package/dist/cjs/utils/useInstanceRefActions.js.map +0 -7
- package/dist/cjs/utils/useTree.js +0 -106
- package/dist/cjs/utils/useTree.js.map +0 -7
- package/dist/esm/TreeView.js +0 -21
- package/dist/esm/TreeView.js.map +0 -7
- package/dist/esm/TreeViewContext.js.map +0 -7
- package/dist/esm/config/cssClassesConstants.js +0 -12
- package/dist/esm/config/cssClassesConstants.js.map +0 -7
- package/dist/esm/config/useTreeview.js +0 -122
- package/dist/esm/config/useTreeview.js.map +0 -7
- package/dist/esm/hoc/DnDTreeContext.js +0 -16
- package/dist/esm/hoc/DnDTreeContext.js.map +0 -7
- package/dist/esm/hoc/SortableItemContext.js +0 -17
- package/dist/esm/hoc/SortableItemContext.js.map +0 -7
- package/dist/esm/hoc/WithConditionalDnDContext.js +0 -99
- package/dist/esm/hoc/WithConditionalDnDContext.js.map +0 -7
- package/dist/esm/hoc/WithDnDSortableItemContext.js +0 -40
- package/dist/esm/hoc/WithDnDSortableItemContext.js.map +0 -7
- package/dist/esm/index.js +0 -8
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/parts/CheckboxSelectable.js +0 -68
- package/dist/esm/parts/CheckboxSelectable.js.map +0 -7
- package/dist/esm/parts/ChildrenCountDisplayer.js +0 -18
- package/dist/esm/parts/ChildrenCountDisplayer.js.map +0 -7
- package/dist/esm/parts/DnDHandle.js +0 -28
- package/dist/esm/parts/DnDHandle.js.map +0 -7
- package/dist/esm/parts/DropIndicator.js +0 -51
- package/dist/esm/parts/DropIndicator.js.map +0 -7
- package/dist/esm/parts/ExpandCaret.js +0 -67
- package/dist/esm/parts/ExpandCaret.js.map +0 -7
- package/dist/esm/parts/Icon.js +0 -23
- package/dist/esm/parts/Icon.js.map +0 -7
- package/dist/esm/parts/NestingSpace.js +0 -26
- package/dist/esm/parts/NestingSpace.js.map +0 -7
- package/dist/esm/parts/RadioSelectable.js +0 -45
- package/dist/esm/parts/RadioSelectable.js.map +0 -7
- package/dist/esm/parts/TreeItem.js +0 -137
- package/dist/esm/parts/TreeItem.js.map +0 -7
- package/dist/esm/parts/TreeItemText.js +0 -72
- package/dist/esm/parts/TreeItemText.js.map +0 -7
- package/dist/esm/parts/TreeList.js +0 -94
- package/dist/esm/parts/TreeList.js.map +0 -7
- package/dist/esm/plugins/dnd/TreeDndPlugin.js +0 -6
- package/dist/esm/plugins/dnd/TreeDndPlugin.js.map +0 -7
- package/dist/esm/plugins/dnd/index.js +0 -3
- package/dist/esm/plugins/dnd/index.js.map +0 -7
- package/dist/esm/plugins/index.js +0 -9
- package/dist/esm/plugins/index.js.map +0 -7
- package/dist/esm/plugins/roving/TreeRovingPlugin.js +0 -6
- package/dist/esm/plugins/roving/TreeRovingPlugin.js.map +0 -7
- package/dist/esm/plugins/roving/index.js +0 -3
- package/dist/esm/plugins/roving/index.js.map +0 -7
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js +0 -6
- package/dist/esm/plugins/searchable/SearchableTreePlugin.js.map +0 -7
- package/dist/esm/plugins/searchable/index.js +0 -3
- package/dist/esm/plugins/searchable/index.js.map +0 -7
- package/dist/esm/plugins/selectable/SelectablePluginTree.js +0 -6
- package/dist/esm/plugins/selectable/SelectablePluginTree.js.map +0 -7
- package/dist/esm/plugins/selectable/index.js +0 -3
- package/dist/esm/plugins/selectable/index.js.map +0 -7
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js +0 -6
- package/dist/esm/plugins/toolbar/TreeToolbarPlugin.js.map +0 -7
- package/dist/esm/plugins/toolbar/index.js +0 -3
- package/dist/esm/plugins/toolbar/index.js.map +0 -7
- package/dist/esm/plugins/tree/TreeDataPlugin.js +0 -6
- package/dist/esm/plugins/tree/TreeDataPlugin.js.map +0 -7
- package/dist/esm/plugins/tree/index.js +0 -3
- package/dist/esm/plugins/tree/index.js.map +0 -7
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js +0 -6
- package/dist/esm/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -7
- package/dist/esm/plugins/virtualization/index.js +0 -3
- package/dist/esm/plugins/virtualization/index.js.map +0 -7
- package/dist/esm/react-desc-prop-types.js +0 -56
- package/dist/esm/react-desc-prop-types.js.map +0 -7
- package/dist/esm/related-components/TreeViewSearchBar.js +0 -21
- package/dist/esm/related-components/TreeViewSearchBar.js.map +0 -7
- package/dist/esm/sharedTypes.js +0 -2
- package/dist/esm/sharedTypes.js.map +0 -7
- package/dist/esm/utils/array-helpers.js.map +0 -7
- package/dist/esm/utils/group-expands-helpers.js +0 -109
- package/dist/esm/utils/group-expands-helpers.js.map +0 -7
- package/dist/esm/utils/keyboard-helpers.js.map +0 -7
- package/dist/esm/utils/object-helpers.js +0 -47
- package/dist/esm/utils/object-helpers.js.map +0 -7
- package/dist/esm/utils/refs-helpers.js +0 -23
- package/dist/esm/utils/refs-helpers.js.map +0 -7
- package/dist/esm/utils/selectable-helper.js +0 -59
- package/dist/esm/utils/selectable-helper.js.map +0 -7
- package/dist/esm/utils/string-helpers.js +0 -6
- package/dist/esm/utils/string-helpers.js.map +0 -7
- package/dist/esm/utils/tree-helpers.js +0 -155
- package/dist/esm/utils/tree-helpers.js.map +0 -7
- package/dist/esm/utils/useInstanceRefActions.js.map +0 -7
- package/dist/esm/utils/useTree.js +0 -77
- package/dist/esm/utils/useTree.js.map +0 -7
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var useTreeview_exports = {};
|
|
29
|
-
__export(useTreeview_exports, {
|
|
30
|
-
useTreeview: () => useTreeview
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_react_virtual = require("react-virtual");
|
|
35
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
-
var import_uuid = require("uuid");
|
|
37
|
-
var import_react_desc_prop_types = require("../react-desc-prop-types");
|
|
38
|
-
var import_TreeViewContext = require("../TreeViewContext");
|
|
39
|
-
var import_dnd = require("../plugins/dnd");
|
|
40
|
-
var import_useTree = require("../utils/useTree");
|
|
41
|
-
var import_group_expands_helpers = require("../utils/group-expands-helpers");
|
|
42
|
-
var import_useInstanceRefActions = require("../utils/useInstanceRefActions");
|
|
43
|
-
var import_keyboard_helpers = require("../utils/keyboard-helpers");
|
|
44
|
-
const useTreeview = (props) => {
|
|
45
|
-
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_TreeViewContext.defaultProps);
|
|
46
|
-
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.TreeViewPropTypes);
|
|
47
|
-
const defaultActions = {
|
|
48
|
-
actions: {
|
|
49
|
-
toggleExpandAll: () => {
|
|
50
|
-
},
|
|
51
|
-
scrollTo: () => {
|
|
52
|
-
},
|
|
53
|
-
setSelectedItemByVirtualIndex: () => {
|
|
54
|
-
},
|
|
55
|
-
setFocusedItemByVirtualIndex: () => {
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const treeRef = (0, import_react.useRef)(defaultActions);
|
|
60
|
-
const {
|
|
61
|
-
data,
|
|
62
|
-
plugins,
|
|
63
|
-
onOrderChange,
|
|
64
|
-
isMultiSelect,
|
|
65
|
-
isSingleSelect,
|
|
66
|
-
instanceRef,
|
|
67
|
-
selection,
|
|
68
|
-
onInstanceRefInitialized
|
|
69
|
-
} = propsWithDefault;
|
|
70
|
-
const [uniqueTreeViewUUID] = (0, import_react.useState)((0, import_uuid.v4)());
|
|
71
|
-
const [hoverItem, setHoverItem] = (0, import_react.useState)(null);
|
|
72
|
-
const [latestToggledItem, setLatestToggledItem] = (0, import_react.useState)(null);
|
|
73
|
-
const [selectedItem, setSelectedItem] = (0, import_react.useState)(null);
|
|
74
|
-
const [focusedItem, setFocusedItem] = (0, import_react.useState)(null);
|
|
75
|
-
const [selectedCheckboxes, setSelectedCheckboxes] = (0, import_react.useState)({
|
|
76
|
-
...selection
|
|
77
|
-
});
|
|
78
|
-
const [expandedGroups, setExpandedGroups] = (0, import_react.useState)({});
|
|
79
|
-
const { visibleItems, flattenedItems, tree, treeRoot, triggerTreeRerender, updateUserExpandedState } = (0, import_useTree.useTree)(data, propsWithDefault, {
|
|
80
|
-
setExpandedGroups
|
|
81
|
-
});
|
|
82
|
-
const virtualListRef = (0, import_react.useRef)();
|
|
83
|
-
const virtualListHelpers = (0, import_react_virtual.useVirtual)({
|
|
84
|
-
size: visibleItems.length,
|
|
85
|
-
parentRef: virtualListRef,
|
|
86
|
-
overscan: 15
|
|
87
|
-
});
|
|
88
|
-
const withDragAndDrop = !!(plugins?.includes(import_dnd.TreeDndPlugin) && onOrderChange);
|
|
89
|
-
const withRadioChecks = isSingleSelect && !isMultiSelect;
|
|
90
|
-
const withCheckboxChecks = !isSingleSelect && isMultiSelect;
|
|
91
|
-
const handleExpandGroup = (0, import_react.useCallback)(import_group_expands_helpers.toggleItemExpand, []);
|
|
92
|
-
const ctx = (0, import_react.useMemo)(() => ({
|
|
93
|
-
props: propsWithDefault,
|
|
94
|
-
virtualListHelpers,
|
|
95
|
-
virtualListRef,
|
|
96
|
-
tree,
|
|
97
|
-
treeRoot,
|
|
98
|
-
visibleItems,
|
|
99
|
-
flattenedItems,
|
|
100
|
-
triggerTreeRerender,
|
|
101
|
-
withRadioChecks,
|
|
102
|
-
withCheckboxChecks,
|
|
103
|
-
withDragAndDrop,
|
|
104
|
-
uniqueTreeViewUUID,
|
|
105
|
-
selectedCheckboxes,
|
|
106
|
-
setSelectedCheckboxes,
|
|
107
|
-
selectedItem,
|
|
108
|
-
setSelectedItem,
|
|
109
|
-
expandedGroups,
|
|
110
|
-
setExpandedGroups,
|
|
111
|
-
latestToggledItem,
|
|
112
|
-
setLatestToggledItem,
|
|
113
|
-
focusedItem,
|
|
114
|
-
setFocusedItem,
|
|
115
|
-
hoverItem,
|
|
116
|
-
setHoverItem,
|
|
117
|
-
handleExpandGroup,
|
|
118
|
-
updateUserExpandedState
|
|
119
|
-
}), [
|
|
120
|
-
propsWithDefault,
|
|
121
|
-
virtualListHelpers,
|
|
122
|
-
tree,
|
|
123
|
-
treeRoot,
|
|
124
|
-
visibleItems,
|
|
125
|
-
flattenedItems,
|
|
126
|
-
triggerTreeRerender,
|
|
127
|
-
withRadioChecks,
|
|
128
|
-
withCheckboxChecks,
|
|
129
|
-
withDragAndDrop,
|
|
130
|
-
uniqueTreeViewUUID,
|
|
131
|
-
selectedCheckboxes,
|
|
132
|
-
selectedItem,
|
|
133
|
-
expandedGroups,
|
|
134
|
-
latestToggledItem,
|
|
135
|
-
focusedItem,
|
|
136
|
-
hoverItem,
|
|
137
|
-
handleExpandGroup,
|
|
138
|
-
updateUserExpandedState
|
|
139
|
-
]);
|
|
140
|
-
if (instanceRef)
|
|
141
|
-
instanceRef.current = treeRef.current;
|
|
142
|
-
(0, import_useInstanceRefActions.useInstanceRefActions)(treeRef.current, ctx);
|
|
143
|
-
(0, import_keyboard_helpers.useGlobalToggleAllExpandShortcut)(treeRoot, triggerTreeRerender, setLatestToggledItem, updateUserExpandedState);
|
|
144
|
-
(0, import_group_expands_helpers.useNotifyExpandedChange)(propsWithDefault, ctx);
|
|
145
|
-
(0, import_react.useEffect)(() => {
|
|
146
|
-
setTimeout(() => onInstanceRefInitialized(treeRef), 100);
|
|
147
|
-
}, []);
|
|
148
|
-
return (0, import_react.useMemo)(() => ({ ctx }), [ctx]);
|
|
149
|
-
};
|
|
150
|
-
module.exports = __toCommonJS(useTreeview_exports);
|
|
151
|
-
//# sourceMappingURL=useTreeview.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config/useTreeview.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport { useState, useRef, useEffect, useMemo, useCallback } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { TreeViewPropTypes } from '../react-desc-prop-types';\nimport { defaultProps } from '../TreeViewContext';\nimport { TreeDndPlugin } from '../plugins/dnd';\nimport { useTree } from '../utils/useTree';\nimport { useNotifyExpandedChange, toggleItemExpand } from '../utils/group-expands-helpers';\nimport { useInstanceRefActions } from '../utils/useInstanceRefActions';\nimport { useGlobalToggleAllExpandShortcut } from '../utils/keyboard-helpers';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport type { DSTreeviewInternalsT } from '../sharedTypes';\n\ntype UseTreeviewT = (props: DSTreeviewT.Props) => { ctx: DSTreeviewInternalsT.CTX };\n\nexport const useTreeview: UseTreeviewT = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSTreeviewT.Props>(props, defaultProps);\n useValidateTypescriptPropTypes<DSTreeviewT.Props>(propsWithDefault, TreeViewPropTypes);\n const defaultActions = {\n actions: {\n toggleExpandAll: () => {},\n scrollTo: () => {},\n setSelectedItemByVirtualIndex: () => {},\n setFocusedItemByVirtualIndex: () => {},\n },\n } as unknown as DSTreeviewT.InstanceRef;\n const treeRef = useRef(defaultActions);\n const {\n data,\n plugins,\n onOrderChange,\n isMultiSelect,\n isSingleSelect,\n instanceRef,\n selection,\n onInstanceRefInitialized,\n } = propsWithDefault;\n const [uniqueTreeViewUUID] = useState(uuidv4());\n const [hoverItem, setHoverItem] = useState<DSTreeviewT.Item | null>(null);\n const [latestToggledItem, setLatestToggledItem] = useState<DSTreeviewT.Item | null>(null);\n const [selectedItem, setSelectedItem] = useState<DSTreeviewT.Item | null>(null);\n const [focusedItem, setFocusedItem] = useState<DSTreeviewT.Item | null>(null);\n const [selectedCheckboxes, setSelectedCheckboxes] = useState({\n ...selection,\n });\n const [expandedGroups, setExpandedGroups] = useState<DSTreeviewT.ExpandedItems>({});\n const { visibleItems, flattenedItems, tree, treeRoot, triggerTreeRerender, updateUserExpandedState } = useTree(\n data,\n propsWithDefault,\n {\n setExpandedGroups,\n },\n );\n\n const virtualListRef = useRef<HTMLUListElement>();\n // estimateSize should not be really required given what was stated on\n // https://github.com/tannerlinsley/react-virtual/issues/23\n\n const virtualListHelpers = useVirtual({\n size: visibleItems.length,\n parentRef: virtualListRef,\n overscan: 15,\n });\n\n const withDragAndDrop = !!(plugins?.includes(TreeDndPlugin) && onOrderChange);\n const withRadioChecks = isSingleSelect && !isMultiSelect;\n const withCheckboxChecks = !isSingleSelect && isMultiSelect;\n\n const handleExpandGroup = useCallback(toggleItemExpand, []);\n\n const ctx: DSTreeviewInternalsT.CTX = useMemo(\n () => ({\n props: propsWithDefault,\n virtualListHelpers,\n virtualListRef,\n tree,\n treeRoot,\n visibleItems,\n flattenedItems,\n triggerTreeRerender,\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n uniqueTreeViewUUID,\n selectedCheckboxes,\n setSelectedCheckboxes,\n selectedItem,\n setSelectedItem,\n expandedGroups,\n setExpandedGroups,\n latestToggledItem,\n setLatestToggledItem,\n focusedItem,\n setFocusedItem,\n hoverItem,\n setHoverItem,\n handleExpandGroup,\n updateUserExpandedState,\n }),\n [\n propsWithDefault,\n virtualListHelpers,\n tree,\n treeRoot,\n visibleItems,\n flattenedItems,\n triggerTreeRerender,\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n uniqueTreeViewUUID,\n selectedCheckboxes,\n selectedItem,\n expandedGroups,\n latestToggledItem,\n focusedItem,\n hoverItem,\n handleExpandGroup,\n updateUserExpandedState,\n ],\n );\n // this hooks can't use the context because the context provider doesn't wrap this\n // as such we manually pass the second parameter as fit\n if (instanceRef) instanceRef.current = treeRef.current;\n useInstanceRefActions(treeRef.current, ctx);\n useGlobalToggleAllExpandShortcut(treeRoot, triggerTreeRerender, setLatestToggledItem, updateUserExpandedState);\n useNotifyExpandedChange(propsWithDefault, ctx);\n\n // this is an horrible hack.\n // this is required because there is no \"on rendered\" react-way to check if every children has finished rendering\n // this should be working for now, in the future we may want to review this for a better solution\n useEffect(() => {\n setTimeout(() => onInstanceRefInitialized(treeRef), 100);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => ({ ctx }), [ctx]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkE;AAClE,2BAA2B;AAC3B,8BAA6E;AAC7E,kBAA6B;AAE7B,mCAAkC;AAClC,6BAA6B;AAC7B,iBAA8B;AAC9B,qBAAwB;AACxB,mCAA0D;AAC1D,mCAAsC;AACtC,8BAAiD;AAM1C,MAAM,cAA4B,CAAC,UAAU;AAClD,QAAM,mBAAmB,0DAAgD,OAAO;AAChF,8DAAkD,kBAAkB;AACpE,QAAM,iBAAiB;AAAA,IACrB,SAAS;AAAA,MACP,iBAAiB,MAAM;AAAA;AAAA,MACvB,UAAU,MAAM;AAAA;AAAA,MAChB,+BAA+B,MAAM;AAAA;AAAA,MACrC,8BAA8B,MAAM;AAAA;AAAA;AAAA;AAGxC,QAAM,UAAU,yBAAO;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AACJ,QAAM,CAAC,sBAAsB,2BAAS;AACtC,QAAM,CAAC,WAAW,gBAAgB,2BAAkC;AACpE,QAAM,CAAC,mBAAmB,wBAAwB,2BAAkC;AACpF,QAAM,CAAC,cAAc,mBAAmB,2BAAkC;AAC1E,QAAM,CAAC,aAAa,kBAAkB,2BAAkC;AACxE,QAAM,CAAC,oBAAoB,yBAAyB,2BAAS;AAAA,OACxD;AAAA;AAEL,QAAM,CAAC,gBAAgB,qBAAqB,2BAAoC;AAChF,QAAM,EAAE,cAAc,gBAAgB,MAAM,UAAU,qBAAqB,4BAA4B,4BACrG,MACA,kBACA;AAAA,IACE;AAAA;AAIJ,QAAM,iBAAiB;AAIvB,QAAM,qBAAqB,qCAAW;AAAA,IACpC,MAAM,aAAa;AAAA,IACnB,WAAW;AAAA,IACX,UAAU;AAAA;AAGZ,QAAM,kBAAkB,CAAC,CAAE,UAAS,SAAS,6BAAkB;AAC/D,QAAM,kBAAkB,kBAAkB,CAAC;AAC3C,QAAM,qBAAqB,CAAC,kBAAkB;AAE9C,QAAM,oBAAoB,8BAAY,+CAAkB;AAExD,QAAM,MAAgC,0BACpC,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKJ,MAAI;AAAa,gBAAY,UAAU,QAAQ;AAC/C,0DAAsB,QAAQ,SAAS;AACvC,gEAAiC,UAAU,qBAAqB,sBAAsB;AACtF,4DAAwB,kBAAkB;AAK1C,8BAAU,MAAM;AACd,eAAW,MAAM,yBAAyB,UAAU;AAAA,KAEnD;AAEH,SAAO,0BAAQ,MAAO,GAAE,QAAQ,CAAC;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DnDTreeContext_exports = {};
|
|
29
|
-
__export(DnDTreeContext_exports, {
|
|
30
|
-
DnDTreeContext: () => DnDTreeContext
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_SortableItemContext = require("./SortableItemContext");
|
|
35
|
-
const DnDTreeContext = (0, import_react.createContext)({
|
|
36
|
-
depth: void 0,
|
|
37
|
-
activeIndex: void 0,
|
|
38
|
-
visibleItems: void 0,
|
|
39
|
-
dropIndicatorPosition: import_SortableItemContext.DropIndicatorPosition.None,
|
|
40
|
-
lastActiveId: void 0,
|
|
41
|
-
setLastActiveId: void 0,
|
|
42
|
-
isDropValid: false
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(DnDTreeContext_exports);
|
|
45
|
-
//# sourceMappingURL=DnDTreeContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hoc/DnDTreeContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react';\nimport { DSTreeviewT } from '../react-desc-prop-types';\nimport { DropIndicatorPosition } from './SortableItemContext';\n\ntype DnDTreeContextType = {\n depth: number | undefined;\n activeIndex: number | undefined;\n visibleItems: DSTreeviewT.Item[] | undefined;\n dropIndicatorPosition: DropIndicatorPosition;\n lastActiveId: string | undefined;\n setLastActiveId: React.Dispatch<React.SetStateAction<string>> | undefined;\n isDropValid: boolean;\n};\n\nexport const DnDTreeContext = createContext<DnDTreeContextType>({\n depth: undefined,\n activeIndex: undefined,\n visibleItems: undefined,\n dropIndicatorPosition: DropIndicatorPosition.None,\n lastActiveId: undefined,\n setLastActiveId: undefined,\n isDropValid: false,\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAE9B,iCAAsC;AAY/B,MAAM,iBAAiB,gCAAkC;AAAA,EAC9D,OAAO;AAAA,EACP,aAAa;AAAA,EACb,cAAc;AAAA,EACd,uBAAuB,iDAAsB;AAAA,EAC7C,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,aAAa;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SortableItemContext_exports = {};
|
|
29
|
-
__export(SortableItemContext_exports, {
|
|
30
|
-
DropIndicatorPosition: () => DropIndicatorPosition,
|
|
31
|
-
SortableItemContext: () => SortableItemContext
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var DropIndicatorPosition = /* @__PURE__ */ ((DropIndicatorPosition2) => {
|
|
36
|
-
DropIndicatorPosition2[DropIndicatorPosition2["None"] = 0] = "None";
|
|
37
|
-
DropIndicatorPosition2[DropIndicatorPosition2["Before"] = 1] = "Before";
|
|
38
|
-
DropIndicatorPosition2[DropIndicatorPosition2["After"] = 2] = "After";
|
|
39
|
-
DropIndicatorPosition2[DropIndicatorPosition2["Inside"] = 3] = "Inside";
|
|
40
|
-
return DropIndicatorPosition2;
|
|
41
|
-
})(DropIndicatorPosition || {});
|
|
42
|
-
const SortableItemContext = (0, import_react.createContext)({
|
|
43
|
-
draggableProps: false
|
|
44
|
-
});
|
|
45
|
-
module.exports = __toCommonJS(SortableItemContext_exports);
|
|
46
|
-
//# sourceMappingURL=SortableItemContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hoc/SortableItemContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useSortable } from '@dnd-kit/sortable';\nimport { createContext } from 'react';\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport type SortableItemContextType = {\n draggableProps:\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n isDropValid: boolean;\n });\n};\n\n/** Context for cross component communication */\nexport const SortableItemContext = createContext<SortableItemContextType>({\n draggableProps: false,\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA8B;AAEvB,IAAK,wBAAL,kBAAK,2BAAL;AACL,0DAAO,KAAP;AACA,4DAAS,KAAT;AACA,2DAAQ,KAAR;AACA,4DAAS,KAAT;AAJU;AAAA;AAoBL,MAAM,sBAAsB,gCAAuC;AAAA,EACxE,gBAAgB;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var WithConditionalDnDContext_exports = {};
|
|
29
|
-
__export(WithConditionalDnDContext_exports, {
|
|
30
|
-
withConditionalDnDRowContext: () => withConditionalDnDRowContext
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_core = require("@dnd-kit/core");
|
|
35
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
36
|
-
var import_ds_drag_and_drop = require("@elliemae/ds-drag-and-drop");
|
|
37
|
-
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
38
|
-
var import_TreeItem = require("../parts/TreeItem");
|
|
39
|
-
var import_DnDTreeContext = require("./DnDTreeContext");
|
|
40
|
-
const ensure = (argument, message = "This should never happen") => {
|
|
41
|
-
if (argument === void 0 || argument === null) {
|
|
42
|
-
throw new TypeError(message);
|
|
43
|
-
}
|
|
44
|
-
return argument;
|
|
45
|
-
};
|
|
46
|
-
const withConditionalDnDRowContext = (Component) => (props) => {
|
|
47
|
-
const [lastActiveId, setLastActiveId] = import_react.default.useState("");
|
|
48
|
-
const {
|
|
49
|
-
props: { data, onOrderChange, getIsDropValid },
|
|
50
|
-
flattenedItems,
|
|
51
|
-
visibleItems: flattenedVisibleTree,
|
|
52
|
-
withDragAndDrop
|
|
53
|
-
} = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
54
|
-
const flattenedVisibleTreeForDnD = (0, import_react.useMemo)(() => flattenedVisibleTree.map((item, index) => ({
|
|
55
|
-
uid: item.id.toString(),
|
|
56
|
-
depth: (item.treeDepth ?? 1) - 1,
|
|
57
|
-
realIndex: index,
|
|
58
|
-
childrenCount: item.children?.length ?? 0,
|
|
59
|
-
parentId: item.node.parent?.model?.id?.toString() ?? null,
|
|
60
|
-
original: item
|
|
61
|
-
})), [flattenedVisibleTree]);
|
|
62
|
-
const onReorder = (0, import_react.useCallback)((tree, indexes) => {
|
|
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 (item.parentId !== null && item.parentId !== void 0 && item.parentId !== "__ds_tree_root") {
|
|
72
|
-
const parentNode = nodes[item.parentId];
|
|
73
|
-
parentNode.children?.push(item.original);
|
|
74
|
-
} else if (item.uid !== "__ds_tree_root")
|
|
75
|
-
newUserTree.push(item.original);
|
|
76
|
-
});
|
|
77
|
-
onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);
|
|
78
|
-
}, [onOrderChange, data, flattenedItems]);
|
|
79
|
-
const {
|
|
80
|
-
dndContextProps,
|
|
81
|
-
sortableContextProps,
|
|
82
|
-
activeId,
|
|
83
|
-
activeIndex,
|
|
84
|
-
depth,
|
|
85
|
-
dropIndicatorPosition,
|
|
86
|
-
visibleItems,
|
|
87
|
-
isDropValid
|
|
88
|
-
} = (0, import_ds_drag_and_drop.useTreeDndkitConfig)({
|
|
89
|
-
flattenedItems,
|
|
90
|
-
visibleItems: flattenedVisibleTreeForDnD,
|
|
91
|
-
isHorizontalDnD: false,
|
|
92
|
-
isExpandable: true,
|
|
93
|
-
onReorder,
|
|
94
|
-
getIsDropValid,
|
|
95
|
-
maxDragAndDropLevel: Infinity
|
|
96
|
-
});
|
|
97
|
-
if (lastActiveId !== activeId && activeId)
|
|
98
|
-
setLastActiveId(activeId);
|
|
99
|
-
if (withDragAndDrop)
|
|
100
|
-
return /* @__PURE__ */ import_react.default.createElement(import_core.DndContext, {
|
|
101
|
-
...dndContextProps
|
|
102
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_sortable.SortableContext, {
|
|
103
|
-
...sortableContextProps
|
|
104
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_DnDTreeContext.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
|
-
}, /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
115
|
-
...props
|
|
116
|
-
}))), /* @__PURE__ */ import_react.default.createElement(import_core.DragOverlay, {
|
|
117
|
-
style: { width: "auto" }
|
|
118
|
-
}, activeId ? /* @__PURE__ */ import_react.default.createElement(import_TreeItem.TreeItem, {
|
|
119
|
-
itemIndex: activeIndex,
|
|
120
|
-
item: ensure(flattenedVisibleTree.find((item) => item.id.toString() === activeId)),
|
|
121
|
-
isDragOverlay: true
|
|
122
|
-
}) : null));
|
|
123
|
-
return /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
124
|
-
...props
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
module.exports = __toCommonJS(WithConditionalDnDContext_exports);
|
|
128
|
-
//# sourceMappingURL=WithConditionalDnDContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hoc/WithConditionalDnDContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useContext, useMemo } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { SortableContext } from '@dnd-kit/sortable';\nimport { useTreeDndkitConfig } from '@elliemae/ds-drag-and-drop';\nimport { DSTreeviewT } from '../react-desc-prop-types';\nimport TreeViewContext from '../TreeViewContext';\nimport { TreeItem } from '../parts/TreeItem';\nimport { DnDTreeContext } from './DnDTreeContext';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nconst ensure = <T,>(argument: T | undefined | null, message = 'This should never happen'): T => {\n if (argument === undefined || argument === null) {\n throw new TypeError(message);\n }\n\n return argument;\n};\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const [lastActiveId, setLastActiveId] = React.useState('');\n\n const {\n props: { data, onOrderChange, getIsDropValid },\n flattenedItems,\n visibleItems: flattenedVisibleTree,\n withDragAndDrop,\n } = useContext(TreeViewContext);\n\n const flattenedVisibleTreeForDnD = useMemo(\n () =>\n flattenedVisibleTree.map((item, index) => ({\n uid: item.id.toString(),\n depth: (item.treeDepth ?? 1) - 1,\n realIndex: index,\n childrenCount: item.children?.length ?? 0,\n parentId: item.node.parent?.model?.id?.toString() ?? null,\n original: item,\n })),\n [flattenedVisibleTree],\n );\n\n const onReorder = useCallback(\n (tree: DSTreeviewT.DndItem[], indexes: { targetIndex: number; fromIndex: number }) => {\n // Pull the row's original data into an object\n const nodes: Record<DSTreeviewT.StringOrNum, DSTreeviewT.SimpleItem> = {};\n tree.forEach((item) => {\n const originalItem = item.original;\n originalItem.children = [];\n nodes[item.uid] = item.original;\n });\n\n const newUserTree: DSTreeviewT.SimpleItem[] = [];\n tree.forEach((item) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (item.parentId !== null && item.parentId !== undefined && item.parentId !== '__ds_tree_root') {\n const parentNode = nodes[item.parentId];\n parentNode.children?.push(item.original);\n } else if (item.uid !== '__ds_tree_root') newUserTree.push(item.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onOrderChange(newUserTree, data, flattenedItems[indexes.fromIndex]);\n },\n [onOrderChange, data, flattenedItems],\n );\n\n const {\n dndContextProps,\n sortableContextProps,\n activeId,\n activeIndex,\n depth,\n dropIndicatorPosition,\n visibleItems,\n isDropValid,\n } = useTreeDndkitConfig({\n flattenedItems,\n visibleItems: flattenedVisibleTreeForDnD,\n isHorizontalDnD: false,\n isExpandable: true,\n onReorder,\n getIsDropValid,\n maxDragAndDropLevel: Infinity,\n });\n\n if (lastActiveId !== activeId && activeId) setLastActiveId(activeId);\n\n if (withDragAndDrop)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...sortableContextProps}>\n <DnDTreeContext.Provider\n value={{\n activeIndex,\n depth,\n visibleItems: visibleItems.map((item) => item.original) as DSTreeviewT.Item[],\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n }}\n >\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n <DragOverlay style={{ width: 'auto' }}>\n {activeId ? (\n <TreeItem\n itemIndex={activeIndex}\n item={ensure(flattenedVisibleTree.find((item) => item.id.toString() === activeId))}\n isDragOverlay\n />\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwD;AACxD,kBAAwC;AACxC,sBAAgC;AAChC,8BAAoC;AAEpC,6BAA4B;AAC5B,sBAAyB;AACzB,4BAA+B;AAI/B,MAAM,SAAS,CAAK,UAAgC,UAAU,+BAAkC;AAC9F,MAAI,aAAa,UAAa,aAAa,MAAM;AAC/C,UAAM,IAAI,UAAU;AAAA;AAGtB,SAAO;AAAA;AAIF,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,CAAC,cAAc,mBAAmB,qBAAM,SAAS;AAEvD,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM,eAAe;AAAA,IAC9B;AAAA,IACA,cAAc;AAAA,IACd;AAAA,MACE,6BAAW;AAEf,QAAM,6BAA6B,0BACjC,MACE,qBAAqB,IAAI,CAAC,MAAM,UAAW;AAAA,IACzC,KAAK,KAAK,GAAG;AAAA,IACb,OAAQ,MAAK,aAAa,KAAK;AAAA,IAC/B,WAAW;AAAA,IACX,eAAe,KAAK,UAAU,UAAU;AAAA,IACxC,UAAU,KAAK,KAAK,QAAQ,OAAO,IAAI,cAAc;AAAA,IACrD,UAAU;AAAA,OAEd,CAAC;AAGH,QAAM,YAAY,8BAChB,CAAC,MAA6B,YAAwD;AAEpF,UAAM,QAAiE;AACvE,SAAK,QAAQ,CAAC,SAAS;AACrB,YAAM,eAAe,KAAK;AAC1B,mBAAa,WAAW;AACxB,YAAM,KAAK,OAAO,KAAK;AAAA;AAGzB,UAAM,cAAwC;AAC9C,SAAK,QAAQ,CAAC,SAAS;AAGrB,UAAI,KAAK,aAAa,QAAQ,KAAK,aAAa,UAAa,KAAK,aAAa,kBAAkB;AAC/F,cAAM,aAAa,MAAM,KAAK;AAC9B,mBAAW,UAAU,KAAK,KAAK;AAAA,iBACtB,KAAK,QAAQ;AAAkB,oBAAY,KAAK,KAAK;AAAA;AAGlE,kBAAc,aAAa,MAAM,eAAe,QAAQ;AAAA,KAE1D,CAAC,eAAe,MAAM;AAGxB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,iDAAoB;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA;AAGvB,MAAI,iBAAiB,YAAY;AAAU,oBAAgB;AAE3D,MAAI;AACF,WACE,mDAAC,wBAAD;AAAA,SAAgB;AAAA,OACd,mDAAC,iCAAD;AAAA,SAAqB;AAAA,OACnB,mDAAC,qCAAe,UAAhB;AAAA,MACE,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,cAAc,aAAa,IAAI,CAAC,SAAS,KAAK;AAAA,QAC9C;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,OAGF,mDAAC,WAAD;AAAA,SAAe;AAAA,UAGnB,mDAAC,yBAAD;AAAA,MAAa,OAAO,EAAE,OAAO;AAAA,OAC1B,WACC,mDAAC,0BAAD;AAAA,MACE,WAAW;AAAA,MACX,MAAM,OAAO,qBAAqB,KAAK,CAAC,SAAS,KAAK,GAAG,eAAe;AAAA,MACxE,eAAa;AAAA,SAEb;AAIZ,SAAO,mDAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var WithDnDSortableItemContext_exports = {};
|
|
29
|
-
__export(WithDnDSortableItemContext_exports, {
|
|
30
|
-
withDnDSortableItemContext: () => withDnDSortableItemContext
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
35
|
-
var import_SortableItemContext = require("./SortableItemContext");
|
|
36
|
-
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
37
|
-
var import_DnDTreeContext = require("./DnDTreeContext");
|
|
38
|
-
const withDnDSortableItemContext = (Component) => (props) => {
|
|
39
|
-
const { withDragAndDrop } = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
40
|
-
const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = (0, import_react.useContext)(import_DnDTreeContext.DnDTreeContext);
|
|
41
|
-
const id = props.item.id.toString();
|
|
42
|
-
const draggableOptions = (0, import_react.useMemo)(() => ({
|
|
43
|
-
id
|
|
44
|
-
}), [id]);
|
|
45
|
-
const useSortableHelpers = (0, import_sortable.useSortable)(draggableOptions);
|
|
46
|
-
const draggableProps = (0, import_react.useMemo)(() => {
|
|
47
|
-
if (!withDragAndDrop)
|
|
48
|
-
return false;
|
|
49
|
-
const { index, overIndex } = useSortableHelpers;
|
|
50
|
-
return {
|
|
51
|
-
...useSortableHelpers,
|
|
52
|
-
shouldShowDropIndicatorPosition: overIndex === index,
|
|
53
|
-
dropIndicatorPosition,
|
|
54
|
-
lastActiveId,
|
|
55
|
-
setLastActiveId,
|
|
56
|
-
isDropValid
|
|
57
|
-
};
|
|
58
|
-
}, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);
|
|
59
|
-
const ctx = (0, import_react.useMemo)(() => ({
|
|
60
|
-
draggableProps
|
|
61
|
-
}), [draggableProps]);
|
|
62
|
-
return /* @__PURE__ */ import_react.default.createElement(import_SortableItemContext.SortableItemContext.Provider, {
|
|
63
|
-
value: ctx
|
|
64
|
-
}, /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
65
|
-
...props
|
|
66
|
-
}));
|
|
67
|
-
};
|
|
68
|
-
module.exports = __toCommonJS(WithDnDSortableItemContext_exports);
|
|
69
|
-
//# sourceMappingURL=WithDnDSortableItemContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hoc/WithDnDSortableItemContext.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { SortableItemContext, SortableItemContextType } from './SortableItemContext';\nimport TreeViewContext from '../TreeViewContext';\nimport { DnDTreeContext } from './DnDTreeContext';\nimport { DSTreeviewT } from '../react-desc-prop-types';\n\ntype FunctionalHOC = <T = unknown>(Component: React.ComponentType<T>, ...other: unknown[]) => (props: T) => JSX.Element;\n\nexport const withDnDSortableItemContext: FunctionalHOC = (Component) => (props: any) => {\n const { withDragAndDrop } = useContext(TreeViewContext);\n const { dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid } = useContext(DnDTreeContext);\n\n const id = (props as { item: DSTreeviewT.Item }).item.id.toString();\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id,\n }),\n [id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!withDragAndDrop) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n lastActiveId,\n setLastActiveId,\n isDropValid,\n };\n }, [withDragAndDrop, useSortableHelpers, dropIndicatorPosition, lastActiveId, setLastActiveId, isDropValid]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAA2C;AAC3C,sBAA4B;AAC5B,iCAA6D;AAC7D,6BAA4B;AAC5B,4BAA+B;AAKxB,MAAM,6BAA4C,CAAC,cAAc,CAAC,UAAe;AACtF,QAAM,EAAE,oBAAoB,6BAAW;AACvC,QAAM,EAAE,uBAAuB,cAAc,iBAAiB,gBAAgB,6BAAW;AAEzF,QAAM,KAAM,MAAqC,KAAK,GAAG;AAGzD,QAAM,mBAAmB,0BACvB,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,QAAM,qBAAqB,iCAAY;AAGvC,QAAM,iBAAiB,0BAAQ,MAAM;AACnC,QAAI,CAAC;AAAiB,aAAO;AAE7B,UAAM,EAAE,OAAO,cAAc;AAE7B,WAAO;AAAA,SACF;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,KAED,CAAC,iBAAiB,oBAAoB,uBAAuB,cAAc,iBAAiB;AAK/F,QAAM,MAA+B,0BACnC,MAAO;AAAA,IACL;AAAA,MAEF,CAAC;AAGH,SACE,mDAAC,+CAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KACnC,mDAAC,WAAD;AAAA,OAAe;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
TreeViewSearchBar: () => import_TreeViewSearchBar.TreeViewSearchBar
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./TreeView"));
|
|
34
|
-
__reExport(src_exports, require("./plugins"));
|
|
35
|
-
var import_TreeViewSearchBar = require("./related-components/TreeViewSearchBar");
|
|
36
|
-
module.exports = __toCommonJS(src_exports);
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './TreeView';\nexport * from './plugins';\n\nexport { TreeViewSearchBar } from './related-components/TreeViewSearchBar';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AAEd,+BAAkC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|