react-arborist 3.1.0 → 3.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/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/interfaces/tree-api.d.ts +5 -0
- package/dist/module.js +26 -9
- package/dist/module.js.map +1 -1
- package/dist/state/selection-slice.d.ts +8 -2
- package/package.json +1 -1
- package/src/components/provider.tsx +0 -1
- package/src/interfaces/tree-api.ts +18 -6
- package/src/state/selection-slice.ts +12 -3
- package/src/types/tree-props.ts +2 -2
|
@@ -87,6 +87,11 @@ export declare class TreeApi<T> {
|
|
|
87
87
|
selectContiguous(identity: Identity): void;
|
|
88
88
|
deselectAll(): void;
|
|
89
89
|
selectAll(): void;
|
|
90
|
+
setSelection(args: {
|
|
91
|
+
ids: (IdObj | string)[] | null;
|
|
92
|
+
anchor: IdObj | string | null;
|
|
93
|
+
mostRecent: IdObj | string | null;
|
|
94
|
+
}): void;
|
|
90
95
|
get cursorParentId(): string | null;
|
|
91
96
|
get cursorOverFolder(): boolean;
|
|
92
97
|
get dragNodes(): NodeApi<T>[];
|
package/dist/module.js
CHANGED
|
@@ -642,9 +642,9 @@ const $37bc167debff36d2$export$e324594224ef24da = {
|
|
|
642
642
|
id
|
|
643
643
|
]).map((0, $0e6083160f4b36ed$export$65e5b62a4c490288))
|
|
644
644
|
}),
|
|
645
|
-
set: (
|
|
645
|
+
set: (args)=>({
|
|
646
646
|
type: "SELECTION_SET",
|
|
647
|
-
|
|
647
|
+
...args
|
|
648
648
|
}),
|
|
649
649
|
mostRecent: (id)=>({
|
|
650
650
|
type: "SELECTION_MOST_RECENT",
|
|
@@ -687,7 +687,9 @@ function $37bc167debff36d2$export$1650419e431d3ba3(state = (0, $6ad32e02250c922e
|
|
|
687
687
|
case "SELECTION_SET":
|
|
688
688
|
return {
|
|
689
689
|
...state,
|
|
690
|
-
ids:
|
|
690
|
+
ids: action.ids,
|
|
691
|
+
mostRecent: action.mostRecent,
|
|
692
|
+
anchor: action.anchor
|
|
691
693
|
};
|
|
692
694
|
case "SELECTION_MOST_RECENT":
|
|
693
695
|
return {
|
|
@@ -1765,19 +1767,34 @@ class $bfece7c4aed4e9c4$export$e2da3477247342d1 {
|
|
|
1765
1767
|
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1766
1768
|
}
|
|
1767
1769
|
deselectAll() {
|
|
1768
|
-
this.
|
|
1769
|
-
|
|
1770
|
-
|
|
1770
|
+
this.setSelection({
|
|
1771
|
+
ids: [],
|
|
1772
|
+
anchor: null,
|
|
1773
|
+
mostRecent: null
|
|
1774
|
+
});
|
|
1771
1775
|
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1772
1776
|
}
|
|
1773
1777
|
selectAll() {
|
|
1774
|
-
this.
|
|
1778
|
+
this.setSelection({
|
|
1779
|
+
ids: Object.keys(this.idToIndex),
|
|
1780
|
+
anchor: this.firstNode,
|
|
1781
|
+
mostRecent: this.lastNode
|
|
1782
|
+
});
|
|
1775
1783
|
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(this.lastNode?.id));
|
|
1776
|
-
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).anchor(this.firstNode));
|
|
1777
|
-
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(this.lastNode));
|
|
1778
1784
|
if (this.focusedNode) $bfece7c4aed4e9c4$var$safeRun(this.props.onFocus, this.focusedNode);
|
|
1779
1785
|
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1780
1786
|
}
|
|
1787
|
+
setSelection(args) {
|
|
1788
|
+
const ids = new Set(args.ids?.map($bfece7c4aed4e9c4$var$identify));
|
|
1789
|
+
const anchor = $bfece7c4aed4e9c4$var$identifyNull(args.anchor);
|
|
1790
|
+
const mostRecent = $bfece7c4aed4e9c4$var$identifyNull(args.mostRecent);
|
|
1791
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).set({
|
|
1792
|
+
ids: ids,
|
|
1793
|
+
anchor: anchor,
|
|
1794
|
+
mostRecent: mostRecent
|
|
1795
|
+
}));
|
|
1796
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1797
|
+
}
|
|
1781
1798
|
/* Drag and Drop */ get cursorParentId() {
|
|
1782
1799
|
const { cursor: cursor } = this.state.dnd;
|
|
1783
1800
|
switch(cursor.type){
|