react-complex-tree
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -66,3 +66,3 @@ "use strict"; | ||
if (e.clientX < 0 || e.clientY < 0) { | ||
return; // TODO hotfix | ||
return; | ||
} | ||
@@ -69,0 +69,0 @@ var treeBb = containerRef.current.getBoundingClientRect(); |
@@ -176,2 +176,22 @@ "use strict"; | ||
}, [items, onPrimaryAction]); | ||
var expandSubsequently = (0, react_1.useCallback)(function (treeId, itemIds) { return __awaiter(void 0, void 0, void 0, function () { | ||
var current, rest; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
current = itemIds[0], rest = itemIds.slice(1); | ||
return [4 /*yield*/, (0, waitFor_1.waitFor)(function () { var _a; return !!((_a = itemsRef.current) === null || _a === void 0 ? void 0 : _a[current]); }).then(function () { | ||
var item = itemsRef.current[current]; | ||
if (!item) { | ||
return; | ||
} | ||
onExpandItem === null || onExpandItem === void 0 ? void 0 : onExpandItem(item, treeId); | ||
expandSubsequently(treeId, rest); | ||
})]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }, [itemsRef, onExpandItem]); | ||
var expandAll = (0, react_1.useCallback)(function (treeId) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -210,2 +230,3 @@ return __generator(this, function (_a) { | ||
expandAll: expandAll, | ||
expandSubsequently: expandSubsequently, | ||
collapseAll: collapseAll, | ||
@@ -230,2 +251,3 @@ abortProgrammaticDrag: abortProgrammaticDrag, | ||
expandAll, | ||
expandSubsequently, | ||
collapseAll, | ||
@@ -232,0 +254,0 @@ abortProgrammaticDrag, |
@@ -103,2 +103,5 @@ "use strict"; | ||
}, | ||
expandSubsequently: function (itemIds) { | ||
return envActions.expandSubsequently(tree.treeId, itemIds); | ||
}, | ||
}); }, [envActions, tree]); | ||
@@ -105,0 +108,0 @@ (0, useCreatedTreeRef_1.useCreatedTreeRef)(ref, actions); |
@@ -192,2 +192,3 @@ import React, { FormHTMLAttributes, HTMLProps, InputHTMLAttributes, Ref } from 'react'; | ||
collapseAll: (treeId: string) => void; | ||
expandSubsequently: (treeId: string, itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -310,2 +311,3 @@ export type TreeEnvironmentActionsContextProps = TreeEnvironmentChangeActions; | ||
collapseAll: () => void; | ||
expandSubsequently: (itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -312,0 +314,0 @@ export type TreeChangeActionsContextProps = TreeChangeActions; |
@@ -63,3 +63,3 @@ import { useTreeEnvironment } from './ControlledTreeEnvironment'; | ||
if (e.clientX < 0 || e.clientY < 0) { | ||
return; // TODO hotfix | ||
return; | ||
} | ||
@@ -66,0 +66,0 @@ var treeBb = containerRef.current.getBoundingClientRect(); |
@@ -149,2 +149,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}, [items, onPrimaryAction]); | ||
var expandSubsequently = useCallback(function (treeId, itemIds) { return __awaiter(void 0, void 0, void 0, function () { | ||
var current, rest; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
current = itemIds[0], rest = itemIds.slice(1); | ||
return [4 /*yield*/, waitFor(function () { var _a; return !!((_a = itemsRef.current) === null || _a === void 0 ? void 0 : _a[current]); }).then(function () { | ||
var item = itemsRef.current[current]; | ||
if (!item) { | ||
return; | ||
} | ||
onExpandItem === null || onExpandItem === void 0 ? void 0 : onExpandItem(item, treeId); | ||
expandSubsequently(treeId, rest); | ||
})]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }, [itemsRef, onExpandItem]); | ||
var expandAll = useCallback(function (treeId) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -183,2 +203,3 @@ return __generator(this, function (_a) { | ||
expandAll: expandAll, | ||
expandSubsequently: expandSubsequently, | ||
collapseAll: collapseAll, | ||
@@ -203,2 +224,3 @@ abortProgrammaticDrag: abortProgrammaticDrag, | ||
expandAll, | ||
expandSubsequently, | ||
collapseAll, | ||
@@ -205,0 +227,0 @@ abortProgrammaticDrag, |
@@ -76,2 +76,5 @@ import * as React from 'react'; | ||
}, | ||
expandSubsequently: function (itemIds) { | ||
return envActions.expandSubsequently(tree.treeId, itemIds); | ||
}, | ||
}); }, [envActions, tree]); | ||
@@ -78,0 +81,0 @@ useCreatedTreeRef(ref, actions); |
@@ -192,2 +192,3 @@ import React, { FormHTMLAttributes, HTMLProps, InputHTMLAttributes, Ref } from 'react'; | ||
collapseAll: (treeId: string) => void; | ||
expandSubsequently: (treeId: string, itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -310,2 +311,3 @@ export type TreeEnvironmentActionsContextProps = TreeEnvironmentChangeActions; | ||
collapseAll: () => void; | ||
expandSubsequently: (itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -312,0 +314,0 @@ export type TreeChangeActionsContextProps = TreeChangeActions; |
@@ -63,3 +63,3 @@ import { useTreeEnvironment } from './ControlledTreeEnvironment'; | ||
if (e.clientX < 0 || e.clientY < 0) { | ||
return; // TODO hotfix | ||
return; | ||
} | ||
@@ -66,0 +66,0 @@ var treeBb = containerRef.current.getBoundingClientRect(); |
@@ -149,2 +149,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}, [items, onPrimaryAction]); | ||
var expandSubsequently = useCallback(function (treeId, itemIds) { return __awaiter(void 0, void 0, void 0, function () { | ||
var current, rest; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
current = itemIds[0], rest = itemIds.slice(1); | ||
return [4 /*yield*/, waitFor(function () { var _a; return !!((_a = itemsRef.current) === null || _a === void 0 ? void 0 : _a[current]); }).then(function () { | ||
var item = itemsRef.current[current]; | ||
if (!item) { | ||
return; | ||
} | ||
onExpandItem === null || onExpandItem === void 0 ? void 0 : onExpandItem(item, treeId); | ||
expandSubsequently(treeId, rest); | ||
})]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }, [itemsRef, onExpandItem]); | ||
var expandAll = useCallback(function (treeId) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -183,2 +203,3 @@ return __generator(this, function (_a) { | ||
expandAll: expandAll, | ||
expandSubsequently: expandSubsequently, | ||
collapseAll: collapseAll, | ||
@@ -203,2 +224,3 @@ abortProgrammaticDrag: abortProgrammaticDrag, | ||
expandAll, | ||
expandSubsequently, | ||
collapseAll, | ||
@@ -205,0 +227,0 @@ abortProgrammaticDrag, |
@@ -76,2 +76,5 @@ import * as React from 'react'; | ||
}, | ||
expandSubsequently: function (itemIds) { | ||
return envActions.expandSubsequently(tree.treeId, itemIds); | ||
}, | ||
}); }, [envActions, tree]); | ||
@@ -78,0 +81,0 @@ useCreatedTreeRef(ref, actions); |
@@ -192,2 +192,3 @@ import React, { FormHTMLAttributes, HTMLProps, InputHTMLAttributes, Ref } from 'react'; | ||
collapseAll: (treeId: string) => void; | ||
expandSubsequently: (treeId: string, itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -310,2 +311,3 @@ export type TreeEnvironmentActionsContextProps = TreeEnvironmentChangeActions; | ||
collapseAll: () => void; | ||
expandSubsequently: (itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -312,0 +314,0 @@ export type TreeChangeActionsContextProps = TreeChangeActions; |
{ | ||
"name": "react-complex-tree", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"main": "lib/cjs/index.js", | ||
@@ -37,3 +37,3 @@ "module": "lib/esm/index.js", | ||
"cpy-cli": "^3.1.1", | ||
"demodata": "^2.2.3", | ||
"demodata": "^2.2.4", | ||
"jest": "^29.2.2", | ||
@@ -70,3 +70,3 @@ "jest-dom": "^4.0.0", | ||
}, | ||
"gitHead": "c1e51ef174d46ebcebd1086c5fba82f39f4567ef" | ||
"gitHead": "30bd4a6b9cfa764baca769392e5d48a690a280d4" | ||
} |
@@ -121,3 +121,3 @@ import * as React from 'react'; | ||
if (e.clientX < 0 || e.clientY < 0) { | ||
return; // TODO hotfix | ||
return; | ||
} | ||
@@ -124,0 +124,0 @@ |
@@ -236,2 +236,6 @@ import React, { | ||
collapseAll: (treeId: string) => void; | ||
expandSubsequently: ( | ||
treeId: string, | ||
itemIds: TreeItemIndex[] | ||
) => Promise<void>; | ||
} | ||
@@ -393,2 +397,3 @@ | ||
collapseAll: () => void; | ||
expandSubsequently: (itemIds: TreeItemIndex[]) => Promise<void>; | ||
} | ||
@@ -395,0 +400,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1232081
470
18944