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 CHANGED
@@ -663,9 +663,9 @@ const $58f9381615aa3d17$export$e324594224ef24da = {
663
663
  id
664
664
  ]).map((0, $eb5355379510ac9b$export$65e5b62a4c490288))
665
665
  }),
666
- set: (ids)=>({
666
+ set: (args)=>({
667
667
  type: "SELECTION_SET",
668
- ids: ids
668
+ ...args
669
669
  }),
670
670
  mostRecent: (id)=>({
671
671
  type: "SELECTION_MOST_RECENT",
@@ -708,7 +708,9 @@ function $58f9381615aa3d17$export$1650419e431d3ba3(state = (0, $9d556ecd8e421ffe
708
708
  case "SELECTION_SET":
709
709
  return {
710
710
  ...state,
711
- ids: new Set(action.ids)
711
+ ids: action.ids,
712
+ mostRecent: action.mostRecent,
713
+ anchor: action.anchor
712
714
  };
713
715
  case "SELECTION_MOST_RECENT":
714
716
  return {
@@ -1786,19 +1788,34 @@ class $5c74fef433be2b0a$export$e2da3477247342d1 {
1786
1788
  $5c74fef433be2b0a$var$safeRun(this.props.onSelect, this.selectedNodes);
1787
1789
  }
1788
1790
  deselectAll() {
1789
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).clear());
1790
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).anchor(null));
1791
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).mostRecent(null));
1791
+ this.setSelection({
1792
+ ids: [],
1793
+ anchor: null,
1794
+ mostRecent: null
1795
+ });
1792
1796
  $5c74fef433be2b0a$var$safeRun(this.props.onSelect, this.selectedNodes);
1793
1797
  }
1794
1798
  selectAll() {
1795
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).set(new Set(Object.keys(this.idToIndex))));
1799
+ this.setSelection({
1800
+ ids: Object.keys(this.idToIndex),
1801
+ anchor: this.firstNode,
1802
+ mostRecent: this.lastNode
1803
+ });
1796
1804
  this.dispatch((0, $61ef7f2c3c9633e7$export$d7ddd398f22d79ef)(this.lastNode?.id));
1797
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).anchor(this.firstNode));
1798
- this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).mostRecent(this.lastNode));
1799
1805
  if (this.focusedNode) $5c74fef433be2b0a$var$safeRun(this.props.onFocus, this.focusedNode);
1800
1806
  $5c74fef433be2b0a$var$safeRun(this.props.onSelect, this.selectedNodes);
1801
1807
  }
1808
+ setSelection(args) {
1809
+ const ids = new Set(args.ids?.map($5c74fef433be2b0a$var$identify));
1810
+ const anchor = $5c74fef433be2b0a$var$identifyNull(args.anchor);
1811
+ const mostRecent = $5c74fef433be2b0a$var$identifyNull(args.mostRecent);
1812
+ this.dispatch((0, $58f9381615aa3d17$export$e324594224ef24da).set({
1813
+ ids: ids,
1814
+ anchor: anchor,
1815
+ mostRecent: mostRecent
1816
+ }));
1817
+ $5c74fef433be2b0a$var$safeRun(this.props.onSelect, this.selectedNodes);
1818
+ }
1802
1819
  /* Drag and Drop */ get cursorParentId() {
1803
1820
  const { cursor: cursor } = this.state.dnd;
1804
1821
  switch(cursor.type){