react-native-tree-multi-select 3.0.0-beta.3 → 3.0.0-beta.5

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.
Files changed (96) hide show
  1. package/README.md +100 -30
  2. package/lib/module/TreeView.js +36 -31
  3. package/lib/module/TreeView.js.map +1 -1
  4. package/lib/module/components/CheckboxView.js +8 -4
  5. package/lib/module/components/CheckboxView.js.map +1 -1
  6. package/lib/module/components/CustomExpandCollapseIcon.js +2 -2
  7. package/lib/module/components/CustomExpandCollapseIcon.js.map +1 -1
  8. package/lib/module/components/DragOverlay.js +17 -5
  9. package/lib/module/components/DragOverlay.js.map +1 -1
  10. package/lib/module/components/DropIndicator.js +2 -2
  11. package/lib/module/components/DropIndicator.js.map +1 -1
  12. package/lib/module/components/NodeList.js +78 -58
  13. package/lib/module/components/NodeList.js.map +1 -1
  14. package/lib/module/constants/treeView.constants.js +3 -0
  15. package/lib/module/constants/treeView.constants.js.map +1 -1
  16. package/lib/module/helpers/expandCollapse.helper.js.map +1 -1
  17. package/lib/module/helpers/moveTreeNode.helper.js +30 -0
  18. package/lib/module/helpers/moveTreeNode.helper.js.map +1 -1
  19. package/lib/module/helpers/selectAll.helper.js.map +1 -1
  20. package/lib/module/helpers/toggleCheckbox.helper.js +43 -60
  21. package/lib/module/helpers/toggleCheckbox.helper.js.map +1 -1
  22. package/lib/module/hooks/useDragDrop.js +146 -65
  23. package/lib/module/hooks/useDragDrop.js.map +1 -1
  24. package/lib/module/{handlers/ScrollToNodeHandler.js → hooks/useScrollToNode.js} +27 -26
  25. package/lib/module/hooks/useScrollToNode.js.map +1 -0
  26. package/lib/module/index.js +1 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/jest.setup.js +14 -1
  29. package/lib/module/jest.setup.js.map +1 -1
  30. package/lib/module/store/treeView.store.js +3 -0
  31. package/lib/module/store/treeView.store.js.map +1 -1
  32. package/lib/module/utils/typedMemo.js +3 -3
  33. package/lib/module/utils/typedMemo.js.map +1 -1
  34. package/lib/module/utils/useDeepCompareEffect.js +5 -5
  35. package/lib/module/utils/useDeepCompareEffect.js.map +1 -1
  36. package/lib/typescript/src/TreeView.d.ts +3 -3
  37. package/lib/typescript/src/TreeView.d.ts.map +1 -1
  38. package/lib/typescript/src/components/CheckboxView.d.ts +1 -2
  39. package/lib/typescript/src/components/CheckboxView.d.ts.map +1 -1
  40. package/lib/typescript/src/components/CustomExpandCollapseIcon.d.ts +1 -2
  41. package/lib/typescript/src/components/CustomExpandCollapseIcon.d.ts.map +1 -1
  42. package/lib/typescript/src/components/DragOverlay.d.ts +1 -0
  43. package/lib/typescript/src/components/DragOverlay.d.ts.map +1 -1
  44. package/lib/typescript/src/components/DropIndicator.d.ts +1 -2
  45. package/lib/typescript/src/components/DropIndicator.d.ts.map +1 -1
  46. package/lib/typescript/src/components/NodeList.d.ts.map +1 -1
  47. package/lib/typescript/src/constants/treeView.constants.d.ts +2 -0
  48. package/lib/typescript/src/constants/treeView.constants.d.ts.map +1 -1
  49. package/lib/typescript/src/helpers/expandCollapse.helper.d.ts +2 -2
  50. package/lib/typescript/src/helpers/expandCollapse.helper.d.ts.map +1 -1
  51. package/lib/typescript/src/helpers/moveTreeNode.helper.d.ts.map +1 -1
  52. package/lib/typescript/src/helpers/selectAll.helper.d.ts +4 -4
  53. package/lib/typescript/src/helpers/selectAll.helper.d.ts.map +1 -1
  54. package/lib/typescript/src/helpers/toggleCheckbox.helper.d.ts +3 -0
  55. package/lib/typescript/src/helpers/toggleCheckbox.helper.d.ts.map +1 -1
  56. package/lib/typescript/src/hooks/useDragDrop.d.ts +24 -8
  57. package/lib/typescript/src/hooks/useDragDrop.d.ts.map +1 -1
  58. package/lib/typescript/src/{handlers/ScrollToNodeHandler.d.ts → hooks/useScrollToNode.d.ts} +13 -15
  59. package/lib/typescript/src/hooks/useScrollToNode.d.ts.map +1 -0
  60. package/lib/typescript/src/index.d.ts +4 -3
  61. package/lib/typescript/src/index.d.ts.map +1 -1
  62. package/lib/typescript/src/jest.setup.d.ts +1 -1
  63. package/lib/typescript/src/jest.setup.d.ts.map +1 -1
  64. package/lib/typescript/src/store/treeView.store.d.ts +2 -1
  65. package/lib/typescript/src/store/treeView.store.d.ts.map +1 -1
  66. package/lib/typescript/src/types/dragDrop.types.d.ts +10 -0
  67. package/lib/typescript/src/types/dragDrop.types.d.ts.map +1 -1
  68. package/lib/typescript/src/types/treeView.types.d.ts +79 -41
  69. package/lib/typescript/src/types/treeView.types.d.ts.map +1 -1
  70. package/lib/typescript/src/utils/typedMemo.d.ts +1 -1
  71. package/lib/typescript/src/utils/typedMemo.d.ts.map +1 -1
  72. package/lib/typescript/src/utils/useDeepCompareEffect.d.ts +2 -2
  73. package/lib/typescript/src/utils/useDeepCompareEffect.d.ts.map +1 -1
  74. package/package.json +32 -15
  75. package/src/TreeView.tsx +57 -35
  76. package/src/components/CheckboxView.tsx +7 -4
  77. package/src/components/CustomExpandCollapseIcon.tsx +2 -2
  78. package/src/components/DragOverlay.tsx +19 -6
  79. package/src/components/DropIndicator.tsx +2 -2
  80. package/src/components/NodeList.tsx +87 -60
  81. package/src/constants/treeView.constants.ts +4 -1
  82. package/src/helpers/expandCollapse.helper.ts +5 -5
  83. package/src/helpers/moveTreeNode.helper.ts +33 -0
  84. package/src/helpers/selectAll.helper.ts +10 -10
  85. package/src/helpers/toggleCheckbox.helper.ts +56 -68
  86. package/src/hooks/useDragDrop.ts +190 -80
  87. package/src/{handlers/ScrollToNodeHandler.tsx → hooks/useScrollToNode.ts} +48 -45
  88. package/src/index.tsx +11 -0
  89. package/src/jest.setup.ts +14 -1
  90. package/src/store/treeView.store.ts +6 -1
  91. package/src/types/dragDrop.types.ts +12 -0
  92. package/src/types/treeView.types.ts +87 -43
  93. package/src/utils/typedMemo.ts +3 -3
  94. package/src/utils/useDeepCompareEffect.ts +13 -7
  95. package/lib/module/handlers/ScrollToNodeHandler.js.map +0 -1
  96. package/lib/typescript/src/handlers/ScrollToNodeHandler.d.ts.map +0 -1
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  /**
4
- * ScrollToNodeHandler Component
4
+ * useScrollToNode Hook
5
5
  *
6
- * This component provides an imperative handle to scroll to a specified node within a tree view.
6
+ * Provides an imperative handle to scroll to a specified node within a tree view.
7
7
  * The scrolling action is orchestrated via a two-step "milestone" mechanism that ensures the target
8
8
  * node is both expanded in the tree and that the rendered list reflects this expansion before the scroll
9
9
  * is performed.
@@ -34,11 +34,10 @@
34
34
  * in the UI, thus preventing issues with attempting to scroll to an element that does not exist yet.
35
35
  */
36
36
 
37
- import React from "react";
37
+ import { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
38
38
  import { expandNodes } from "../helpers/expandCollapse.helper.js";
39
39
  import { useTreeViewStore } from "../store/treeView.store.js";
40
40
  import { useShallow } from "zustand/react/shallow";
41
- import { typedMemo } from "../utils/typedMemo.js";
42
41
  import { fastIsEqual } from "fast-is-equal";
43
42
  // Enum representing the two milestones needed before scrolling
44
43
  var ExpandQueueAction = /*#__PURE__*/function (ExpandQueueAction) {
@@ -46,14 +45,15 @@ var ExpandQueueAction = /*#__PURE__*/function (ExpandQueueAction) {
46
45
  ExpandQueueAction[ExpandQueueAction["RENDERED"] = 1] = "RENDERED";
47
46
  return ExpandQueueAction;
48
47
  }(ExpandQueueAction || {});
49
- function _innerScrollToNodeHandler(props, ref) {
48
+ export function useScrollToNode(params) {
50
49
  const {
51
50
  storeId,
51
+ scrollToNodeHandlerRef,
52
52
  flashListRef,
53
53
  flattenedFilteredNodes,
54
54
  setInitialScrollIndex,
55
55
  initialScrollNodeID
56
- } = props;
56
+ } = params;
57
57
  const {
58
58
  expanded,
59
59
  childToParentMap
@@ -61,26 +61,26 @@ function _innerScrollToNodeHandler(props, ref) {
61
61
  expanded: state.expanded,
62
62
  childToParentMap: state.childToParentMap
63
63
  })));
64
- React.useImperativeHandle(ref, () => ({
65
- scrollToNodeID: params => {
66
- queuedScrollToNodeParams.current = params;
64
+
65
+ // Ref to store the scroll parameters for the queued action.
66
+ const queuedScrollToNodeParams = useRef(null);
67
+
68
+ // State to track progression: first the expansion is triggered, then the list is rendered.
69
+ const [expandAndScrollToNodeQueue, setExpandAndScrollToNodeQueue] = useState([]);
70
+ useImperativeHandle(scrollToNodeHandlerRef, () => ({
71
+ scrollToNodeID: scrollParams => {
72
+ queuedScrollToNodeParams.current = scrollParams;
67
73
  // Mark that expansion is initiated.
68
74
  setExpandAndScrollToNodeQueue([ExpandQueueAction.EXPANDED]);
69
75
  // Trigger expansion logic (this may update the store and subsequently re-render the list).
70
76
  expandNodes(storeId, [queuedScrollToNodeParams.current.nodeId], !queuedScrollToNodeParams.current.expandScrolledNode);
71
77
  }
72
78
  }), [storeId]);
73
-
74
- // Ref to store the scroll parameters for the queued action.
75
- const queuedScrollToNodeParams = React.useRef(null);
76
-
77
- // State to track progression: first the expansion is triggered, then the list is rendered.
78
- const [expandAndScrollToNodeQueue, setExpandAndScrollToNodeQueue] = React.useState([]);
79
- const latestFlattenedFilteredNodesRef = React.useRef(flattenedFilteredNodes);
79
+ const latestFlattenedFilteredNodesRef = useRef(flattenedFilteredNodes);
80
80
 
81
81
  /* When the rendered node list changes, update the ref.
82
82
  If an expansion was triggered, mark that the list is now rendered. */
83
- React.useEffect(() => {
83
+ useEffect(() => {
84
84
  setExpandAndScrollToNodeQueue(prevQueue => {
85
85
  if (prevQueue.includes(ExpandQueueAction.EXPANDED)) {
86
86
  latestFlattenedFilteredNodesRef.current = flattenedFilteredNodes;
@@ -93,7 +93,7 @@ function _innerScrollToNodeHandler(props, ref) {
93
93
 
94
94
  /* Once the target node is expanded and the list is updated (milestones reached),
95
95
  perform the scroll using the latest node list. */
96
- React.useLayoutEffect(() => {
96
+ useLayoutEffect(() => {
97
97
  if (queuedScrollToNodeParams.current === null) return;
98
98
  if (!fastIsEqual(expandAndScrollToNodeQueue, [ExpandQueueAction.EXPANDED, ExpandQueueAction.RENDERED])) {
99
99
  return;
@@ -107,11 +107,15 @@ function _innerScrollToNodeHandler(props, ref) {
107
107
  parentId = childToParentMap.get(queuedScrollToNodeParams.current.nodeId);
108
108
  }
109
109
 
110
- // Ensure if the parent is expanded before proceeding to scroll to the node
110
+ // Ensure if the parent is expanded before proceeding to scroll to the node.
111
+ // This fires transiently during the milestone system - the layout effect runs
112
+ // before the expansion has propagated to the store, then retries on next render.
113
+ /* istanbul ignore next -- async timing guard: expansion not yet propagated to store */
111
114
  if (parentId && !expanded.has(parentId)) return;
112
115
  }
113
116
  // If node is set to expand
114
117
  else {
118
+ /* istanbul ignore next -- async timing guard: node expansion not yet propagated */
115
119
  if (!expanded.has(queuedScrollToNodeParams.current.nodeId)) return;
116
120
  }
117
121
  const {
@@ -131,6 +135,7 @@ function _innerScrollToNodeHandler(props, ref) {
131
135
  viewPosition
132
136
  });
133
137
  } else {
138
+ /* istanbul ignore next -- __DEV__ is false in test/production */
134
139
  if (__DEV__) {
135
140
  console.info("Cannot find the item of the mentioned id to scroll in the rendered tree view list data!");
136
141
  }
@@ -146,8 +151,8 @@ function _innerScrollToNodeHandler(props, ref) {
146
151
  ////////////////////////////// Handle Initial Scroll /////////////////////////////
147
152
  /* On first render, if an initial scroll target is provided, determine its index.
148
153
  This is done only once. */
149
- const initialScrollDone = React.useRef(false);
150
- React.useLayoutEffect(() => {
154
+ const initialScrollDone = useRef(false);
155
+ useLayoutEffect(() => {
151
156
  if (initialScrollDone.current) return;
152
157
  const index = flattenedFilteredNodes.findIndex(item => item.id === initialScrollNodeID);
153
158
  setInitialScrollIndex(index);
@@ -157,9 +162,5 @@ function _innerScrollToNodeHandler(props, ref) {
157
162
  // eslint-disable-next-line react-hooks/exhaustive-deps
158
163
  }, [flattenedFilteredNodes, initialScrollNodeID]);
159
164
  /////////////////////////////////////////////////////////////////////////////////
160
-
161
- return null;
162
165
  }
163
- const _ScrollToNodeHandler = /*#__PURE__*/React.forwardRef(_innerScrollToNodeHandler);
164
- export const ScrollToNodeHandler = typedMemo(_ScrollToNodeHandler);
165
- //# sourceMappingURL=ScrollToNodeHandler.js.map
166
+ //# sourceMappingURL=useScrollToNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useImperativeHandle","useLayoutEffect","useRef","useState","expandNodes","useTreeViewStore","useShallow","fastIsEqual","ExpandQueueAction","useScrollToNode","params","storeId","scrollToNodeHandlerRef","flashListRef","flattenedFilteredNodes","setInitialScrollIndex","initialScrollNodeID","expanded","childToParentMap","state","queuedScrollToNodeParams","expandAndScrollToNodeQueue","setExpandAndScrollToNodeQueue","scrollToNodeID","scrollParams","current","EXPANDED","nodeId","expandScrolledNode","latestFlattenedFilteredNodesRef","prevQueue","includes","RENDERED","parentId","has","get","animated","viewOffset","viewPosition","scrollToItem","index","findIndex","item","id","scrollToIndex","__DEV__","console","info","initialScrollDone"],"sourceRoot":"../../../src","sources":["hooks/useScrollToNode.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,MAAM,EACNC,QAAQ,QAKH,OAAO;AACd,SAASC,WAAW,QAAQ,qCAAkC;AAC9D,SAASC,gBAAgB,QAAQ,4BAAyB;AAC1D,SAASC,UAAU,QAAQ,uBAAuB;AAElD,SAASC,WAAW,QAAQ,eAAe;AAe3C;AAAA,IACKC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA,EAAjBA,iBAAiB;AActB,OAAO,SAASC,eAAeA,CAAKC,MAAiC,EAAE;EACrE,MAAM;IACJC,OAAO;IACPC,sBAAsB;IACtBC,YAAY;IACZC,sBAAsB;IACtBC,qBAAqB;IACr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MACA3B,wBAAwB,CAACK,OAAO,GAAG,IAAI;MACvCH,6BAA6B,CAAC,EAAE,CAAC;IACnC;IAEAiB,YAAY,CAAC,CAAC;EAChB,CAAC,EAAE,CAACrB,gBAAgB,EAAED,QAAQ,EAAEJ,YAAY,EAAEQ,0BAA0B,CAAC,CAAC;;EAE1E;EACA;AACF;EACE,MAAM2B,iBAAiB,GAAG9C,MAAM,CAAC,KAAK,CAAC;EACvCD,eAAe,CAAC,MAAM;IACpB,IAAI+C,iBAAiB,CAACvB,OAAO,EAAE;IAE/B,MAAMe,KAAK,GAAG1B,sBAAsB,CAAC2B,SAAS,CAC5CC,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAK3B,mBACtB,CAAC;IAEDD,qBAAqB,CAACyB,KAAK,CAAC;IAE5B,IAAIA,KAAK,KAAK,CAAC,CAAC,EAAE;MAChBQ,iBAAiB,CAACvB,OAAO,GAAG,IAAI;IAClC;IACA;EACF,CAAC,EAAE,CAACX,sBAAsB,EAAEE,mBAAmB,CAAC,CAAC;EACjD;AACF","ignoreList":[]}
@@ -3,4 +3,5 @@
3
3
  export * from "./TreeView.js";
4
4
  export * from "./components/CheckboxView.js";
5
5
  export { moveTreeNode } from "./helpers/moveTreeNode.helper.js";
6
+ export { deleteTreeViewStore } from "./store/treeView.store.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["moveTreeNode"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAsBA,cAAc,eAAY;AAC1B,cAAc,8BAA2B;AACzC,SAASA,YAAY,QAAQ,kCAA+B","ignoreList":[]}
1
+ {"version":3,"names":["moveTreeNode","deleteTreeViewStore"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AA2BA,cAAc,eAAY;AAC1B,cAAc,8BAA2B;AACzC,SAASA,YAAY,QAAQ,kCAA+B;AAC5D,SAASC,mBAAmB,QAAQ,2BAAwB","ignoreList":[]}
@@ -1,4 +1,17 @@
1
1
  "use strict";
2
2
 
3
- import "@testing-library/jest-native/extend-expect";
3
+ import "@testing-library/react-native/extend-expect";
4
+ import { configure } from "@testing-library/react-native";
5
+
6
+ // Skip host component auto-detection which fails in RN 0.78+ jest environment.
7
+ // The type definition doesn't include hostComponentNames yet, but it works at runtime.
8
+ configure({
9
+ hostComponentNames: {
10
+ text: "Text",
11
+ textInput: "TextInput",
12
+ switch: "RCTSwitch",
13
+ scrollView: "RCTScrollView",
14
+ modal: "Modal"
15
+ }
16
+ });
4
17
  //# sourceMappingURL=jest.setup.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["jest.setup.ts"],"mappings":";;AAAA,OAAO,4CAA4C","ignoreList":[]}
1
+ {"version":3,"names":["configure","hostComponentNames","text","textInput","switch","scrollView","modal"],"sourceRoot":"../../src","sources":["jest.setup.ts"],"mappings":";;AAAA,OAAO,6CAA6C;AACpD,SAASA,SAAS,QAAQ,+BAA+B;;AAEzD;AACA;AACCA,SAAS,CAAS;EACfC,kBAAkB,EAAE;IAChBC,IAAI,EAAE,MAAM;IACZC,SAAS,EAAE,WAAW;IACtBC,MAAM,EAAE,WAAW;IACnBC,UAAU,EAAE,eAAe;IAC3BC,KAAK,EAAE;EACX;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -96,6 +96,9 @@ export function getTreeViewStore(id) {
96
96
  }
97
97
  return typedStore().get(id);
98
98
  }
99
+ export function deleteTreeViewStore(id) {
100
+ treeViewStores.delete(id);
101
+ }
99
102
  export function useTreeViewStore(id) {
100
103
  return getTreeViewStore(id);
101
104
  }
@@ -1 +1 @@
1
- {"version":3,"names":["create","treeViewStores","Map","typedStore","getTreeViewStore","id","has","store","set","checked","Set","updateChecked","indeterminate","updateIndeterminate","expanded","updateExpanded","initialTreeViewData","updateInitialTreeViewData","nodeMap","updateNodeMap","childToParentMap","updateChildToParentMap","searchText","updateSearchText","searchKeys","updateSearchKeys","innerMostChildrenIds","updateInnerMostChildrenIds","selectionPropagation","toChildren","toParents","setSelectionPropagation","draggedNodeId","updateDraggedNodeId","invalidDragTargetIds","updateInvalidDragTargetIds","dropTargetNodeId","dropPosition","dropLevel","updateDropTarget","nodeId","position","level","cleanUpTreeViewStore","get","useTreeViewStore"],"sourceRoot":"../../../src","sources":["store/treeView.store.ts"],"mappings":";;AAEA,SAASA,MAAM,QAA2C,SAAS;AA6DnE;AACA,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAA0D,CAAC;AACzF;AACA,MAAMC,UAA6E,GAAGA,CAAA,KAAUF,cAAyE;AAEzK,OAAO,SAASG,gBAAgBA,CAAKC,EAAU,EAA8C;EACzF,IAAI,CAACF,UAAU,CAAK,CAAC,CAACG,GAAG,CAACD,EAAE,CAAC,EAAE;IAC3B,MAAME,KAAK,GAAGP,MAAM,CAAqBQ,GAAG,KAAM;MAC9CC,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;MAClBC,aAAa,EAAGF,OAAgB,IAAKD,GAAG,CAAC;QAAEC;MAAQ,CAAC,CAAC;MAErDG,aAAa,EAAE,IAAIF,GAAG,CAAC,CAAC;MACxBG,mBAAmB,EAAGD,aAAsB,IAAKJ,GAAG,CAAC;QAAEI;MAAc,CAAC,CAAC;MAEvEE,QAAQ,EAAE,IAAIJ,GAAG,CAAK,CAAC;MACvBK,cAAc,EAAGD,QAAiB,IAAKN,GAAG,CAAC;QAAEM;MAAS,CAAC,CAAC;MAExDE,mBAAmB,EAAE,EAAE;MACvBC,yBAAyB,EAAGD,mBAAmC,IAAKR,GAAG,CAAC;QACpEQ;MACJ,CAAC,CAAC;MAEFE,OAAO,EAAE,IAAIhB,GAAG,CAAmB,CAAC;MACpCiB,aAAa,EAAGD,OAA8B,IAAKV,GAAG,CAAC;QAAEU;MAAQ,CAAC,CAAC;MAEnEE,gBAAgB,EAAE,IAAIlB,GAAG,CAAS,CAAC;MACnCmB,sBAAsB,EAAGD,gBAA6B,IAAKZ,GAAG,CAAC;QAC3DY;MACJ,CAAC,CAAC;MAE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AAC;QACxBI,QAAQ,EAAE,IAAIJ,GAAG,CAAK,CAAC;QACvBM,mBAAmB,EAAE,EAAE;QACvBE,OAAO,EAAE,IAAIhB,GAAG,CAAmB,CAAC;QACpCkB,gBAAgB,EAAE,IAAIlB,GAAG,CAAS,CAAC;QACnCoB,UAAU,EAAE,EAAE;QACdE,UAAU,EAAE,CAAC,EAAE,CAAC;QAChBE,oBAAoB,EAAE,EAAE;QACxBE,oBAAoB,EAAE;UAAEC,UAAU,EAAE,IAAI;UAAEC,SAAS,EAAE;QAAK,CAAC;QAC3DE,aAAa,EAAE,IAAI;QACnBE,oBAAoB,EAAE,IAAIxB,GAAG,CAAK,CAAC;QACnC0B,gBAAgB,EAAE,IAAI;QACtBC,YAAY,EAAE,IAAI;QAClBC,SAAS,EAAE;MACf,CAAC;IACT,CAAC,CAAC,CAAC;IAEHnC,UAAU,CAAK,CAAC,CAACK,GAAG,CAACH,EAAE,EAAEE,KAAK,CAAC;EACnC;EACA,OAAOJ,UAAU,CAAK,CAAC,CAACyC,GAAG,CAACvC,EAAE,CAAC;AACnC;AAEA,OAAO,SAASwC,gBAAgBA,CAAcxC,EAAU,EAAE;EACtD,OAAOD,gBAAgB,CAAKC,EAAE,CAAC;AACnC","ignoreList":[]}
1
+ {"version":3,"names":["create","treeViewStores","Map","typedStore","getTreeViewStore","id","has","store","set","checked","Set","updateChecked","indeterminate","updateIndeterminate","expanded","updateExpanded","initialTreeViewData","updateInitialTreeViewData","nodeMap","updateNodeMap","childToParentMap","updateChildToParentMap","searchText","updateSearchText","searchKeys","updateSearchKeys","innerMostChildrenIds","updateInnerMostChildrenIds","selectionPropagation","toChildren","toParents","setSelectionPropagation","draggedNodeId","updateDraggedNodeId","invalidDragTargetIds","updateInvalidDragTargetIds","dropTargetNodeId","dropPosition","dropLevel","updateDropTarget","nodeId","position","level","cleanUpTreeViewStore","get","deleteTreeViewStore","delete","useTreeViewStore"],"sourceRoot":"../../../src","sources":["store/treeView.store.ts"],"mappings":";;A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EAAE;QACdE,UAAU,EAAE,CAAC,EAAE,CAAC;QAChBE,oBAAoB,EAAE,EAAE;QACxBE,oBAAoB,EAAE;UAAEC,UAAU,EAAE,IAAI;UAAEC,SAAS,EAAE;QAAK,CAAC;QAC3DE,aAAa,EAAE,IAAI;QACnBE,oBAAoB,EAAE,IAAIxB,GAAG,CAAK,CAAC;QACnC0B,gBAAgB,EAAE,IAAI;QACtBC,YAAY,EAAE,IAAI;QAClBC,SAAS,EAAE;MACf,CAAC;IACT,CAAC,CAAC,CAAC;IAEHnC,UAAU,CAAK,CAAC,CAACK,GAAG,CAACH,EAAE,EAAEE,KAAK,CAAC;EACnC;EACA,OAAOJ,UAAU,CAAK,CAAC,CAACyC,GAAG,CAACvC,EAAE,CAAC;AACnC;AAEA,OAAO,SAASwC,mBAAmBA,CAACxC,EAAU,EAAE;EAC5CJ,cAAc,CAAC6C,MAAM,CAACzC,EAAE,CAAC;AAC7B;AAEA,OAAO,SAAS0C,gBAAgBA,CAAc1C,EAAU,EAAE;EACtD,OAAOD,gBAAgB,CAAKC,EAAE,CAAC;AACnC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import React from "react";
3
+ import { memo } from "react";
4
4
 
5
- /** wrapper for React.memo that works with generic components. */
6
- export const typedMemo = React.memo;
5
+ /** wrapper for memo that works with generic components. */
6
+ export const typedMemo = memo;
7
7
  //# sourceMappingURL=typedMemo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","typedMemo","memo"],"sourceRoot":"../../../src","sources":["utils/typedMemo.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;AACA,OAAO,MAAMC,SAAyB,GAAGD,KAAK,CAACE,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["memo","typedMemo"],"sourceRoot":"../../../src","sources":["utils/typedMemo.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;;AAE5B;AACA,OAAO,MAAMC,SAAyB,GAAGD,IAAI","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import React from "react";
3
+ import { useEffect, useMemo, useRef } from "react";
4
4
  import { fastIsEqual } from "fast-is-equal";
5
5
 
6
6
  /**
@@ -12,20 +12,20 @@ import { fastIsEqual } from "fast-is-equal";
12
12
  */
13
13
  export default function useDeepCompareEffect(effect, deps) {
14
14
  // Ref to track if it's the first render
15
- const firstRenderRef = React.useRef(true);
15
+ const firstRenderRef = useRef(true);
16
16
 
17
17
  // Memoized dependencies to avoid redundant `isEqual` checks
18
- const memoizedDependencies = React.useMemo(() => deps, [deps]);
18
+ const memoizedDependencies = useMemo(() => deps, [deps]);
19
19
 
20
20
  // Ref to store the previous dependencies
21
- const dependenciesRef = React.useRef(memoizedDependencies);
21
+ const dependenciesRef = useRef(memoizedDependencies);
22
22
 
23
23
  // Check for dependency changes
24
24
  const dependenciesChanged = !fastIsEqual(dependenciesRef.current, memoizedDependencies);
25
25
  if (dependenciesChanged) {
26
26
  dependenciesRef.current = memoizedDependencies;
27
27
  }
28
- React.useEffect(() => {
28
+ useEffect(() => {
29
29
  if (firstRenderRef.current) {
30
30
  firstRenderRef.current = false;
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","fastIsEqual","useDeepCompareEffect","effect","deps","firstRenderRef","useRef","memoizedDependencies","useMemo","dependenciesRef","dependenciesChanged","current","useEffect"],"sourceRoot":"../../../src","sources":["utils/useDeepCompareEffect.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,eAAe;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAC1CC,MAA4B,EAC5BC,IAA0B,EAC1B;EACA;EACA,MAAMC,cAAc,GAAGL,KAAK,CAACM,MAAM,CAAU,IAAI,CAAC;;EAElD;EACA,MAAMC,oBAAoB,GAAGP,KAAK,CAACQ,OAAO,CAAC,MAAMJ,IAAI,EAAE,CAACA,IAAI,CAAC,CAAC;;EAE9D;EACA,MAAMK,eAAe,GAAGT,KAAK,CAACM,MAAM,CAAuBC,oBAAoB,CAAC;;EAEhF;EACA,MAAMG,mBAAmB,GAAG,CAACT,WAAW,CACtCQ,eAAe,CAACE,OAAO,EACvBJ,oBACF,CAAC;EACD,IAAIG,mBAAmB,EAAE;IACvBD,eAAe,CAACE,OAAO,GAAGJ,oBAAoB;EAChD;EAEAP,KAAK,CAACY,SAAS,CAAC,MAAM;IACpB,IAAIP,cAAc,CAACM,OAAO,EAAE;MAC1BN,cAAc,CAACM,OAAO,GAAG,KAAK;IAChC;IAEA,OAAOR,MAAM,CAAC,CAAC;IACf;EACF,CAAC,EAAE,CAACO,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAC7B","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useMemo","useRef","fastIsEqual","useDeepCompareEffect","effect","deps","firstRenderRef","memoizedDependencies","dependenciesRef","dependenciesChanged","current"],"sourceRoot":"../../../src","sources":["utils/useDeepCompareEffect.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,OAAO,EACPC,MAAM,QAGD,OAAO;AACd,SAASC,WAAW,QAAQ,eAAe;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAC1CC,MAAsB,EACtBC,IAAoB,EACpB;EACA;EACA,MAAMC,cAAc,GAAGL,MAAM,CAAU,IAAI,CAAC;;EAE5C;EACA,MAAMM,oBAAoB,GAAGP,OAAO,CAAC,MAAMK,IAAI,EAAE,CAACA,IAAI,CAAC,CAAC;;EAExD;EACA,MAAMG,eAAe,GAAGP,MAAM,CAAiBM,oBAAoB,CAAC;;EAEpE;EACA,MAAME,mBAAmB,GAAG,CAACP,WAAW,CACtCM,eAAe,CAACE,OAAO,EACvBH,oBACF,CAAC;EACD,IAAIE,mBAAmB,EAAE;IACvBD,eAAe,CAACE,OAAO,GAAGH,oBAAoB;EAChD;EAEAR,SAAS,CAAC,MAAM;IACd,IAAIO,cAAc,CAACI,OAAO,EAAE;MAC1BJ,cAAc,CAACI,OAAO,GAAG,KAAK;IAChC;IAEA,OAAON,MAAM,CAAC,CAAC;IACf;EACF,CAAC,EAAE,CAACK,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAC7B","ignoreList":[]}
@@ -1,8 +1,8 @@
1
- import React from "react";
1
+ import { type ForwardedRef } from "react";
2
2
  import type { TreeViewProps, TreeViewRef } from "./types/treeView.types";
3
- declare function _innerTreeView<ID>(props: TreeViewProps<ID>, ref: React.ForwardedRef<TreeViewRef<ID>>): import("react/jsx-runtime").JSX.Element;
3
+ declare function _innerTreeView<ID>(props: TreeViewProps<ID>, ref: ForwardedRef<TreeViewRef<ID>>): import("react/jsx-runtime").JSX.Element;
4
4
  export declare const TreeView: <ID>(props: TreeViewProps<ID> & {
5
- ref?: React.ForwardedRef<TreeViewRef<ID>>;
5
+ ref?: ForwardedRef<TreeViewRef<ID>>;
6
6
  }) => ReturnType<typeof _innerTreeView>;
7
7
  export {};
8
8
  //# sourceMappingURL=TreeView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../../src/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAEX,aAAa,EACb,WAAW,EACX,MAAM,wBAAwB,CAAC;AA0BhC,iBAAS,cAAc,CAAC,EAAE,EACzB,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,EACxB,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,2CAwOxC;AAMD,eAAO,MAAM,QAAQ,GAJkC,EAAE,SACjD,aAAa,CAAC,EAAE,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;CAAE,KACrE,UAAU,CAAC,OAAO,cAAc,CAEyB,CAAC"}
1
+ {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../../src/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQN,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAEX,aAAa,EACb,WAAW,EACX,MAAM,wBAAwB,CAAC;AA4BhC,iBAAS,cAAc,CAAC,EAAE,EACzB,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,EACxB,GAAG,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,2CAmPlC;AAMD,eAAO,MAAM,QAAQ,GAJ4B,EAAE,SAC3C,aAAa,CAAC,EAAE,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;CAAE,KAC/D,UAAU,CAAC,OAAO,cAAc,CAEyB,CAAC"}
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import type { BuiltInCheckBoxViewProps } from "../types/treeView.types";
3
- export declare const CheckboxView: React.MemoExoticComponent<typeof _CheckboxView>;
2
+ export declare const CheckboxView: import("react").MemoExoticComponent<typeof _CheckboxView>;
4
3
  declare function _CheckboxView(props: BuiltInCheckBoxViewProps): import("react/jsx-runtime").JSX.Element;
5
4
  export declare const defaultCheckboxViewStyles: {
6
5
  mainView: {
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxView.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EACR,wBAAwB,EAE3B,MAAM,yBAAyB,CAAC;AAajC,eAAO,MAAM,YAAY,iDAA2C,CAAC;AAErE,iBAAS,aAAa,CAAC,KAAK,EAAE,wBAAwB,2CAiErD;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;CAgBpC,CAAC"}
1
+ {"version":3,"file":"CheckboxView.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxView.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,wBAAwB,EAE3B,MAAM,yBAAyB,CAAC;AAejC,eAAO,MAAM,YAAY,2DAAqC,CAAC;AAE/D,iBAAS,aAAa,CAAC,KAAK,EAAE,wBAAwB,2CAiErD;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;CAiBpC,CAAC"}
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import { type ExpandIconProps } from "../types/treeView.types";
3
- export declare const CustomExpandCollapseIcon: React.MemoExoticComponent<typeof _CustomExpandCollapseIcon>;
2
+ export declare const CustomExpandCollapseIcon: import("react").MemoExoticComponent<typeof _CustomExpandCollapseIcon>;
4
3
  declare function _CustomExpandCollapseIcon(props: ExpandIconProps): import("react/jsx-runtime").JSX.Element | null;
5
4
  export {};
6
5
  //# sourceMappingURL=CustomExpandCollapseIcon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomExpandCollapseIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/CustomExpandCollapseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAqB/D,eAAO,MAAM,wBAAwB,6DAEpC,CAAC;AAEF,iBAAS,yBAAyB,CAAC,KAAK,EAAE,eAAe,kDAoBxD"}
1
+ {"version":3,"file":"CustomExpandCollapseIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/CustomExpandCollapseIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAqB/D,eAAO,MAAM,wBAAwB,uEAEpC,CAAC;AAEF,iBAAS,yBAAyB,CAAC,KAAK,EAAE,eAAe,kDAoBxD"}
@@ -1,6 +1,7 @@
1
1
  import { Animated } from "react-native";
2
2
  import type { __FlattenedTreeNode__, DragDropCustomizations, TreeItemCustomizations } from "../types/treeView.types";
3
3
  interface DragOverlayProps<ID> extends TreeItemCustomizations<ID> {
4
+ storeId: string;
4
5
  overlayY: Animated.Value;
5
6
  overlayX: Animated.Value;
6
7
  node: __FlattenedTreeNode__<ID>;
@@ -1 +1 @@
1
- {"version":3,"file":"DragOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/DragOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EACR,qBAAqB,EAErB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,yBAAyB,CAAC;AAKjC,UAAU,gBAAgB,CAAC,EAAE,CAAE,SAAQ,sBAAsB,CAAC,EAAE,CAAC;IAC7D,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,IAAI,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;CACvD;AAED,iBAAS,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,2CAkEpD;AAED,eAAO,MAAM,WAAW,EAA+B,OAAO,YAAY,CAAC"}
1
+ {"version":3,"file":"DragOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/DragOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EACR,qBAAqB,EAErB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,yBAAyB,CAAC;AAQjC,UAAU,gBAAgB,CAAC,EAAE,CAAE,SAAQ,sBAAsB,CAAC,EAAE,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,IAAI,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;CACvD;AAED,iBAAS,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,2CA2EpD;AAED,eAAO,MAAM,WAAW,qBAA0B,CAAC"}
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { Animated } from "react-native";
3
2
  import type { DropPosition } from "../types/dragDrop.types";
4
3
  interface DropIndicatorProps {
@@ -8,6 +7,6 @@ interface DropIndicatorProps {
8
7
  targetLevel: number;
9
8
  indentationMultiplier: number;
10
9
  }
11
- export declare const DropIndicator: React.NamedExoticComponent<DropIndicatorProps>;
10
+ export declare const DropIndicator: import("react").NamedExoticComponent<DropIndicatorProps>;
12
11
  export {};
13
12
  //# sourceMappingURL=DropIndicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/DropIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,UAAU,kBAAkB;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,aAAa,gDAgDxB,CAAC"}
1
+ {"version":3,"file":"DropIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/DropIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,UAAU,kBAAkB;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,aAAa,0DAgDxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NodeList.d.ts","sourceRoot":"","sources":["../../../../src/components/NodeList.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIR,aAAa,EAGhB,MAAM,yBAAyB,CAAC;AAoBjC,QAAA,MAAM,QAAQ,kBAAuB,CAAC;AACtC,eAAe,QAAQ,CAAC;AAExB,iBAAS,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,2CA4N9C"}
1
+ {"version":3,"file":"NodeList.d.ts","sourceRoot":"","sources":["../../../../src/components/NodeList.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAGR,aAAa,EAGhB,MAAM,yBAAyB,CAAC;AAwBjC,QAAA,MAAM,QAAQ,kBAAuB,CAAC;AACtC,eAAe,QAAQ,CAAC;AAExB,iBAAS,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,2CAqP9C"}
@@ -1,2 +1,4 @@
1
1
  export declare const defaultIndentationMultiplier = 15;
2
+ /** Padding used by the FlashList header/footer component. Total header height = 2 * this value. */
3
+ export declare const listHeaderFooterPadding = 5;
2
4
  //# sourceMappingURL=treeView.constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"treeView.constants.d.ts","sourceRoot":"","sources":["../../../../src/constants/treeView.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
1
+ {"version":3,"file":"treeView.constants.d.ts","sourceRoot":"","sources":["../../../../src/constants/treeView.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,mGAAmG;AACnG,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
@@ -10,11 +10,11 @@ export declare function handleToggleExpand<ID>(storeId: string, id: ID): void;
10
10
  /**
11
11
  * Expand all nodes in the tree.
12
12
  */
13
- export declare function expandAll(storeId: string): void;
13
+ export declare function expandAll<ID>(storeId: string): void;
14
14
  /**
15
15
  * Collapse all nodes in the tree.
16
16
  */
17
- export declare function collapseAll(storeId: string): void;
17
+ export declare function collapseAll<ID>(storeId: string): void;
18
18
  /**
19
19
  * Expand tree nodes of given ids. If the id is of a child, it also expands
20
20
  * its ancestors up to the root.
@@ -1 +1 @@
1
- {"version":3,"file":"expandCollapse.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/expandCollapse.helper.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,QAoC7D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,QAMxC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,QAK1C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAC1B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,EAAE,EAAE,EACT,0BAA0B,GAAE,OAAe,QA0B9C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,QA6B3D"}
1
+ {"version":3,"file":"expandCollapse.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/expandCollapse.helper.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,QAoC7D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAM5C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAK9C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAC1B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,EAAE,EAAE,EACT,0BAA0B,GAAE,OAAe,QA0B9C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,QA6B3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"moveTreeNode.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/moveTreeNode.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAC3B,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,EACpB,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,EAAE,EAChB,QAAQ,EAAE,YAAY,GACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAehB"}
1
+ {"version":3,"file":"moveTreeNode.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/moveTreeNode.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAC3B,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,EACpB,aAAa,EAAE,EAAE,EACjB,YAAY,EAAE,EAAE,EAChB,QAAQ,EAAE,YAAY,GACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAkBhB"}
@@ -4,25 +4,25 @@ import { type TreeNode } from "../types/treeView.types";
4
4
  *
5
5
  * If there is no search text, then it selects all nodes; otherwise, it selects all visible nodes.
6
6
  */
7
- export declare function selectAllFiltered(storeId: string): void;
7
+ export declare function selectAllFiltered<ID>(storeId: string): void;
8
8
  /**
9
9
  * Unselects all nodes that are currently visible due to the applied filter.
10
10
  *
11
11
  * If there is no search text, then it unselects all nodes; otherwise, it unselects all visible nodes.
12
12
  */
13
- export declare function unselectAllFiltered(storeId: string): void;
13
+ export declare function unselectAllFiltered<ID>(storeId: string): void;
14
14
  /**
15
15
  * Selects all nodes in the tree.
16
16
  *
17
17
  * This function selects all nodes by adding all node ids to the checked set and clearing the indeterminate set.
18
18
  */
19
- export declare function selectAll(storeId: string): void;
19
+ export declare function selectAll<ID>(storeId: string): void;
20
20
  /**
21
21
  * Unselects all nodes in the tree.
22
22
  *
23
23
  * This function unselects all nodes by clearing both the checked and indeterminate sets.
24
24
  */
25
- export declare function unselectAll(storeId: string): void;
25
+ export declare function unselectAll<ID>(storeId: string): void;
26
26
  /**
27
27
  * Get the ids of the innermost children in the tree
28
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"selectAll.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/selectAll.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,QAWhD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,QAWlD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,QAcxC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,QAO1C;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,EAAE,EAC5C,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,GAClC,EAAE,EAAE,CAgBN"}
1
+ {"version":3,"file":"selectAll.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/selectAll.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAWpD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAWtD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAc5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAO9C;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,EAAE,EAC5C,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,GAClC,EAAE,EAAE,CAgBN"}
@@ -1,3 +1,6 @@
1
+ import type { CheckboxValueType } from "../types/treeView.types";
2
+ /** Derive the tri-state checkbox value from checked and indeterminate booleans. */
3
+ export declare function getCheckboxValue(isChecked: boolean, isIndeterminate: boolean): CheckboxValueType;
1
4
  /**
2
5
  * Function to toggle checkbox state for a tree structure.
3
6
  * It sets the checked and indeterminate state for all affected nodes in the tree after an action to check/uncheck is made.
@@ -1 +1 @@
1
- {"version":3,"file":"toggleCheckbox.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/toggleCheckbox.helper.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAC/B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,EAAE,EAAE,EACT,UAAU,CAAC,EAAE,OAAO,QA6LvB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QAyF3D"}
1
+ {"version":3,"file":"toggleCheckbox.helper.d.ts","sourceRoot":"","sources":["../../../../src/helpers/toggleCheckbox.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,yBAAyB,CAAC;AAG3E,mFAAmF;AACnF,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,OAAO,EAClB,eAAe,EAAE,OAAO,GACzB,iBAAiB,CAGnB;AA2CD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAC/B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,EAAE,EAAE,EACT,UAAU,CAAC,EAAE,OAAO,QA0JvB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,QA6D3D"}
@@ -1,25 +1,41 @@
1
+ import { MutableRefObject, RefObject } from "react";
1
2
  import { Animated, type PanResponderInstance } from "react-native";
2
3
  import type { FlashList } from "@shopify/flash-list";
3
- import type { __FlattenedTreeNode__, TreeNode } from "../types/treeView.types";
4
- import type { DragEndEvent, DropTarget } from "../types/dragDrop.types";
4
+ import type { __FlattenedTreeNode__, TreeNode, DropAutoScrollOptions } from "../types/treeView.types";
5
+ import type { ScrollToNodeHandlerRef } from "./useScrollToNode";
6
+ import type { DragCancelEvent, DragEndEvent, DragStartEvent, DropTarget } from "../types/dragDrop.types";
5
7
  interface UseDragDropParams<ID> {
6
8
  storeId: string;
7
9
  flattenedNodes: __FlattenedTreeNode__<ID>[];
8
- flashListRef: React.RefObject<FlashList<__FlattenedTreeNode__<ID>> | null>;
9
- containerRef: React.RefObject<{
10
+ flashListRef: RefObject<FlashList<__FlattenedTreeNode__<ID>> | null>;
11
+ containerRef: RefObject<{
10
12
  measureInWindow: (cb: (x: number, y: number, w: number, h: number) => void) => void;
11
13
  } | null>;
12
14
  dragEnabled: boolean;
15
+ onDragStart?: (event: DragStartEvent<ID>) => void;
13
16
  onDragEnd?: (event: DragEndEvent<ID>) => void;
17
+ onDragCancel?: (event: DragCancelEvent<ID>) => void;
14
18
  longPressDuration: number;
15
19
  autoScrollThreshold: number;
16
20
  autoScrollSpeed: number;
17
- internalDataRef: React.MutableRefObject<TreeNode<ID>[] | null>;
18
- measuredItemHeightRef: React.MutableRefObject<number>;
21
+ internalDataRef: MutableRefObject<TreeNode<ID>[] | null>;
22
+ measuredItemHeightRef: MutableRefObject<number>;
19
23
  dragOverlayOffset: number;
20
24
  autoExpandDelay: number;
21
25
  /** Pixels per nesting level, used for magnetic overlay shift. */
22
26
  indentationMultiplier: number;
27
+ /** Callback to determine if a drop is allowed on a specific target. */
28
+ canDrop?: (draggedNode: TreeNode<ID>, targetNode: TreeNode<ID>, position: "above" | "below" | "inside") => boolean;
29
+ /** Maximum nesting depth allowed. */
30
+ maxDepth?: number;
31
+ /** Callback to determine if a node can accept children. */
32
+ canNodeHaveChildren?: (node: TreeNode<ID>) => boolean;
33
+ /** Ref for scrolling to a node after drop. */
34
+ scrollToNodeHandlerRef: RefObject<ScrollToNodeHandlerRef<ID> | null>;
35
+ /** Auto-scroll configuration for after drop. */
36
+ autoScrollToDroppedNode?: boolean | DropAutoScrollOptions;
37
+ /** Callback to determine if a node can be dragged. */
38
+ canDrag?: (node: TreeNode<ID>) => boolean;
23
39
  }
24
40
  interface UseDragDropReturn<ID> {
25
41
  panResponder: PanResponderInstance;
@@ -32,8 +48,8 @@ interface UseDragDropReturn<ID> {
32
48
  handleNodeTouchStart: (nodeId: ID, pageY: number, locationY: number, nodeIndex: number) => void;
33
49
  handleNodeTouchEnd: () => void;
34
50
  cancelLongPressTimer: () => void;
35
- scrollOffsetRef: React.MutableRefObject<number>;
36
- headerOffsetRef: React.MutableRefObject<number>;
51
+ scrollOffsetRef: MutableRefObject<number>;
52
+ headerOffsetRef: MutableRefObject<number>;
37
53
  }
38
54
  export declare function useDragDrop<ID>(params: UseDragDropParams<ID>): UseDragDropReturn<ID>;
39
55
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useDragDrop.d.ts","sour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gB,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,wBAAgB,WAAW,CAAC,EAAE,EAC1B,MAAM,EAAE,iBAAiB,CAAC,EAAE,CAAC,GAC9B,iBAAiB,CAAC,EAAE,CAAC,CAs2BvB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * ScrollToNodeHandler Component
2
+ * useScrollToNode Hook
3
3
  *
4
- * This component provides an imperative handle to scroll to a specified node within a tree view.
4
+ * Provides an imperative handle to scroll to a specified node within a tree view.
5
5
  * The scrolling action is orchestrated via a two-step "milestone" mechanism that ensures the target
6
6
  * node is both expanded in the tree and that the rendered list reflects this expansion before the scroll
7
7
  * is performed.
@@ -31,15 +31,8 @@
31
31
  * This design ensures that the scroll action is performed only after the target node is fully present
32
32
  * in the UI, thus preventing issues with attempting to scroll to an element that does not exist yet.
33
33
  */
34
- import React from "react";
34
+ import { type Dispatch, type MutableRefObject, type RefObject, type SetStateAction } from "react";
35
35
  import { type __FlattenedTreeNode__ } from "../types/treeView.types";
36
- interface Props<ID> {
37
- storeId: string;
38
- flashListRef: React.MutableRefObject<any>;
39
- flattenedFilteredNodes: __FlattenedTreeNode__<ID>[];
40
- setInitialScrollIndex: React.Dispatch<React.SetStateAction<number>>;
41
- initialScrollNodeID: ID | undefined;
42
- }
43
36
  export interface ScrollToNodeParams<ID> {
44
37
  nodeId: ID;
45
38
  expandScrolledNode?: boolean;
@@ -50,9 +43,14 @@ export interface ScrollToNodeParams<ID> {
50
43
  export interface ScrollToNodeHandlerRef<ID> {
51
44
  scrollToNodeID: (params: ScrollToNodeParams<ID>) => void;
52
45
  }
53
- declare function _innerScrollToNodeHandler<ID>(props: Props<ID>, ref: React.ForwardedRef<ScrollToNodeHandlerRef<ID>>): null;
54
- export declare const ScrollToNodeHandler: <ID>(props: Props<ID> & {
55
- ref?: React.ForwardedRef<ScrollToNodeHandlerRef<ID>>;
56
- }) => ReturnType<typeof _innerScrollToNodeHandler>;
46
+ interface UseScrollToNodeParams<ID> {
47
+ storeId: string;
48
+ scrollToNodeHandlerRef: RefObject<ScrollToNodeHandlerRef<ID>>;
49
+ flashListRef: MutableRefObject<any>;
50
+ flattenedFilteredNodes: __FlattenedTreeNode__<ID>[];
51
+ setInitialScrollIndex: Dispatch<SetStateAction<number>>;
52
+ initialScrollNodeID: ID | undefined;
53
+ }
54
+ export declare function useScrollToNode<ID>(params: UseScrollToNodeParams<ID>): void;
57
55
  export {};
58
- //# sourceMappingURL=ScrollToNodeHandler.d.ts.map
56
+ //# sourceMappingURL=useScrollToNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollToNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScrollToNode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGrE,MAAM,WAAW,kBAAkB,CAAC,EAAE;IACpC,MAAM,EAAE,EAAE,CAAC;IACX,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB,CAAC,EAAE;IACxC,cAAc,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CAC1D;AAQD,UAAU,qBAAqB,CAAC,EAAE;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,SAAS,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,YAAY,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACpC,sBAAsB,EAAE,qBAAqB,CAAC,EAAE,CAAC,EAAE,CAAC;IACpD,qBAAqB,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,mBAAmB,EAAE,EAAE,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,QAiJpE"}
@@ -1,7 +1,8 @@
1
- import type { TreeNode, NodeRowProps, TreeViewProps, TreeViewRef, TreeFlatListProps, ExpandIconProps, CheckBoxViewProps, CheckboxValueType, BuiltInCheckBoxViewStyleProps, SelectionPropagation, DragDropCustomizations, DragOverlayStyleProps, DragOverlayComponentProps, DropIndicatorStyleProps, DropIndicatorComponentProps } from "./types/treeView.types";
2
- import type { DragEndEvent, DropPosition } from "./types/dragDrop.types";
1
+ import type { TreeNode, NodeRowProps, TreeViewProps, TreeViewRef, TreeFlatListProps, ExpandIconProps, CheckBoxViewProps, CheckboxValueType, BuiltInCheckBoxViewStyleProps, SelectionPropagation, DragAndDropOptions, DropAutoScrollOptions, DragDropCustomizations, DragOverlayStyleProps, DragOverlayComponentProps, DropIndicatorStyleProps, DropIndicatorComponentProps, DragHandleProps } from "./types/treeView.types";
2
+ import type { DragCancelEvent, DragEndEvent, DragStartEvent, DropPosition } from "./types/dragDrop.types";
3
3
  export * from "./TreeView";
4
4
  export * from "./components/CheckboxView";
5
5
  export { moveTreeNode } from "./helpers/moveTreeNode.helper";
6
- export type { TreeNode, NodeRowProps, TreeViewProps, TreeViewRef, TreeFlatListProps, ExpandIconProps, CheckBoxViewProps, CheckboxValueType, BuiltInCheckBoxViewStyleProps, SelectionPropagation, DragEndEvent, DropPosition, DragDropCustomizations, DragOverlayStyleProps, DragOverlayComponentProps, DropIndicatorStyleProps, DropIndicatorComponentProps, };
6
+ export { deleteTreeViewStore } from "./store/treeView.store";
7
+ export type { TreeNode, NodeRowProps, TreeViewProps, TreeViewRef, TreeFlatListProps, ExpandIconProps, CheckBoxViewProps, CheckboxValueType, BuiltInCheckBoxViewStyleProps, SelectionPropagation, DragAndDropOptions, DropAutoScrollOptions, DragCancelEvent, DragEndEvent, DragStartEvent, DropPosition, DragDropCustomizations, DragOverlayStyleProps, DragOverlayComponentProps, DropIndicatorStyleProps, DropIndicatorComponentProps, DragHandleProps, };
7
8
  //# sourceMappingURL=index.d.ts.map