react-arborist 3.0.0 → 3.0.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/README.md +1 -6
- package/dist/components/tree.d.ts +5 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/module.js +8 -7
- package/dist/module.js.map +1 -1
- package/jest.config.js +5 -0
- package/package.json +19 -12
- package/src/components/tree.tsx +6 -2
- package/src/interfaces/tree-api.test.ts +15 -0
- package/src/interfaces/tree-api.ts +7 -7
package/README.md
CHANGED
|
@@ -17,18 +17,13 @@ Here is a Gmail sidebar clone built with react-arborist.
|
|
|
17
17
|
- Inline renaming
|
|
18
18
|
- Virtualized rendering
|
|
19
19
|
- Custom styling
|
|
20
|
-
|
|
21
|
-
**New Features in Version 2**
|
|
22
|
-
|
|
23
20
|
- Keyboard navigation
|
|
24
21
|
- Aria attributes
|
|
25
22
|
- Tree filtering
|
|
26
23
|
- Selection synchronization
|
|
27
|
-
-
|
|
24
|
+
- Callbacks (onScroll, onActivate, onSelect)
|
|
28
25
|
- Controlled or uncontrolled trees
|
|
29
26
|
|
|
30
|
-
> These docs are for version 2. It contains breaking changes. Here is the [v1.2.0 README](https://github.com/brimdata/react-arborist/tree/4fe9659d2c4cbd57582294330863d4fd7e7af74b).
|
|
31
|
-
|
|
32
27
|
## Installation
|
|
33
28
|
|
|
34
29
|
```
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TreeApi } from "../interfaces/tree-api";
|
|
3
3
|
import { TreeProps } from "../types/tree-props";
|
|
4
|
-
|
|
4
|
+
declare function TreeComponent<T>(props: TreeProps<T>, ref: React.Ref<TreeApi<T> | undefined>): JSX.Element;
|
|
5
|
+
export declare const Tree: <T>(props: TreeProps<T> & {
|
|
6
|
+
ref?: import("react").ForwardedRef<TreeApi<T> | undefined> | undefined;
|
|
7
|
+
}) => ReturnType<typeof TreeComponent>;
|
|
8
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1811,21 +1811,21 @@ class $5c74fef433be2b0a$export$e2da3477247342d1 {
|
|
|
1811
1811
|
if (this.isFiltered) return false;
|
|
1812
1812
|
const parentNode = this.get(this.state.dnd.parentId) ?? this.root;
|
|
1813
1813
|
const dragNodes = this.dragNodes;
|
|
1814
|
-
const
|
|
1814
|
+
const isDisabled = this.props.disableDrop;
|
|
1815
1815
|
for (const drag of dragNodes){
|
|
1816
1816
|
if (!drag) return false;
|
|
1817
1817
|
if (!parentNode) return false;
|
|
1818
1818
|
if (drag.isInternal && $eb5355379510ac9b$exports.isDecendent(parentNode, drag)) return false;
|
|
1819
1819
|
}
|
|
1820
1820
|
// Allow the user to insert their own logic
|
|
1821
|
-
if (typeof
|
|
1821
|
+
if (typeof isDisabled == "function") return !isDisabled({
|
|
1822
1822
|
parentNode: parentNode,
|
|
1823
1823
|
dragNodes: this.dragNodes,
|
|
1824
1824
|
index: this.state.dnd.index
|
|
1825
1825
|
});
|
|
1826
|
-
else if (typeof
|
|
1827
|
-
return
|
|
1828
|
-
else if (typeof
|
|
1826
|
+
else if (typeof isDisabled == "string") // @ts-ignore
|
|
1827
|
+
return !parentNode.data[isDisabled];
|
|
1828
|
+
else if (typeof isDisabled === "boolean") return !isDisabled;
|
|
1829
1829
|
else return true;
|
|
1830
1830
|
}
|
|
1831
1831
|
hideCursor() {
|
|
@@ -2344,7 +2344,7 @@ Use the data prop if you want to provide your own handlers.`);
|
|
|
2344
2344
|
}
|
|
2345
2345
|
|
|
2346
2346
|
|
|
2347
|
-
|
|
2347
|
+
function $641461e16d1a2941$var$TreeComponent(props, ref) {
|
|
2348
2348
|
const treeProps = (0, $8e1ae4dab2259e77$export$d227906824a13416)(props);
|
|
2349
2349
|
return /*#__PURE__*/ (0, $foSVk$reactjsxruntime.jsxs)((0, $9511ad6af37da13b$export$c49dab5eb1b4ce0c), {
|
|
2350
2350
|
treeProps: treeProps,
|
|
@@ -2356,7 +2356,8 @@ const $641461e16d1a2941$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $foSVk$react
|
|
|
2356
2356
|
/*#__PURE__*/ (0, $foSVk$reactjsxruntime.jsx)((0, $ed13b1d404b3872b$export$3e21b60650ec7e55), {})
|
|
2357
2357
|
]
|
|
2358
2358
|
});
|
|
2359
|
-
}
|
|
2359
|
+
}
|
|
2360
|
+
const $641461e16d1a2941$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $foSVk$react.forwardRef)($641461e16d1a2941$var$TreeComponent);
|
|
2360
2361
|
|
|
2361
2362
|
|
|
2362
2363
|
var $73c61fb8fd3b5237$exports = {};
|