@elliemae/ds-treeview 2.3.0-alpha.1 → 2.3.0-alpha.6
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 → dist/cjs}/TreeView.js +1 -3
- package/dist/cjs/TreeView.js.map +7 -0
- package/{cjs → dist/cjs}/TreeViewContext.js +2 -8
- package/dist/cjs/TreeViewContext.js.map +7 -0
- package/{cjs → dist/cjs}/config/cssClassesConstants.js +0 -0
- package/{cjs → dist/cjs}/config/cssClassesConstants.js.map +0 -0
- package/{cjs → dist/cjs}/config/useTreeview.js +14 -28
- 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 +128 -0
- package/dist/cjs/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js +69 -0
- package/dist/cjs/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/{cjs → dist/cjs}/index.js +0 -0
- package/{cjs → dist/cjs}/index.js.map +0 -0
- package/{cjs → dist/cjs}/parts/CheckboxSelectable.js +0 -0
- package/{cjs → dist/cjs}/parts/CheckboxSelectable.js.map +0 -0
- package/{cjs → dist/cjs}/parts/ChildrenCountDisplayer.js +0 -0
- package/{cjs → dist/cjs}/parts/ChildrenCountDisplayer.js.map +0 -0
- package/dist/cjs/parts/DnDHandle.js +57 -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/{cjs → dist/cjs}/parts/ExpandCaret.js +0 -0
- package/{cjs → dist/cjs}/parts/ExpandCaret.js.map +0 -0
- package/{cjs → dist/cjs}/parts/Icon.js +0 -0
- package/{cjs → dist/cjs}/parts/Icon.js.map +0 -0
- package/{cjs → dist/cjs}/parts/NestingSpace.js +0 -0
- package/{cjs → dist/cjs}/parts/NestingSpace.js.map +0 -0
- package/{cjs → dist/cjs}/parts/RadioSelectable.js +0 -0
- package/{cjs → dist/cjs}/parts/RadioSelectable.js.map +0 -0
- package/{cjs → dist/cjs}/parts/TreeItem.js +37 -62
- package/dist/cjs/parts/TreeItem.js.map +7 -0
- package/{cjs → dist/cjs}/parts/TreeItemText.js +0 -0
- package/{cjs → dist/cjs}/parts/TreeItemText.js.map +0 -0
- package/{cjs → dist/cjs}/parts/TreeList.js +13 -18
- 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/{cjs → dist/cjs}/plugins/dnd/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/dnd/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/roving/TreeRovingPlugin.js +0 -0
- package/{cjs → dist/cjs}/plugins/roving/TreeRovingPlugin.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/roving/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/roving/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/searchable/SearchableTreePlugin.js +0 -0
- package/{cjs → dist/cjs}/plugins/searchable/SearchableTreePlugin.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/searchable/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/searchable/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/selectable/SelectablePluginTree.js +0 -0
- package/{cjs → dist/cjs}/plugins/selectable/SelectablePluginTree.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/selectable/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/selectable/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/toolbar/TreeToolbarPlugin.js +0 -0
- package/{cjs → dist/cjs}/plugins/toolbar/TreeToolbarPlugin.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/toolbar/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/toolbar/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/tree/TreeDataPlugin.js +0 -0
- package/{cjs → dist/cjs}/plugins/tree/TreeDataPlugin.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/tree/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/tree/index.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/virtualization/TreeVirtualizationPlugin.js +0 -0
- package/{cjs → dist/cjs}/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -0
- package/{cjs → dist/cjs}/plugins/virtualization/index.js +0 -0
- package/{cjs → dist/cjs}/plugins/virtualization/index.js.map +0 -0
- package/{cjs → dist/cjs}/react-desc-prop-types.js +1 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/{cjs → dist/cjs}/related-components/TreeViewSearchBar.js +0 -0
- package/{cjs → dist/cjs}/related-components/TreeViewSearchBar.js.map +0 -0
- package/{cjs → dist/cjs}/sharedTypes.js +0 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/{cjs → dist/cjs}/utils/array-helpers.js +0 -0
- package/{cjs → dist/cjs}/utils/array-helpers.js.map +0 -0
- package/{cjs → dist/cjs}/utils/group-expands-helpers.js +0 -0
- package/{cjs → dist/cjs}/utils/group-expands-helpers.js.map +0 -0
- package/{cjs → dist/cjs}/utils/keyboard-helpers.js +7 -7
- package/dist/cjs/utils/keyboard-helpers.js.map +7 -0
- package/{cjs → dist/cjs}/utils/object-helpers.js +0 -0
- package/{cjs → dist/cjs}/utils/object-helpers.js.map +0 -0
- package/{cjs → dist/cjs}/utils/refs-helpers.js +0 -0
- package/{cjs → dist/cjs}/utils/refs-helpers.js.map +1 -1
- package/{cjs → dist/cjs}/utils/selectable-helper.js +0 -0
- package/{cjs → dist/cjs}/utils/selectable-helper.js.map +0 -0
- package/{cjs → dist/cjs}/utils/string-helpers.js +0 -0
- package/{cjs → dist/cjs}/utils/string-helpers.js.map +0 -0
- package/{cjs → dist/cjs}/utils/tree-helpers.js +21 -1
- package/{cjs → dist/cjs}/utils/tree-helpers.js.map +2 -2
- package/{cjs → dist/cjs}/utils/useInstanceRefActions.js +0 -0
- package/{cjs → dist/cjs}/utils/useInstanceRefActions.js.map +0 -0
- package/{cjs → dist/cjs}/utils/useTree.js +3 -1
- package/dist/cjs/utils/useTree.js.map +7 -0
- package/{esm → dist/esm}/TreeView.js +1 -3
- package/dist/esm/TreeView.js.map +7 -0
- package/{esm → dist/esm}/TreeViewContext.js +2 -8
- package/dist/esm/TreeViewContext.js.map +7 -0
- package/{esm → dist/esm}/config/cssClassesConstants.js +0 -0
- package/{esm → dist/esm}/config/cssClassesConstants.js.map +0 -0
- package/{esm → dist/esm}/config/useTreeview.js +15 -29
- 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 +99 -0
- package/dist/esm/hoc/WithConditionalDnDContext.js.map +7 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js +40 -0
- package/dist/esm/hoc/WithDnDSortableItemContext.js.map +7 -0
- package/{esm → dist/esm}/index.js +0 -0
- package/{esm → dist/esm}/index.js.map +0 -0
- package/{esm → dist/esm}/parts/CheckboxSelectable.js +0 -0
- package/{esm → dist/esm}/parts/CheckboxSelectable.js.map +0 -0
- package/{esm → dist/esm}/parts/ChildrenCountDisplayer.js +0 -0
- package/{esm → dist/esm}/parts/ChildrenCountDisplayer.js.map +0 -0
- package/dist/esm/parts/DnDHandle.js +28 -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/{esm → dist/esm}/parts/ExpandCaret.js +0 -0
- package/{esm → dist/esm}/parts/ExpandCaret.js.map +0 -0
- package/{esm → dist/esm}/parts/Icon.js +0 -0
- package/{esm → dist/esm}/parts/Icon.js.map +0 -0
- package/{esm → dist/esm}/parts/NestingSpace.js +0 -0
- package/{esm → dist/esm}/parts/NestingSpace.js.map +0 -0
- package/{esm → dist/esm}/parts/RadioSelectable.js +0 -0
- package/{esm → dist/esm}/parts/RadioSelectable.js.map +0 -0
- package/{esm → dist/esm}/parts/TreeItem.js +37 -62
- package/dist/esm/parts/TreeItem.js.map +7 -0
- package/{esm → dist/esm}/parts/TreeItemText.js +0 -0
- package/{esm → dist/esm}/parts/TreeItemText.js.map +0 -0
- package/{esm → dist/esm}/parts/TreeList.js +12 -17
- 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/{esm → dist/esm}/plugins/dnd/index.js +0 -0
- package/{esm → dist/esm}/plugins/dnd/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/index.js +0 -0
- package/{esm → dist/esm}/plugins/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/roving/TreeRovingPlugin.js +0 -0
- package/{esm → dist/esm}/plugins/roving/TreeRovingPlugin.js.map +0 -0
- package/{esm → dist/esm}/plugins/roving/index.js +0 -0
- package/{esm → dist/esm}/plugins/roving/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/searchable/SearchableTreePlugin.js +0 -0
- package/{esm → dist/esm}/plugins/searchable/SearchableTreePlugin.js.map +0 -0
- package/{esm → dist/esm}/plugins/searchable/index.js +0 -0
- package/{esm → dist/esm}/plugins/searchable/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/selectable/SelectablePluginTree.js +0 -0
- package/{esm → dist/esm}/plugins/selectable/SelectablePluginTree.js.map +0 -0
- package/{esm → dist/esm}/plugins/selectable/index.js +0 -0
- package/{esm → dist/esm}/plugins/selectable/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/toolbar/TreeToolbarPlugin.js +0 -0
- package/{esm → dist/esm}/plugins/toolbar/TreeToolbarPlugin.js.map +0 -0
- package/{esm → dist/esm}/plugins/toolbar/index.js +0 -0
- package/{esm → dist/esm}/plugins/toolbar/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/tree/TreeDataPlugin.js +0 -0
- package/{esm → dist/esm}/plugins/tree/TreeDataPlugin.js.map +0 -0
- package/{esm → dist/esm}/plugins/tree/index.js +0 -0
- package/{esm → dist/esm}/plugins/tree/index.js.map +0 -0
- package/{esm → dist/esm}/plugins/virtualization/TreeVirtualizationPlugin.js +0 -0
- package/{esm → dist/esm}/plugins/virtualization/TreeVirtualizationPlugin.js.map +0 -0
- package/{esm → dist/esm}/plugins/virtualization/index.js +0 -0
- package/{esm → dist/esm}/plugins/virtualization/index.js.map +0 -0
- package/{esm → dist/esm}/react-desc-prop-types.js +1 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/{esm → dist/esm}/related-components/TreeViewSearchBar.js +0 -0
- package/{esm → dist/esm}/related-components/TreeViewSearchBar.js.map +0 -0
- package/{esm → dist/esm}/sharedTypes.js +0 -0
- package/{esm → dist/esm}/sharedTypes.js.map +0 -0
- package/{esm → dist/esm}/utils/array-helpers.js +0 -0
- package/{esm → dist/esm}/utils/array-helpers.js.map +0 -0
- package/{esm → dist/esm}/utils/group-expands-helpers.js +0 -0
- package/{esm → dist/esm}/utils/group-expands-helpers.js.map +0 -0
- package/{esm → dist/esm}/utils/keyboard-helpers.js +7 -7
- package/dist/esm/utils/keyboard-helpers.js.map +7 -0
- package/{esm → dist/esm}/utils/object-helpers.js +0 -0
- package/{esm → dist/esm}/utils/object-helpers.js.map +0 -0
- package/{esm → dist/esm}/utils/refs-helpers.js +0 -0
- package/{esm → dist/esm}/utils/refs-helpers.js.map +1 -1
- package/{esm → dist/esm}/utils/selectable-helper.js +0 -0
- package/{esm → dist/esm}/utils/selectable-helper.js.map +0 -0
- package/{esm → dist/esm}/utils/string-helpers.js +0 -0
- package/{esm → dist/esm}/utils/string-helpers.js.map +0 -0
- package/{esm → dist/esm}/utils/tree-helpers.js +21 -1
- package/{esm → dist/esm}/utils/tree-helpers.js.map +2 -2
- package/{esm → dist/esm}/utils/useInstanceRefActions.js +0 -0
- package/{esm → dist/esm}/utils/useInstanceRefActions.js.map +0 -0
- package/{esm → dist/esm}/utils/useTree.js +4 -2
- package/dist/esm/utils/useTree.js.map +7 -0
- package/package.json +136 -117
- package/cjs/TreeView.js.map +0 -7
- package/cjs/TreeViewContext.js.map +0 -7
- package/cjs/config/useTreeview.js.map +0 -7
- package/cjs/parts/TreeItem.js.map +0 -7
- package/cjs/parts/TreeList.js.map +0 -7
- package/cjs/plugins/dnd/TreeDndPlugin.js +0 -59
- package/cjs/plugins/dnd/TreeDndPlugin.js.map +0 -7
- package/cjs/react-desc-prop-types.js.map +0 -7
- package/cjs/sharedTypes.js.map +0 -7
- package/cjs/utils/dnd-helpers.js +0 -146
- package/cjs/utils/dnd-helpers.js.map +0 -7
- package/cjs/utils/keyboard-helpers.js.map +0 -7
- package/cjs/utils/useDnDHelpers.js +0 -199
- package/cjs/utils/useDnDHelpers.js.map +0 -7
- package/cjs/utils/useTree.js.map +0 -7
- package/esm/TreeView.js.map +0 -7
- package/esm/TreeViewContext.js.map +0 -7
- package/esm/config/useTreeview.js.map +0 -7
- package/esm/parts/TreeItem.js.map +0 -7
- package/esm/parts/TreeList.js.map +0 -7
- package/esm/plugins/dnd/TreeDndPlugin.js +0 -30
- package/esm/plugins/dnd/TreeDndPlugin.js.map +0 -7
- package/esm/react-desc-prop-types.js.map +0 -7
- package/esm/utils/dnd-helpers.js +0 -117
- package/esm/utils/dnd-helpers.js.map +0 -7
- package/esm/utils/keyboard-helpers.js.map +0 -7
- package/esm/utils/useDnDHelpers.js +0 -170
- package/esm/utils/useDnDHelpers.js.map +0 -7
- package/esm/utils/useTree.js.map +0 -7
- 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/index.d.ts +0 -3
- package/types/parts/CheckboxSelectable.d.ts +0 -8
- package/types/parts/ChildrenCountDisplayer.d.ts +0 -7
- 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 -24
- package/types/parts/TreeItemText.d.ts +0 -7
- package/types/parts/TreeList.d.ts +0 -24
- package/types/plugins/dnd/TreeDndPlugin.d.ts +0 -3
- 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 -196
- package/types/related-components/TreeViewSearchBar.d.ts +0 -16
- package/types/sharedTypes.d.ts +0 -54
- package/types/utils/array-helpers.d.ts +0 -2
- package/types/utils/dnd-helpers.d.ts +0 -39
- package/types/utils/group-expands-helpers.d.ts +0 -14
- package/types/utils/keyboard-helpers.d.ts +0 -5
- 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 -25
- package/types/utils/useDnDHelpers.d.ts +0 -26
- package/types/utils/useInstanceRefActions.d.ts +0 -3
- package/types/utils/useTree.d.ts +0 -13
|
@@ -0,0 +1,80 @@
|
|
|
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 DropIndicator_exports = {};
|
|
29
|
+
__export(DropIndicator_exports, {
|
|
30
|
+
default: () => DropIndicator_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
35
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
36
|
+
const getPositionStyles = ({ dropIndicatorPosition }) => `
|
|
37
|
+
top: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "0" : "unset"};
|
|
38
|
+
bottom: ${dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "0" : "unset"};
|
|
39
|
+
left: -2px;
|
|
40
|
+
`;
|
|
41
|
+
const getCircleStyles = ({ dropIndicatorPosition }) => ({
|
|
42
|
+
position: "absolute",
|
|
43
|
+
zIndex: 20,
|
|
44
|
+
top: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.After ? "unset" : "-2px",
|
|
45
|
+
bottom: dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Before ? "unset" : "-2px",
|
|
46
|
+
left: "0px",
|
|
47
|
+
opacity: 1
|
|
48
|
+
});
|
|
49
|
+
const StyledIndicator = import_styled_components.default.div`
|
|
50
|
+
position: absolute;
|
|
51
|
+
${getPositionStyles}
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
width: ${(props) => props.vertical ? "2px" : "100%"};
|
|
54
|
+
height: ${(props) => props.vertical ? "100%" : "2px"};
|
|
55
|
+
background-color: ${({ isDropValid, theme }) => isDropValid ? theme.colors.brand[600] : theme.colors.danger[900]};
|
|
56
|
+
z-index: 20;
|
|
57
|
+
`;
|
|
58
|
+
const CircleIndicator = (style, isDropValid) => /* @__PURE__ */ import_react.default.createElement("svg", {
|
|
59
|
+
height: "6",
|
|
60
|
+
width: "6",
|
|
61
|
+
style
|
|
62
|
+
}, /* @__PURE__ */ import_react.default.createElement("circle", {
|
|
63
|
+
cx: "3",
|
|
64
|
+
cy: "3",
|
|
65
|
+
r: "3",
|
|
66
|
+
strokeWidth: "0",
|
|
67
|
+
fill: isDropValid ? "#1E79C2" : "#C64252"
|
|
68
|
+
}));
|
|
69
|
+
const DropIndicator = ({ dropIndicatorPosition, isLast, isDropValid }) => {
|
|
70
|
+
if (![import_SortableItemContext.DropIndicatorPosition.After, import_SortableItemContext.DropIndicatorPosition.Before].includes(dropIndicatorPosition))
|
|
71
|
+
return null;
|
|
72
|
+
const safeDropIndicatorPosition = isLast ? import_SortableItemContext.DropIndicatorPosition.Before : dropIndicatorPosition;
|
|
73
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid), /* @__PURE__ */ import_react.default.createElement(StyledIndicator, {
|
|
74
|
+
dropIndicatorPosition: safeDropIndicatorPosition,
|
|
75
|
+
isDropValid
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
var DropIndicator_default = DropIndicator;
|
|
79
|
+
module.exports = __toCommonJS(DropIndicator_exports);
|
|
80
|
+
//# sourceMappingURL=DropIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/DropIndicator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport styled from 'styled-components';\nimport { DropIndicatorPosition } from '../hoc/SortableItemContext';\n\ninterface DropIndicatorProps {\n vertical?: boolean;\n dropIndicatorPosition: DropIndicatorPosition | false;\n isLast?: boolean;\n isDropValid?: boolean;\n}\n\nconst getPositionStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => `\n top: ${dropIndicatorPosition === DropIndicatorPosition.Before ? '0' : 'unset'};\n bottom: ${dropIndicatorPosition === DropIndicatorPosition.After ? '0' : 'unset'};\n left: -2px;\n `;\n\nconst getCircleStyles = ({ dropIndicatorPosition }: DropIndicatorProps) => ({\n position: 'absolute',\n zIndex: 20,\n top: dropIndicatorPosition === DropIndicatorPosition.After ? 'unset' : '-2px',\n bottom: dropIndicatorPosition === DropIndicatorPosition.Before ? 'unset' : '-2px',\n left: '0px',\n opacity: 1,\n});\n\nconst StyledIndicator = styled.div<DropIndicatorProps>`\n position: absolute;\n ${getPositionStyles}\n box-sizing: border-box;\n width: ${(props) => (props.vertical ? '2px' : '100%')};\n height: ${(props) => (props.vertical ? '100%' : '2px')};\n background-color: ${({ isDropValid, theme }) => (isDropValid ? theme.colors.brand[600] : theme.colors.danger[900])};\n z-index: 20;\n`;\n\nconst CircleIndicator = (style: Record<string, unknown>, isDropValid: boolean | null | undefined) => (\n <svg height=\"6\" width=\"6\" style={style}>\n <circle cx=\"3\" cy=\"3\" r=\"3\" strokeWidth=\"0\" fill={isDropValid ? '#1E79C2' : '#C64252'} />\n </svg>\n);\n\nconst DropIndicator: React.ComponentType<DropIndicatorProps> = ({ dropIndicatorPosition, isLast, isDropValid }) => {\n if (\n ![DropIndicatorPosition.After, DropIndicatorPosition.Before].includes(\n dropIndicatorPosition as DropIndicatorPosition,\n )\n )\n return null;\n\n const safeDropIndicatorPosition = isLast ? DropIndicatorPosition.Before : dropIndicatorPosition;\n\n return (\n <>\n {CircleIndicator(getCircleStyles({ dropIndicatorPosition: safeDropIndicatorPosition }), isDropValid)}\n <StyledIndicator dropIndicatorPosition={safeDropIndicatorPosition} isDropValid={isDropValid} />\n </>\n );\n};\n\nexport default DropIndicator;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,+BAAmB;AAC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without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -27,16 +27,14 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
27
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
28
|
var TreeItem_exports = {};
|
|
29
29
|
__export(TreeItem_exports, {
|
|
30
|
-
DragAndDropTreeItem: () => DragAndDropTreeItem,
|
|
31
30
|
TreeItem: () => TreeItem,
|
|
32
31
|
TreeListItem: () => TreeListItem,
|
|
33
|
-
TreeListItemAddonsWrapper: () => TreeListItemAddonsWrapper
|
|
32
|
+
TreeListItemAddonsWrapper: () => TreeListItemAddonsWrapper,
|
|
33
|
+
default: () => TreeItem_default
|
|
34
34
|
});
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_react_sortable_hoc = require("@elliemae/react-sortable-hoc");
|
|
38
37
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
39
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
38
|
var import_RadioSelectable = __toESM(require("./RadioSelectable"));
|
|
41
39
|
var import_CheckboxSelectable = __toESM(require("./CheckboxSelectable"));
|
|
42
40
|
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
@@ -47,23 +45,15 @@ var import_Icon = require("./Icon");
|
|
|
47
45
|
var import_ExpandCaret = require("./ExpandCaret");
|
|
48
46
|
var import_TreeItemText = require("./TreeItemText");
|
|
49
47
|
var import_cssClassesConstants = require("../config/cssClassesConstants");
|
|
48
|
+
var import_DnDHandle = require("./DnDHandle");
|
|
49
|
+
var import_WithDnDSortableItemContext = require("../hoc/WithDnDSortableItemContext");
|
|
50
|
+
var import_SortableItemContext = require("../hoc/SortableItemContext");
|
|
51
|
+
var import_DropIndicator = __toESM(require("./DropIndicator"));
|
|
50
52
|
const TreeListItem = (0, import_ds_classnames.aggregatedClasses)("li", {
|
|
51
53
|
"data-testid": import_cssClassesConstants.treeItemBlockName,
|
|
52
54
|
role: "treeitem"
|
|
53
55
|
})(import_cssClassesConstants.treeItemBlockName);
|
|
54
56
|
const TreeListItemAddonsWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(import_cssClassesConstants.treeItemBlockName, "addons");
|
|
55
|
-
const DnDHandle = (0, import_react_sortable_hoc.SortableHandle)(({ id }) => /* @__PURE__ */ import_react.default.createElement(import_ds_icons.GripperVertical, {
|
|
56
|
-
"data-testid": "drag-handle",
|
|
57
|
-
key: `${id}-drag-handle`,
|
|
58
|
-
className: "drag-handle",
|
|
59
|
-
size: "s",
|
|
60
|
-
onMouseDown: (e) => {
|
|
61
|
-
if (e) {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
tabIndex: "0"
|
|
66
|
-
}));
|
|
67
57
|
const TreeItem = (props) => {
|
|
68
58
|
const {
|
|
69
59
|
item,
|
|
@@ -71,47 +61,43 @@ const TreeItem = (props) => {
|
|
|
71
61
|
itemWrapperStyle = {},
|
|
72
62
|
virtualItemRef,
|
|
73
63
|
spaceForNestingLevel = 1.5,
|
|
74
|
-
|
|
64
|
+
isDragOverlay = false
|
|
75
65
|
} = props;
|
|
76
66
|
const { id, node } = item;
|
|
77
67
|
const { nodeItemRef } = node.model;
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const onItemKeyDown = (0, import_keyboard_helpers.useOnItemKeyDown)(item);
|
|
68
|
+
const { draggableProps } = (0, import_react.useContext)(import_SortableItemContext.SortableItemContext);
|
|
69
|
+
const onItemKeyDown = (0, import_keyboard_helpers.useOnItemKeyDown)(item, draggableProps);
|
|
81
70
|
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
82
71
|
const {
|
|
83
72
|
props: { disableIcons, rightAddons, onItemClick, onItemFocus, rowSize, labelOverflow },
|
|
84
|
-
relativeMouseCord,
|
|
85
73
|
withRadioChecks,
|
|
86
74
|
withCheckboxChecks,
|
|
87
75
|
withDragAndDrop,
|
|
88
76
|
selectedItem,
|
|
89
77
|
selectedCheckboxes,
|
|
90
78
|
hoverItem,
|
|
91
|
-
isDragging,
|
|
92
79
|
virtualListHelpers: { scrollToIndex },
|
|
93
80
|
setHoverItem,
|
|
94
81
|
setSelectedItem,
|
|
95
82
|
setFocusedItem
|
|
96
83
|
} = ctx;
|
|
97
84
|
const setItemRefs = (ref) => {
|
|
98
|
-
(0, import_refs_helpers.setMultipleRefs)(virtualItemRef, nodeItemRef)(ref);
|
|
85
|
+
(0, import_refs_helpers.setMultipleRefs)(virtualItemRef, !isDragOverlay && nodeItemRef, !isDragOverlay && draggableProps && draggableProps.setNodeRef)(ref);
|
|
99
86
|
};
|
|
87
|
+
const dropIndicatorPosition = draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;
|
|
88
|
+
const isDropIndicatorPositionInside = dropIndicatorPosition === import_SortableItemContext.DropIndicatorPosition.Inside;
|
|
89
|
+
const isDragging = draggableProps && draggableProps.isDragging;
|
|
90
|
+
const isDropValid = draggableProps && draggableProps.isDropValid;
|
|
100
91
|
const dropPreviewClassName = (0, import_react.useMemo)(() => {
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
className += "-drop-in";
|
|
111
|
-
return className;
|
|
112
|
-
}, [withDragAndDrop, relativeMouseCord, isDraggingOverThis]);
|
|
113
|
-
const selectedClassName = (0, import_react.useMemo)(() => selectedItem?.id === item.id ? "selected" : "", [item.id, selectedItem?.id]);
|
|
114
|
-
const hoverClassName = (0, import_react.useMemo)(() => hoverItem?.id !== item.id || withDragAndDrop && isDragging ? "" : "hover", [hoverItem?.id, item.id, withDragAndDrop, isDragging]);
|
|
92
|
+
if (isDropIndicatorPositionInside) {
|
|
93
|
+
const className = `${import_cssClassesConstants.DSTreeViewPrefix}-${import_cssClassesConstants.treeItemBlockName}${isDropValid ? "--valid" : "--invalid"}-drop-in`;
|
|
94
|
+
return className;
|
|
95
|
+
}
|
|
96
|
+
return "";
|
|
97
|
+
}, [isDropIndicatorPositionInside, isDropValid]);
|
|
98
|
+
const dragOverlayClassName = (0, import_react.useMemo)(() => isDragOverlay ? "drag-overlay" : "", [isDragOverlay]);
|
|
99
|
+
const selectedClassName = (0, import_react.useMemo)(() => selectedItem?.id === item.id && !isDragOverlay ? "selected" : "", [isDragOverlay, item.id, selectedItem?.id]);
|
|
100
|
+
const hoverClassName = (0, import_react.useMemo)(() => !isDragOverlay && (hoverItem?.id === item.id || isDragging) ? "hover" : "", [isDragOverlay, hoverItem?.id, item.id, isDragging]);
|
|
115
101
|
const fixedHeightClassname = (0, import_react.useMemo)(() => {
|
|
116
102
|
if (labelOverflow === "truncate") {
|
|
117
103
|
if (rowSize === "compact")
|
|
@@ -120,7 +106,7 @@ const TreeItem = (props) => {
|
|
|
120
106
|
}
|
|
121
107
|
return "";
|
|
122
108
|
}, [labelOverflow, rowSize]);
|
|
123
|
-
const finalClassName = (0, import_react.useMemo)(() => `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName}`, [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname]);
|
|
109
|
+
const finalClassName = (0, import_react.useMemo)(() => `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName} ${dragOverlayClassName}`, [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName]);
|
|
124
110
|
const handleItemClick = (0, import_react.useCallback)((e) => {
|
|
125
111
|
onItemClick(item, e);
|
|
126
112
|
setFocusedItem(item);
|
|
@@ -134,23 +120,7 @@ const TreeItem = (props) => {
|
|
|
134
120
|
}, [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem]);
|
|
135
121
|
return /* @__PURE__ */ import_react.default.createElement(TreeListItem, {
|
|
136
122
|
tabIndex: 0,
|
|
137
|
-
onMouseMove: (event) => {
|
|
138
|
-
if (withDragAndDrop && onMouseDragOverItem) {
|
|
139
|
-
onMouseDragOverItem({
|
|
140
|
-
event,
|
|
141
|
-
item,
|
|
142
|
-
itemIndex,
|
|
143
|
-
setIsDraggingOverThis,
|
|
144
|
-
openFolderOnHoverTimeout
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
123
|
onMouseLeave: () => {
|
|
149
|
-
if (withDragAndDrop) {
|
|
150
|
-
setIsDraggingOverThis(false);
|
|
151
|
-
if (openFolderOnHoverTimeout?.current)
|
|
152
|
-
clearTimeout(openFolderOnHoverTimeout.current);
|
|
153
|
-
}
|
|
154
124
|
if (hoverItem?.id === item.id) {
|
|
155
125
|
setHoverItem(null);
|
|
156
126
|
}
|
|
@@ -159,6 +129,7 @@ const TreeItem = (props) => {
|
|
|
159
129
|
setHoverItem(item);
|
|
160
130
|
},
|
|
161
131
|
onClick: handleItemClick,
|
|
132
|
+
onBlur: () => setFocusedItem(null),
|
|
162
133
|
ref: setItemRefs,
|
|
163
134
|
style: { ...itemWrapperStyle },
|
|
164
135
|
className: finalClassName,
|
|
@@ -167,25 +138,29 @@ const TreeItem = (props) => {
|
|
|
167
138
|
"data-id": item.id,
|
|
168
139
|
"data-index": item.virtualIndex,
|
|
169
140
|
onKeyDown: onItemKeyDown
|
|
170
|
-
}, /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, withDragAndDrop ? /* @__PURE__ */ import_react.default.createElement(DnDHandle, {
|
|
171
|
-
id
|
|
172
|
-
|
|
141
|
+
}, /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, withDragAndDrop ? /* @__PURE__ */ import_react.default.createElement(import_DnDHandle.DnDHandle, {
|
|
142
|
+
id,
|
|
143
|
+
isDragOverlay
|
|
144
|
+
}) : null, withRadioChecks && !isDragOverlay ? /* @__PURE__ */ import_react.default.createElement(import_RadioSelectable.default, {
|
|
173
145
|
item,
|
|
174
146
|
itemIndex
|
|
175
|
-
}) : null, withCheckboxChecks ? /* @__PURE__ */ import_react.default.createElement(import_CheckboxSelectable.default, {
|
|
147
|
+
}) : null, withCheckboxChecks && !isDragOverlay ? /* @__PURE__ */ import_react.default.createElement(import_CheckboxSelectable.default, {
|
|
176
148
|
item,
|
|
177
149
|
itemIndex
|
|
178
|
-
}) : null, /* @__PURE__ */ import_react.default.createElement(import_NestingSpace.NestingSpace, {
|
|
150
|
+
}) : null, !isDragOverlay && /* @__PURE__ */ import_react.default.createElement(import_NestingSpace.NestingSpace, {
|
|
179
151
|
item,
|
|
180
152
|
spaceForNestingLevel
|
|
181
|
-
}), /* @__PURE__ */ import_react.default.createElement(import_ExpandCaret.ExpandCaret, {
|
|
153
|
+
}), !isDragOverlay && /* @__PURE__ */ import_react.default.createElement(import_ExpandCaret.ExpandCaret, {
|
|
182
154
|
item
|
|
183
155
|
}), !disableIcons ? /* @__PURE__ */ import_react.default.createElement(import_Icon.Icon, {
|
|
184
156
|
item
|
|
185
157
|
}) : null), /* @__PURE__ */ import_react.default.createElement(import_TreeItemText.TreeItemText, {
|
|
186
158
|
item
|
|
187
|
-
}), rightAddons && /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, typeof rightAddons === "function" ? rightAddons(item) : rightAddons)
|
|
159
|
+
}), rightAddons && /* @__PURE__ */ import_react.default.createElement(TreeListItemAddonsWrapper, null, typeof rightAddons === "function" ? rightAddons(item) : rightAddons), /* @__PURE__ */ import_react.default.createElement(import_DropIndicator.default, {
|
|
160
|
+
dropIndicatorPosition,
|
|
161
|
+
isDropValid
|
|
162
|
+
}));
|
|
188
163
|
};
|
|
189
|
-
|
|
164
|
+
var TreeItem_default = (0, import_WithDnDSortableItemContext.withDnDSortableItemContext)(TreeItem);
|
|
190
165
|
module.exports = __toCommonJS(TreeItem_exports);
|
|
191
166
|
//# sourceMappingURL=TreeItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/TreeItem.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useContext, useMemo, useCallback } from 'react';\n\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\n\nimport RadioSelectable from './RadioSelectable';\nimport CheckboxSelectable from './CheckboxSelectable';\nimport TreeViewContext from '../TreeViewContext';\nimport { setMultipleRefs } from '../utils/refs-helpers';\nimport { useOnItemKeyDown } from '../utils/keyboard-helpers';\nimport { NestingSpace } from './NestingSpace';\nimport { Icon } from './Icon';\nimport { ExpandCaret } from './ExpandCaret';\nimport { TreeItemText } from './TreeItemText';\nimport { DSTreeViewPrefix, treeItemBlockName } from '../config/cssClassesConstants';\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport { DnDHandle } from './DnDHandle';\nimport { withDnDSortableItemContext } from '../hoc/WithDnDSortableItemContext';\nimport { DropIndicatorPosition, SortableItemContext } from '../hoc/SortableItemContext';\nimport DropIndicator from './DropIndicator';\n\nexport const TreeListItem = aggregatedClasses('li', {\n 'data-testid': treeItemBlockName,\n role: 'treeitem',\n // temp fix untill we move to styled components\n})(treeItemBlockName) as unknown as React.ComponentType<React.ComponentProps<'li'>>;\n\nexport const TreeListItemAddonsWrapper = aggregatedClasses('div')(\n treeItemBlockName,\n 'addons',\n // temp fix untill we move to styled components\n) as unknown as React.ComponentType;\n\ninterface PropsT {\n item: DSTreeviewT.Item;\n itemIndex: number;\n isDragOverlay?: boolean;\n virtualItemRef?: React.RefObject<HTMLLIElement>;\n itemWrapperStyle?: { [key: string]: unknown };\n spaceForNestingLevel?: number;\n}\nexport const TreeItem = (props: PropsT): JSX.Element => {\n const {\n item,\n itemIndex,\n itemWrapperStyle = {},\n virtualItemRef,\n spaceForNestingLevel = 1.5,\n isDragOverlay = false,\n } = props;\n const { id, node } = item;\n const { nodeItemRef } = node.model;\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const onItemKeyDown = useOnItemKeyDown(item, draggableProps);\n\n const ctx = useContext(TreeViewContext);\n const {\n props: { disableIcons, rightAddons, onItemClick, onItemFocus, rowSize, labelOverflow },\n withRadioChecks,\n withCheckboxChecks,\n withDragAndDrop,\n selectedItem,\n selectedCheckboxes,\n hoverItem,\n virtualListHelpers: { scrollToIndex },\n setHoverItem,\n setSelectedItem,\n setFocusedItem,\n } = ctx;\n\n // Sortable Items needs to update\n // - the virtual list ref (for react-virtual requirement)\n // - nodeItemRef which is a prop avaiable in the TreeModel nodes\n // - the drag and drop node reference\n const setItemRefs: React.LegacyRef<HTMLLIElement> | undefined = (ref: HTMLLIElement) => {\n setMultipleRefs(\n virtualItemRef,\n !isDragOverlay && nodeItemRef,\n !isDragOverlay && draggableProps && draggableProps.setNodeRef,\n )(ref);\n };\n\n const dropIndicatorPosition =\n draggableProps && draggableProps.shouldShowDropIndicatorPosition && draggableProps.dropIndicatorPosition;\n\n const isDropIndicatorPositionInside = dropIndicatorPosition === DropIndicatorPosition.Inside;\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n const isDropValid = draggableProps && draggableProps.isDropValid;\n\n const dropPreviewClassName = useMemo(() => {\n if (isDropIndicatorPositionInside) {\n const className = `${DSTreeViewPrefix}-${treeItemBlockName}${isDropValid ? '--valid' : '--invalid'}-drop-in`;\n return className;\n }\n return '';\n }, [isDropIndicatorPositionInside, isDropValid]);\n\n const dragOverlayClassName = useMemo(() => (isDragOverlay ? 'drag-overlay' : ''), [isDragOverlay]);\n\n const selectedClassName = useMemo(\n () => (selectedItem?.id === item.id && !isDragOverlay ? 'selected' : ''),\n [isDragOverlay, item.id, selectedItem?.id],\n );\n const hoverClassName = useMemo(\n () => (!isDragOverlay && (hoverItem?.id === item.id || isDragging) ? 'hover' : ''),\n [isDragOverlay, hoverItem?.id, item.id, isDragging],\n );\n const fixedHeightClassname = useMemo(() => {\n if (labelOverflow === 'truncate') {\n if (rowSize === 'compact') return `${DSTreeViewPrefix}-${treeItemBlockName}--fixed-height-compact`;\n return `${DSTreeViewPrefix}-${treeItemBlockName}--fixed-height`;\n }\n return '';\n }, [labelOverflow, rowSize]);\n\n const finalClassName = useMemo(\n () =>\n `${dropPreviewClassName} ${fixedHeightClassname} ${selectedClassName} ${hoverClassName} ${dragOverlayClassName}`,\n [dropPreviewClassName, selectedClassName, hoverClassName, fixedHeightClassname, dragOverlayClassName],\n );\n\n const handleItemClick = useCallback(\n (e: React.MouseEvent<HTMLLIElement>) => {\n onItemClick(item, e);\n setFocusedItem(item);\n setSelectedItem(item);\n const itemVirtualIndex = typeof item.virtualIndex === 'number' ? item.virtualIndex : -1;\n onItemFocus({\n itemIndex: itemVirtualIndex,\n scrollToItem: (opts = { align: 'start' }) => scrollToIndex(itemVirtualIndex, opts),\n item,\n });\n },\n [item, scrollToIndex, onItemClick, onItemFocus, setSelectedItem, setFocusedItem],\n );\n\n return (\n <TreeListItem\n tabIndex={0}\n onMouseLeave={() => {\n if (hoverItem?.id === item.id) {\n setHoverItem(null);\n }\n }}\n onMouseEnter={() => {\n setHoverItem(item);\n }}\n onClick={handleItemClick}\n onBlur={() => setFocusedItem(null)}\n ref={setItemRefs}\n style={{ ...itemWrapperStyle }}\n className={finalClassName}\n aria-expanded={!!item.isExpanded}\n aria-selected={!!selectedCheckboxes[item.id]}\n data-id={item.id}\n data-index={item.virtualIndex}\n onKeyDown={onItemKeyDown}\n >\n <TreeListItemAddonsWrapper>\n {withDragAndDrop ? <DnDHandle id={id} isDragOverlay={isDragOverlay} /> : null}\n {withRadioChecks && !isDragOverlay ? <RadioSelectable item={item} itemIndex={itemIndex} /> : null}\n {withCheckboxChecks && !isDragOverlay ? <CheckboxSelectable item={item} itemIndex={itemIndex} /> : null}\n {!isDragOverlay && <NestingSpace item={item} spaceForNestingLevel={spaceForNestingLevel} />}\n {!isDragOverlay && <ExpandCaret item={item} />}\n {!disableIcons ? <Icon item={item} /> : null}\n </TreeListItemAddonsWrapper>\n <TreeItemText item={item} />\n {rightAddons && (\n <TreeListItemAddonsWrapper>\n {typeof rightAddons === 'function' ? rightAddons(item) : rightAddons}\n </TreeListItemAddonsWrapper>\n )}\n <DropIndicator dropIndicatorPosition={dropIndicatorPosition} isDropValid={isDropValid} />\n </TreeListItem>\n );\n};\n\nexport default withDnDSortableItemContext(TreeItem);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwD;AAExD,2BAAkC;AAElC,6BAA4B;AAC5B,gCAA+B;AAC/B,6BAA4B;AAC5B,0BAAgC;AAChC,8BAAiC;AACjC,0BAA6B;AAC7B,kBAAqB;AACrB,yBAA4B;AAC5B,0BAA6B;AAC7B,iCAAoD;AAEpD,uBAA0B;AAC1B,wCAA2C;AAC3C,iCAA2D;AAC3D,2BAA0B;AAEnB,MAAM,eAAe,4CAAkB,MAAM;AAAA,EAClD,eAAe;AAAA,EACf,MAAM;AAAA,GAEL;AAEI,MAAM,4BAA4B,4CAAkB,OACzD,8CACA;AAYK,MAAM,WAAW,CAAC,UAA+B;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,MACd;AACJ,QAAM,EAAE,IAAI,SAAS;AACrB,QAAM,EAAE,gBAAgB,KAAK;AAE7B,QAAM,EAAE,mBAAmB,6BAAW;AAEtC,QAAM,gBAAgB,8CAAiB,MAAM;AAE7C,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ,OAAO,EAAE,cAAc,aAAa,aAAa,aAAa,SAAS;AAAA,IACvE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,EAAE;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,MACE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 -27,7 +27,6 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
27
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
28
|
var TreeList_exports = {};
|
|
29
29
|
__export(TreeList_exports, {
|
|
30
|
-
DragAndDropTreeList: () => DragAndDropTreeList,
|
|
31
30
|
TreeList: () => TreeList,
|
|
32
31
|
TreeListNoItems: () => TreeListNoItems,
|
|
33
32
|
TreeListWrapper: () => TreeListWrapper,
|
|
@@ -35,12 +34,13 @@ __export(TreeList_exports, {
|
|
|
35
34
|
});
|
|
36
35
|
var React = __toESM(require("react"));
|
|
37
36
|
var import_react = __toESM(require("react"));
|
|
38
|
-
var import_react_sortable_hoc = require("@elliemae/react-sortable-hoc");
|
|
39
37
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
40
38
|
var import_ds_circular_progress_indicator = require("@elliemae/ds-circular-progress-indicator");
|
|
41
39
|
var import_TreeViewContext = __toESM(require("../TreeViewContext"));
|
|
42
40
|
var import_cssClassesConstants = require("../config/cssClassesConstants");
|
|
43
|
-
var import_TreeItem = require("./TreeItem");
|
|
41
|
+
var import_TreeItem = __toESM(require("./TreeItem"));
|
|
42
|
+
var import_WithConditionalDnDContext = require("../hoc/WithConditionalDnDContext");
|
|
43
|
+
var import_DnDTreeContext = require("../hoc/DnDTreeContext");
|
|
44
44
|
const treeListNoItemsBn = `${import_cssClassesConstants.treeListBlockName}-no-items`;
|
|
45
45
|
const TreeListNoItems = (0, import_ds_classnames.aggregatedClasses)("div", {
|
|
46
46
|
"data-testid": treeListNoItemsBn
|
|
@@ -53,18 +53,17 @@ const TreeListWrapper = (0, import_ds_classnames.aggregatedClasses)("ul", {
|
|
|
53
53
|
}));
|
|
54
54
|
const compactRowClass = `${import_cssClassesConstants.DSTreeViewPrefix}-tv-row-size-compact`;
|
|
55
55
|
const normaRowClass = `${import_cssClassesConstants.DSTreeViewPrefix}-tv-row-size-normal`;
|
|
56
|
-
const
|
|
57
|
-
const { onMouseDragOverItem } = props;
|
|
56
|
+
const TreeListComp = () => {
|
|
58
57
|
const ctx = (0, import_react.useContext)(import_TreeViewContext.default);
|
|
59
58
|
const {
|
|
60
59
|
virtualListRef,
|
|
61
60
|
virtualListHelpers,
|
|
62
|
-
visibleItems,
|
|
63
|
-
withDragAndDrop,
|
|
61
|
+
visibleItems: flattenedVisibleItems,
|
|
64
62
|
props: { width, height, rowSize, noItemsPlaceholder, isLoading }
|
|
65
63
|
} = ctx;
|
|
66
64
|
const { totalSize, virtualItems } = virtualListHelpers;
|
|
67
65
|
const className = `${rowSize === "compact" ? `${compactRowClass}` : `${normaRowClass}`}`;
|
|
66
|
+
const { visibleItems } = (0, import_react.useContext)(import_DnDTreeContext.DnDTreeContext);
|
|
68
67
|
return /* @__PURE__ */ import_react.default.createElement(TreeListWrapper, {
|
|
69
68
|
ref: virtualListRef,
|
|
70
69
|
className,
|
|
@@ -95,15 +94,16 @@ const TreeList = (props) => {
|
|
|
95
94
|
}
|
|
96
95
|
}, virtualItems.map((virtualItem) => {
|
|
97
96
|
const { index, measureRef, start } = virtualItem;
|
|
98
|
-
const item = visibleItems[index];
|
|
97
|
+
const item = (visibleItems || flattenedVisibleItems)[index];
|
|
98
|
+
if (!item)
|
|
99
|
+
return null;
|
|
99
100
|
item.virtualIndex = index;
|
|
100
101
|
const { id } = item;
|
|
101
102
|
const style = {
|
|
102
103
|
position: "absolute",
|
|
103
|
-
top:
|
|
104
|
+
top: `${start}px`,
|
|
104
105
|
left: 0,
|
|
105
|
-
width: "100%"
|
|
106
|
-
transform: `translateY(${start}px)`
|
|
106
|
+
width: "100%"
|
|
107
107
|
};
|
|
108
108
|
const listItemProps = {
|
|
109
109
|
key: `DS-TreeView-List-Item-${id}`,
|
|
@@ -113,16 +113,11 @@ const TreeList = (props) => {
|
|
|
113
113
|
item,
|
|
114
114
|
itemWrapperStyle: style
|
|
115
115
|
};
|
|
116
|
-
|
|
117
|
-
return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.DragAndDropTreeItem, {
|
|
118
|
-
...listItemProps,
|
|
119
|
-
onMouseDragOverItem
|
|
120
|
-
});
|
|
121
|
-
return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.TreeItem, {
|
|
116
|
+
return /* @__PURE__ */ import_react.default.createElement(import_TreeItem.default, {
|
|
122
117
|
...listItemProps
|
|
123
118
|
});
|
|
124
119
|
})) : null);
|
|
125
120
|
};
|
|
126
|
-
const
|
|
121
|
+
const TreeList = (0, import_WithConditionalDnDContext.withConditionalDnDRowContext)(TreeListComp);
|
|
127
122
|
module.exports = __toCommonJS(TreeList_exports);
|
|
128
123
|
//# sourceMappingURL=TreeList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/TreeList.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useContext } from 'react';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';\n\nimport TreeViewContext from '../TreeViewContext';\nimport { DSTreeViewPrefix, treeListBlockName } from '../config/cssClassesConstants';\nimport TreeItem from './TreeItem';\n\nimport type { DSTreeviewT } from '../react-desc-prop-types';\nimport { withConditionalDnDRowContext } from '../hoc/WithConditionalDnDContext';\nimport { DnDTreeContext } from '../hoc/DnDTreeContext';\n\nexport const treeListNoItemsBn = `${treeListBlockName}-no-items`;\nexport const TreeListNoItems = aggregatedClasses('div', {\n 'data-testid': treeListNoItemsBn,\n})(treeListNoItemsBn) as unknown as React.ComponentType<React.ComponentProps<'div'>>;\n\n// React.ComponentProps<'ul'> uses LegacyRef typings that existed pre-hook era\n// we omit the LegacyRef typings in favor of hook-era typings\ninterface UlProps extends Omit<React.ComponentProps<'ul'>, 'ref'> {\n ref: React.MutableRefObject<HTMLUListElement | undefined> | undefined;\n}\nexport const TreeListWrapper = aggregatedClasses('ul', {\n 'data-testid': treeListBlockName,\n role: 'tree',\n})(treeListBlockName, null, ({ rowSize }: { rowSize: 'normal' | 'compact' }) => ({\n [`rowsize-${rowSize}`]: rowSize,\n})) as unknown as React.ComponentType<UlProps>;\n\nconst compactRowClass = `${DSTreeViewPrefix}-tv-row-size-compact`;\nconst normaRowClass = `${DSTreeViewPrefix}-tv-row-size-normal`;\n\ninterface PropsT {\n onMouseDragOverItem?: (opts: {\n event: React.MouseEvent<HTMLLIElement>;\n item: DSTreeviewT.Item;\n itemIndex: number;\n setIsDraggingOverThis: React.Dispatch<React.SetStateAction<boolean>>;\n openFolderOnHoverTimeout: React.MutableRefObject<NodeJS.Timeout | null>;\n }) => void;\n}\n\nconst TreeListComp: React.ComponentType<PropsT> = () => {\n const ctx = useContext(TreeViewContext);\n const {\n virtualListRef,\n virtualListHelpers,\n visibleItems: flattenedVisibleItems,\n props: { width, height, rowSize, noItemsPlaceholder, isLoading },\n } = ctx;\n const { totalSize, virtualItems } = virtualListHelpers;\n const className = `${rowSize === 'compact' ? `${compactRowClass}` : `${normaRowClass}`}`;\n\n const { visibleItems } = useContext(DnDTreeContext);\n\n return (\n <TreeListWrapper\n ref={virtualListRef}\n className={className}\n style={{\n height: `${typeof height === 'number' ? `${height}px` : height}`,\n width: `${typeof width === 'number' ? `${width}px` : width}`,\n overflow: 'auto',\n }}\n >\n {isLoading ? (\n <div\n style={{\n width: '100%',\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <DSCircularProgressIndicator size=\"xl\" loading={isLoading} showLabel waiting={false} showTooltip={false} />\n </div>\n ) : null}\n {!isLoading && virtualItems.length === 0 ? <TreeListNoItems>{noItemsPlaceholder}</TreeListNoItems> : null}\n {!isLoading && virtualItems.length !== 0 ? (\n <div\n style={{\n height: `${totalSize}px`,\n width: '100%',\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => {\n const { index, measureRef, start } = virtualItem;\n const item = (visibleItems || flattenedVisibleItems)[index];\n if (!item) return null;\n item.virtualIndex = index;\n const { id } = item;\n\n const style = {\n position: 'absolute',\n top: `${start}px`,\n left: 0,\n width: '100%',\n };\n\n const listItemProps = {\n key: `DS-TreeView-List-Item-${id}`,\n virtualItemRef: measureRef,\n index, // this is consumed by the DnD HOC\n itemIndex: index,\n item,\n itemWrapperStyle: style,\n };\n\n return <TreeItem {...listItemProps} />;\n })}\n </div>\n ) : null}\n </TreeListWrapper>\n );\n};\n\nexport const TreeList = withConditionalDnDRowContext(TreeListComp);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkC;AAClC,2BAAkC;AAClC,4CAA4C;AAE5C,6BAA4B;AAC5B,iCAAoD;AACpD,sBAAqB;AAGrB,uCAA6C;AAC7C,4BAA+B;AAExB,MAAM,oBAAoB,GAAG;AAC7B,MAAM,kBAAkB,4CAAkB,OAAO;AAAA,EACtD,eAAe;AAAA,GACd;AAOI,MAAM,kBAAkB,4CAAkB,MAAM;AAAA,EACrD,eAAe;AAAA,EACf,MAAM;AAAA,GACL,8CAAmB,MAAM,CAAC,EAAE,cAAkD;AAAA,GAC9E,WAAW,YAAY;AAAA;AAG1B,MAAM,kBAAkB,GAAG;AAC3B,MAAM,gBAAgB,GAAG;AAYzB,MAAM,eAA4C,MAAM;AACtD,QAAM,MAAM,6BAAW;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,OAAO,EAAE,OAAO,QAAQ,SAAS,oBAAoB;AAAA,MACnD;AACJ,QAAM,EAAE,WAAW,iBAAiB;AACpC,QAAM,YAAY,GAAG,YAAY,YAAY,GAAG,oBAAoB,GAAG;AAEvE,QAAM,EAAE,iBAAiB,6BAAW;AAEpC,SACE,mDAAC,iBAAD;AAAA,IAC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|
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 TreeDndPlugin_exports = {};
|
|
29
|
+
__export(TreeDndPlugin_exports, {
|
|
30
|
+
TreeDndPlugin: () => TreeDndPlugin
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
const TreeDndPlugin = "tree-dnd";
|
|
34
|
+
module.exports = __toCommonJS(TreeDndPlugin_exports);
|
|
35
|
+
//# sourceMappingURL=TreeDndPlugin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/plugins/dnd/TreeDndPlugin.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const TreeDndPlugin = 'tree-dnd';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -59,6 +59,7 @@ const TreeViewPropTypes = {
|
|
|
59
59
|
isMultiSelect: import_react_desc.PropTypes.bool.description("whether the tree view is multi select or not").defaultValue(false),
|
|
60
60
|
isSingleSelect: import_react_desc.PropTypes.bool.description("wheter the tree view is single select or not").defaultValue(false),
|
|
61
61
|
isLoading: import_react_desc.PropTypes.bool.description("wheter the tree should show the loading state or not").defaultValue(false),
|
|
62
|
+
getIsDropValid: import_react_desc.PropTypes.func.description("Function that returns true if the drop is valid and false if it's not").defaultValue("() => true"),
|
|
62
63
|
restrictDragAndDrop: import_react_desc.PropTypes.bool.description("whether to restrict DnD functionality or not").defaultValue(false),
|
|
63
64
|
showChildrenAmount: import_react_desc.PropTypes.bool.description("whether to show the amount of children or not").defaultValue(false),
|
|
64
65
|
sortable: import_react_desc.PropTypes.bool.description("whether the sortable functionality is active or not").defaultValue(false),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { PropTypes } from 'react-desc';\nimport TreeModel from 'tree-model';\nimport { useVirtual } from 'react-virtual';\nexport declare namespace DSTreeviewT {\n export type StringOrNum = string | number;\n export type SelectionState = boolean | 'mixed';\n export type SelectionItems = Record<StringOrNum, SelectionState>;\n export type ScrollToFunc = ReturnType<typeof useVirtual>['scrollToIndex'];\n export type ScrollToItemOptions = Parameters<ReturnType<typeof useVirtual>['scrollToIndex']>[1];\n export type ScrollToItemFunc = (options: ScrollToItemOptions) => void;\n export type ExpandedItems = Record<StringOrNum, true>; // { [id]:true } -> e.g. {1:true; 2:true} // false are not listed\n export interface SimpleItem {\n [key: string]: unknown;\n name: string;\n children?: SimpleItem[];\n id: StringOrNum;\n }\n\n export interface Item extends SimpleItem {\n children: Item[];\n treeDepth?: number;\n virtualIndex?: number;\n isChecked?: boolean | 'mixed';\n isGroup?: boolean;\n isExpanded?: boolean;\n childrenMatchesSearchQuery?: boolean;\n matchesSearchQuery?: boolean;\n nodeItemRef?: React.RefObject<HTMLLIElement>;\n model: TreeModel.Node<Item>['model'];\n node: TreeModel.Node<Item> & { parent?: TreeModel.Node<Item> };\n nodePath: TreeModel.Node<Item>[];\n }\n\n export interface DndItem {\n uid: string;\n depth: number;\n realIndex: number;\n childrenCount: number;\n parentId: string | null;\n original: SimpleItem;\n }\n\n export interface Actions {\n toggleExpandAll: (isExpand: boolean) => Promise<DSTreeviewT.Item[]>;\n scrollTo: DSTreeviewT.ScrollToFunc;\n setSelectedItemByVirtualIndex: (index: number) => void;\n setFocusedItemByVirtualIndex: (\n index: number,\n scrollOpts: DSTreeviewT.ScrollToItemOptions & { withScroll?: boolean },\n ) => void;\n }\n export interface InstanceRef {\n actions: Actions;\n }\n\n export interface DefaultProps {\n plugins: string[];\n selection: SelectionItems;\n instanceRef: React.MutableRefObject<InstanceRef>;\n isItemDisabled: (item: Item) => boolean;\n disableIcons: boolean;\n fluid: boolean;\n isMultiSelect: boolean;\n isSingleSelect: boolean;\n getIsDropValid: (\n active: DndItem,\n over: DndItem,\n dropIndicatorPosition: 'none' | 'before' | 'after' | 'inside',\n ) => boolean;\n restrictDragAndDrop: boolean;\n showChildrenAmount: boolean;\n sortable: boolean;\n isLoading: boolean;\n highlightOnlyQuery: boolean;\n onItemClick: (item: Item, e: React.MouseEvent<HTMLLIElement>) => void;\n onItemFocus: (meta: { scrollToItem: ScrollToItemFunc; itemIndex: number; item: Item }) => void;\n onVisibleItemsChange: (newVisibleItems: Item[]) => void;\n onOrderChange: (newData: SimpleItem[], oldData: SimpleItem[], draggedItem: DndItem) => void;\n onSelectionChange: (\n selection: SelectionItems,\n item: Item,\n meta: { scrollToItem: ScrollToItemFunc; itemIndex: number },\n ) => void;\n onExpandChange: (expandedHashmap: ExpandedItems, itemToggled: Item | null | undefined) => void;\n onInstanceRefInitialized: (instanceRef: React.MutableRefObject<InstanceRef>) => void;\n rowSize: 'normal' | 'compact';\n labelOverflow: 'wrap' | 'wrap-all' | 'truncate';\n noItemsPlaceholder: string;\n nameKey: string;\n width: StringOrNum;\n height: StringOrNum;\n groupIcon: JSX.Element | null;\n itemIcon: JSX.Element | null;\n searchQuery: string;\n }\n export interface PropsOptional {\n expanded: ExpandedItems;\n rightAddons: ((item: Item) => React.ReactNode | React.ReactNode[]) | JSX.Element;\n }\n export interface PropsRequired {\n data: Item[];\n }\n export interface Props extends DefaultProps, PropsOptional, PropsRequired {}\n}\n\nexport const TreeViewPropTypes = {\n data: PropTypes.arrayOf(\n PropTypes.shape({\n children: PropTypes.arrayOf(PropTypes.object),\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n isGroup: PropTypes.oneOfType([PropTypes.oneOf([undefined, null]), PropTypes.bool]),\n name: PropTypes.string,\n node: PropTypes.object,\n }),\n ).description('data to populate tree view').isRequired,\n plugins: PropTypes.arrayOf(PropTypes.string).description('list of enabled plugins').defaultValue([]),\n selection: PropTypes.object.description('pre selected items').defaultValue({}),\n expanded: PropTypes.object.description('control what items are expanded').defaultValue(undefined),\n instanceRef: PropTypes.shape({\n current: PropTypes.oneOfType([\n PropTypes.oneOf([null, undefined]),\n PropTypes.shape({\n actions: PropTypes.shape({\n toggleExpandAll: PropTypes.func,\n scrollTo: PropTypes.func,\n }).description('').isRequired,\n }),\n ]),\n }).description('instance ref'),\n isItemDisabled: PropTypes.func\n .description('Function that receives an item, and returns whether that item should be disabled')\n .defaultValue('() => false'),\n disableIcons: PropTypes.bool.description('disable icons').defaultValue(false),\n fluid: PropTypes.bool.description('whether is fluid or not').defaultValue(false),\n isMultiSelect: PropTypes.bool.description('whether the tree view is multi select or not').defaultValue(false),\n isSingleSelect: PropTypes.bool.description('wheter the tree view is single select or not').defaultValue(false),\n isLoading: PropTypes.bool.description('wheter the tree should show the loading state or not').defaultValue(false),\n getIsDropValid: PropTypes.func\n .description(\"Function that returns true if the drop is valid and false if it's not\")\n .defaultValue('() => true'),\n restrictDragAndDrop: PropTypes.bool.description('whether to restrict DnD functionality or not').defaultValue(false),\n showChildrenAmount: PropTypes.bool.description('whether to show the amount of children or not').defaultValue(false),\n sortable: PropTypes.bool.description('whether the sortable functionality is active or not').defaultValue(false),\n onItemClick: PropTypes.func.description('function executed when clicking on an item').defaultValue('() => {}'),\n onItemFocus: PropTypes.func.description('function executed when focusing on an item').defaultValue('() => {}'),\n onVisibleItemsChange: PropTypes.func\n .description('function executed when the visible items change')\n .defaultValue('() => {}'),\n onOrderChange: PropTypes.func.description('function executed when the items order changes').defaultValue('() => {}'),\n onSelectionChange: PropTypes.func\n .description('function executed when the selection changes')\n .defaultValue('() => {}'),\n onExpandChange: PropTypes.func.description('function executed when expanding an item').defaultValue('() => {}'),\n onInstanceRefInitialized: PropTypes.func\n .description('function executed when instanceRef has terminated instanciation')\n .defaultValue('() => {}'),\n rowSize: PropTypes.oneOf(['normal', 'compact']).description('size of the row').defaultValue('normal'),\n labelOverflow: PropTypes.oneOf(['wrap', 'wrap-all', 'truncate'])\n .description('label truncation preference')\n .defaultValue('wrap'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('components width').defaultValue('100%'),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('components height')\n .defaultValue('100%'),\n groupIcon: PropTypes.node.description('icon for groups'),\n itemIcon: PropTypes.node.description('icon for items'),\n searchQuery: PropTypes.string.description('search query value'),\n noItemsPlaceholder: PropTypes.string\n .description('message to be shown when there are no items in the treeview to be displayed')\n .defaultValue('No items found'),\n name: PropTypes.string.description('property key to identifier for items labels').defaultValue('name'),\n highlightOnlyQuery: PropTypes.bool.description('whether to highlight results or not').defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,wBAA0B;AAyGnB,MAAM,oBAAoB;AAAA,EAC/B,MAAM,4BAAU,QACd,4BAAU,MAAM;AAAA,IACd,UAAU,4BAAU,QAAQ,4BAAU;AAAA,IACtC,IAAI,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,IACrD,SAAS,4BAAU,UAAU,CAAC,4BAAU,MAAM,CAAC,QAAW,QAAQ,4BAAU;AAAA,IAC5E,MAAM,4BAAU;AAAA,IAChB,MAAM,4BAAU;AAAA,MAElB,YAAY,8BAA8B;AAAA,EAC5C,SAAS,4BAAU,QAAQ,4BAAU,QAAQ,YAAY,2BAA2B,aAAa;AAAA,EACjG,WAAW,4BAAU,OAAO,YAAY,sBAAsB,aAAa;AAAA,EAC3E,UAAU,4BAAU,OAAO,YA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