react-arborist 2.1.1 → 2.2.0
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/README.md +2 -3
- package/dist/index.js +35 -36
- package/dist/index.js.map +1 -1
- package/dist/module.js +35 -36
- package/dist/module.js.map +1 -1
- package/dist/types/tree-props.d.ts +1 -0
- package/package.json +3 -2
- package/src/components/default-container.tsx +33 -36
- package/src/components/row-container.tsx +1 -2
- package/src/interfaces/node-api.ts +2 -2
- package/src/interfaces/tree-api.ts +1 -1
- package/src/types/tree-props.ts +1 -0
package/dist/module.js
CHANGED
|
@@ -471,8 +471,8 @@ class $096e74084443e9a3$export$d4b903da0f522dc8 {
|
|
|
471
471
|
return this.tree.edit(this);
|
|
472
472
|
}
|
|
473
473
|
handleClick = (e)=>{
|
|
474
|
-
if (e.metaKey) this.isSelected ? this.deselect() : this.selectMulti();
|
|
475
|
-
else if (e.shiftKey) this.selectContiguous();
|
|
474
|
+
if (e.metaKey && !this.tree.props.disableMultiSelection) this.isSelected ? this.deselect() : this.selectMulti();
|
|
475
|
+
else if (e.shiftKey && !this.tree.props.disableMultiSelection) this.selectContiguous();
|
|
476
476
|
else {
|
|
477
477
|
this.select();
|
|
478
478
|
this.activate();
|
|
@@ -1241,7 +1241,9 @@ const $8c3aed0a01f84486$export$a9754b3c8daa5172 = /*#__PURE__*/ (0, $g00cZ$react
|
|
|
1241
1241
|
className: tree.props.rowClassName
|
|
1242
1242
|
};
|
|
1243
1243
|
(0, $g00cZ$useEffect)(()=>{
|
|
1244
|
-
if (!node.isEditing && node.isFocused) el.current?.focus(
|
|
1244
|
+
if (!node.isEditing && node.isFocused) el.current?.focus({
|
|
1245
|
+
preventScroll: true
|
|
1246
|
+
});
|
|
1245
1247
|
}, [
|
|
1246
1248
|
node.isEditing,
|
|
1247
1249
|
node.isFocused,
|
|
@@ -1320,36 +1322,39 @@ function $065a164934293bf2$export$ff4858a4110d9246() {
|
|
|
1320
1322
|
(0, $0e6083160f4b36ed$export$33b47db07a82b2fb)(e.currentTarget);
|
|
1321
1323
|
return;
|
|
1322
1324
|
}
|
|
1323
|
-
if (e.key === "ArrowDown"
|
|
1325
|
+
if (e.key === "ArrowDown") {
|
|
1324
1326
|
e.preventDefault();
|
|
1325
1327
|
const next = tree.nextNode;
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
e.
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
tree.focus(tree.prevNode);
|
|
1342
|
-
return;
|
|
1328
|
+
if (e.metaKey) {
|
|
1329
|
+
tree.select(tree.focusedNode);
|
|
1330
|
+
tree.activate(tree.focusedNode);
|
|
1331
|
+
return;
|
|
1332
|
+
} else if (!e.shiftKey || tree.props.disableMultiSelection) {
|
|
1333
|
+
tree.focus(next);
|
|
1334
|
+
return;
|
|
1335
|
+
} else {
|
|
1336
|
+
if (!next) return;
|
|
1337
|
+
const current = tree.focusedNode;
|
|
1338
|
+
if (!current) tree.focus(tree.firstNode);
|
|
1339
|
+
else if (current.isSelected) tree.selectContiguous(next);
|
|
1340
|
+
else tree.selectMulti(next);
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
1343
|
}
|
|
1344
|
-
if (e.key === "ArrowUp"
|
|
1344
|
+
if (e.key === "ArrowUp") {
|
|
1345
1345
|
e.preventDefault();
|
|
1346
1346
|
const prev = tree.prevNode;
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
else
|
|
1351
|
-
|
|
1352
|
-
|
|
1347
|
+
if (!e.shiftKey || tree.props.disableMultiSelection) {
|
|
1348
|
+
tree.focus(prev);
|
|
1349
|
+
return;
|
|
1350
|
+
} else {
|
|
1351
|
+
if (!prev) return;
|
|
1352
|
+
const current1 = tree.focusedNode;
|
|
1353
|
+
if (!current1) tree.focus(tree.lastNode); // ?
|
|
1354
|
+
else if (current1.isSelected) tree.selectContiguous(prev);
|
|
1355
|
+
else tree.selectMulti(prev);
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1353
1358
|
}
|
|
1354
1359
|
if (e.key === "ArrowRight") {
|
|
1355
1360
|
const node1 = tree.focusedNode;
|
|
@@ -1365,7 +1370,7 @@ function $065a164934293bf2$export$ff4858a4110d9246() {
|
|
|
1365
1370
|
else if (!node2.parent?.isRoot) tree.focus(node2.parent);
|
|
1366
1371
|
return;
|
|
1367
1372
|
}
|
|
1368
|
-
if (e.key === "a" && e.metaKey) {
|
|
1373
|
+
if (e.key === "a" && e.metaKey && !tree.props.disableMultiSelection) {
|
|
1369
1374
|
e.preventDefault();
|
|
1370
1375
|
tree.selectAll();
|
|
1371
1376
|
return;
|
|
@@ -1415,12 +1420,6 @@ function $065a164934293bf2$export$ff4858a4110d9246() {
|
|
|
1415
1420
|
tree.openSiblings(node4);
|
|
1416
1421
|
return;
|
|
1417
1422
|
}
|
|
1418
|
-
if (e.key === "ArrowDown" && e.metaKey) {
|
|
1419
|
-
e.preventDefault();
|
|
1420
|
-
tree.select(tree.focusedNode);
|
|
1421
|
-
tree.activate(tree.focusedNode);
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
1423
|
if (e.key === "PageUp") {
|
|
1425
1424
|
e.preventDefault();
|
|
1426
1425
|
tree.pageUp();
|
|
@@ -1873,7 +1872,7 @@ class $bfece7c4aed4e9c4$export$e2da3477247342d1 {
|
|
|
1873
1872
|
if (index === undefined) return;
|
|
1874
1873
|
this.list.current?.scrollToItem(index, align);
|
|
1875
1874
|
}).catch(()=>{
|
|
1876
|
-
|
|
1875
|
+
// Id: ${id} never appeared in the list.
|
|
1877
1876
|
});
|
|
1878
1877
|
}
|
|
1879
1878
|
/* State Checks */ get isEditing() {
|