react-native-tree-multi-select 1.5.0-beta.2 → 1.5.0-beta.3

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.
@@ -66,11 +66,11 @@ function _NodeList(props) {
66
66
  removeClippedSubviews: true,
67
67
  keyboardShouldPersistTaps: "handled",
68
68
  drawDistance: 50,
69
- data: flattenedFilteredNodes,
70
- renderItem: nodeRenderer,
71
69
  ListHeaderComponent: /*#__PURE__*/_jsx(HeaderFooterView, {}),
72
70
  ListFooterComponent: /*#__PURE__*/_jsx(HeaderFooterView, {}),
73
- ...treeFlashListProps
71
+ ...treeFlashListProps,
72
+ data: flattenedFilteredNodes,
73
+ renderItem: nodeRenderer
74
74
  });
75
75
  }
76
76
  ;
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","StyleSheet","TouchableOpacity","FlashList","useTreeViewStore","getFilteredTreeData","getFlattenedTreeData","getInnerMostChildrenIdsInTree","handleToggleExpand","toggleCheckboxes","CheckboxView","CustomExpandCollapseIcon","defaultIndentationMultiplier","useShallow","jsx","_jsx","jsxs","_jsxs","NodeList","memo","_NodeList","props","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","CustomNodeRowComponent","expanded","initialTreeViewData","updateInnerMostChildrenIds","searchKeys","searchText","state","filteredTree","useMemo","trim","toLowerCase","flattenedFilteredNodes","useEffect","updatedInnerMostChildrenIds","nodeRenderer","useCallback","item","Node","node","level","estimatedItemSize","removeClippedSubviews","keyboardShouldPersistTaps","drawDistance","data","renderItem","ListHeaderComponent","HeaderFooterView","ListFooterComponent","style","styles","defaultHeaderFooter","getValue","isChecked","isIndeterminate","_Node","isExpanded","value","has","id","checked","indeterminate","_onToggleExpand","_onCheck","nodeCheckboxAndArrowRow","paddingStart","children","text","name","onValueChange","length","nodeExpandableArrowTouchable","onPress","checkedValue","onCheck","onExpand","create","padding","flex","flexDirection","alignItems","minWid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AC7BzB,mBAAmB,EAAE;IACjB0B,OAAO,EAAE;EACb,CAAC;EACDN,4BAA4B,EAAE;IAC1BO,IAAI,EAAE;EACV,CAAC;EACDd,uBAAuB,EAAE;IACrBc,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE;EACd;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","View","StyleSheet","TouchableOpacity","FlashList","useTreeViewStore","getFilteredTreeData","getFlattenedTreeData","getInnerMostChildrenIdsInTree","handleToggleExpand","toggleCheckboxes","CheckboxView","CustomExpandCollapseIcon","defaultIndentationMultiplier","useShallow","jsx","_jsx","jsxs","_jsxs","NodeList","memo","_NodeList","props","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","CustomNodeRowComponent","expanded","initialTreeViewData","updateInnerMostChildrenIds","searchKeys","searchText","state","filteredTree","useMemo","trim","toLowerCase","flattenedFilteredNodes","useEffect","updatedInnerMostChildrenIds","nodeRenderer","useCallback","item","Node","node","level","estimatedItemSize","removeClippedSubviews","keyboardShouldPersistTaps","drawDistance","ListHeaderComponent","HeaderFooterView","ListFooterComponent","data","renderItem","style","styles","defaultHeaderFooter","getValue","isChecked","isIndeterminate","_Node","isExpanded","value","has","id","checked","indeterminate","_onToggleExpand","_onCheck","nodeCheckboxAndArrowRow","paddingStart","children","text","name","onValueChange","length","nodeExpandableArrowTouchable","onPress","checkedValue","onCheck","onExpand","create","padding","flex","flexDirection","alignItems","minWidth"],"sourceRoot":"../../../src","sources":["components/NodeList.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,IAAI,EACJC,UAAU,EAEVC,gBAAgB,QACb,cAAc;AACrB,SAASC,SAAS,QAAQ,qBAAqB;AAS/C,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SACIC,mBAAmB,EACnB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,CAAC,CAAC","ignoreList":[]}
@@ -12,52 +12,37 @@ import { useTreeViewStore } from "../store/treeView.store";
12
12
  */
13
13
  export function handleToggleExpand(id) {
14
14
  const {
15
- initialTreeViewData,
16
15
  expanded,
17
- updateExpanded
16
+ updateExpanded,
17
+ nodeMap
18
18
  } = useTreeViewStore.getState();
19
19
 
20
20
  // Create a new Set based on the current expanded state
21
21
  const newExpanded = new Set(expanded);
22
-
23
- /**
24
- * Recursively deletes a node and its descendants from the expanded set.
25
- *
26
- * @param node - The tree node to start deleting from.
27
- */
28
- function deleteChildrenFromExpanded(node) {
29
- if (node.children) {
30
- for (let child of node.children) {
31
- newExpanded.delete(child.id);
32
- deleteChildrenFromExpanded(child);
33
- }
34
- }
35
- }
36
-
37
- // Find the node to expand or collapse
38
- const node = findNode(initialTreeViewData, id);
39
22
  if (expanded.has(id)) {
40
23
  // If the node is currently expanded, collapse it and its descendants
41
24
  newExpanded.delete(id);
42
- /*
43
- istanbul ignore next:
44
-
45
- ignore because this condition is just added to satisfy
46
- typescript type check but the node will never be undefined if it is already in
47
- expanded Set
48
- */
49
- if (node) {
50
- deleteChildrenFromExpanded(node);
25
+
26
+ // Use an iterative approach to remove all descendants from the expanded set
27
+ const stack = [id];
28
+ while (stack.length > 0) {
29
+ const currentId = stack.pop();
30
+ const node = nodeMap.get(currentId);
31
+ if (node && node.children) {
32
+ for (const child of node.children) {
33
+ newExpanded.delete(child.id);
34
+ stack.push(child.id);
35
+ }
36
+ }
51
37
  }
52
38
  } else {
53
39
  // If the node is currently collapsed, expand it
54
40
  newExpanded.add(id);
55
41
  }
56
42
 
57
- // Set the new expanded state
43
+ // Update the expanded state
58
44
  updateExpanded(newExpanded);
59
45
  }
60
- ;
61
46
 
62
47
  /**
63
48
  * Expand all nodes in the tree.
@@ -71,7 +56,6 @@ export function expandAll() {
71
56
  const newExpanded = new Set(nodeMap.keys());
72
57
  updateExpanded(newExpanded);
73
58
  }
74
- ;
75
59
 
76
60
  /**
77
61
  * Collapse all nodes in the tree.
@@ -80,16 +64,14 @@ export function collapseAll() {
80
64
  const {
81
65
  updateExpanded
82
66
  } = useTreeViewStore.getState();
83
- // Create an empty Set
84
- const newExpanded = new Set();
85
- updateExpanded(newExpanded);
67
+ // Clear the expanded state
68
+ updateExpanded(new Set());
86
69
  }
87
- ;
88
70
 
89
71
  /**
90
72
  * Expand tree nodes of given ids. If the id is of a child, it also expands
91
- * the parent which it belongs to.
92
- * @param ids Ids of nodes to expand.
73
+ * its ancestors up to the root.
74
+ * @param ids - Ids of nodes to expand.
93
75
  */
94
76
  export function expandNodes(ids) {
95
77
  const {
@@ -98,29 +80,13 @@ export function expandNodes(ids) {
98
80
  childToParentMap
99
81
  } = useTreeViewStore.getState();
100
82
  const newExpanded = new Set(expanded);
101
- const processedParents = new Set(); // To track already processed parents
102
-
83
+ const processedIds = new Set();
103
84
  ids.forEach(id => {
104
- newExpanded.add(id); // Start by adding the node ID to the set
105
85
  let currentId = id;
106
- while (currentId && childToParentMap.has(currentId) && !processedParents.has(currentId)) {
107
- const parentId = childToParentMap.get(currentId);
108
- /*
109
- istanbul ignore else:
110
- ignore because this condition is just added to satisfy
111
- typescript type check as parentId will never be undefined if it is already in
112
- childToParentMap Map
113
- */
114
- if (parentId) {
115
- /* istanbul ignore else: nothing to be done in else block */
116
- if (!newExpanded.has(parentId)) {
117
- newExpanded.add(parentId); // Add the parent ID only if not already processed
118
- processedParents.add(parentId);
119
- }
120
- currentId = parentId; // Move up to the next parent
121
- } else {
122
- break; // Break the loop if there's no further parent
123
- }
86
+ while (currentId && !processedIds.has(currentId)) {
87
+ newExpanded.add(currentId);
88
+ processedIds.add(currentId);
89
+ currentId = childToParentMap.get(currentId);
124
90
  }
125
91
  });
126
92
  updateExpanded(newExpanded);
@@ -128,8 +94,8 @@ export function expandNodes(ids) {
128
94
 
129
95
  /**
130
96
  * Collapse tree nodes of given ids. If the id is of a parent, it also collapses
131
- * the children inside it.
132
- * @param ids Ids of nodes to collapse.
97
+ * its descendants.
98
+ * @param ids - Ids of nodes to collapse.
133
99
  */
134
100
  export function collapseNodes(ids) {
135
101
  const {
@@ -139,46 +105,25 @@ export function collapseNodes(ids) {
139
105
  } = useTreeViewStore.getState();
140
106
  const newExpanded = new Set(expanded);
141
107
 
142
- // Function to recursively remove child nodes from the expanded set
143
- const deleteChildrenFromExpanded = (nodeId, visited = new Set()) => {
144
- /*
145
- istanbul ignore next:
146
-
147
- ignore because this is a redundancy check.
148
- */
149
- if (visited.has(nodeId)) return; // Prevent redundant processing
150
- visited.add(nodeId);
151
- const node = nodeMap.get(nodeId);
152
- node?.children?.forEach(child => {
153
- newExpanded.delete(child.id);
154
- deleteChildrenFromExpanded(child.id, visited);
155
- });
108
+ // Use an iterative approach to remove all descendants from the expanded set
109
+ const deleteChildrenFromExpanded = nodeId => {
110
+ const stack = [nodeId];
111
+ while (stack.length > 0) {
112
+ const currentId = stack.pop();
113
+ const node = nodeMap.get(currentId);
114
+ if (node && node.children) {
115
+ for (const child of node.children) {
116
+ newExpanded.delete(child.id);
117
+ stack.push(child.id);
118
+ }
119
+ }
120
+ }
156
121
  };
157
122
  ids.forEach(id => {
158
- // Remove the node ID from the set and all its children
123
+ // Remove the node ID from the set and all its descendants
159
124
  newExpanded.delete(id);
160
125
  deleteChildrenFromExpanded(id);
161
126
  });
162
127
  updateExpanded(newExpanded);
163
128
  }
164
-
165
- /**
166
- * Finds a node in the tree by its ID.
167
- *
168
- * @param nodes - The array of tree nodes to search through.
169
- * @returns The found tree node, or undefined if not found.
170
- */
171
- function findNode(nodes, parentId) {
172
- for (let node of nodes) {
173
- if (node.id === parentId) {
174
- return node;
175
- } else if (node.children) {
176
- const found = findNode(node.children, parentId);
177
- if (found) {
178
- return found;
179
- }
180
- }
181
- }
182
- return undefined;
183
- }
184
129
  //# sourceMappingURL=expandCollapse.helper.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useTreeViewStore","handleToggleExpand","id","initialTreeViewData","expanded","updateExpanded","getState","newExpanded","Set","deleteChildrenFromExpanded","node","children","child","delete","findNode","has","add","expandAll","nodeMap","keys","collapseAll","expandNodes","ids","childToParentMap","processedParents","forEach","currentId","parentId","get","collapseNodes","nodeId","visited","nodes","found","undefined"],"sourceRoot":"../../../src","sources":["helpers/expandCollapse.helper.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,yBAAyB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,EAAU,EAAE;EAC3C,MAAM;IACFC,mBAAmB;IACnBC,QAAQ;IACRC;EACJ,CAAC,GAAGL,gBAAgB,CAACM,QAAQ,CAAC,CAAC;;EAE/B;EACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACJ,QAAQ,CAAC;;EAErC;AACJ;AACA;AACA;AACA;EACI,SAASK,0BAA0BA,CAACC,IAAc,EAAE;IAChD,IAAIA,IAAI,CAACC,QAAQ,EAAE;MACf,KAAK,IAAIC,KAAK,IAAIF,IAAI,CAACC,QAAQ,EAAE;QAC7BJ,WAAW,CAACM,MAAM,CAACD,KAAK,CAACV,EAAE,CAAC;QAC5BO,0BAA0B,CAACG,KAAK,CAAC;MACrC;IACJ;EACJ;;EAEA;EACA,MAAMF,IAAI,GAAGI,QAAQ,CAACX,mBAAmB,EAAED,EAAE,CAAC;EAE9C,IAAIE,QAAQ,CAACW,GAAG,CAACb,EAAE,CAAC,EAAE;IAClB;IACAK,WAAW,CAACM,MAAM,CAACX,EAAE,CAAC;IACtB;AACR;AACA;AACA;AACA;AACA;AACA;IACQ,IAAIQ,IAAI,EAAE;MACND,0BAA0B,CAACC,IAAI,CAAC;IACpC;EACJ,CAAC,MAAM;IACH;IACAH,WAAW,CAACS,GAAG,CAACd,EAAE,CAAC;EACvB;;EAEA;EACAG,cAAc,CAACE,WAAW,CAAC;AAC/B;AAAC;;AAED;AACA;AACA;AACA,OAAO,SAASU,SAASA,CAAA,EAAG;EACxB,MAAM;IAAEC,OAAO;IAAEb;E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,EAAE;IACpB,IAAItB,IAAI,CAACR,EAAE,KAAKyB,QAAQ,EAAE;MACtB,OAAOjB,IAAI;IACf,CAAC,MAAM,IAAIA,IAAI,CAACC,QAAQ,EAAE;MACtB,MAAMsB,KAAK,GAAGnB,QAAQ,CAACJ,IAAI,CAACC,QAAQ,EAAEgB,QAAQ,CAAC;MAC/C,IAAIM,KAAK,EAAE;QACP,OAAOA,KAAK;MAChB;IACJ;EACJ;EACA,OAAOC,SAAS;AACpB","ignoreList":[]}
1
+ {"version":3,"names":["useTreeViewStore","handleToggleExpand","id","expanded","updateExpanded","nodeMap","getState","newExpanded","Set","has","delete","stack","length","currentId","pop","node","get","children","child","push","add","expandAll","keys","collapseAll","expandNodes","ids","childToParentMap","processedIds","forEach","collapseNodes","deleteChildrenFromExpanded","nodeId"],"sourceRoot":"../../../src","sources":["helpers/expandCollapse.helper.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAyB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,EAAU,EAAE;EAC3C,MAAM;IACFC,QAAQ;IACRC,cAAc;IACdC;EACJ,CAAC,GAAGL,gBAAgB,CAACM,QAAQ,CAAC,CAAC;;EAE/B;EACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACL,QAAQ,CAAC;EAErC,IAAIA,QAAQ,CAACM,GAAG,CAACP,EAAE,CAAC,EAAE;IAClB;IACAK,WAAW,CAACG,MAAM,CAACR,EAAE,CAAC;;IAEtB;IACA,MAAMS,KAAK,GAAG,CAACT,EAAE,CAAC;IAElB,OAAOS,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;MACrB,MAAMC,SAAS,GAAGF,KAAK,CAACG,GAAG,CAAC,CAAE;MAC9B,MAAMC,IAAI,GAAGV,OAAO,CAACW,GAAG,CAACH,SAAS,CAAC;MAEnC,IAAIE,IAAI,IAAIA,IAAI,CAACE,QAAQ,EAAE;QACvB,KAAK,MA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CAAC;MAC1Bc,YAAY,CAACP,GAAG,CAACP,SAAS,CAAC;MAC3BA,SAAS,GAAGa,gBAAgB,CAACV,GAAG,CAACH,SAAS,CAAC;IAC/C;EACJ,CAAC,CAAC;EAEFT,cAAc,CAACG,WAAW,CAAC;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASsB,aAAaA,CAACJ,GAAa,EAAE;EACzC,MAAM;IAAEtB,QAAQ;IAAEC,cAAc;IAAEC;EAAQ,CAAC,GAAGL,gBAAgB,CAACM,QAAQ,CAAC,CAAC;EACzE,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACL,QAAQ,CAAC;;EAErC;EACA,MAAM2B,0BAA0B,GAAIC,MAAc,IAAK;IACnD,MAAMpB,KAAK,GAAG,CAACoB,MAAM,CAAC;IAEtB,OAAOpB,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;MACrB,MAAMC,SAAS,GAAGF,KAAK,CAACG,GAAG,CAAC,CAAE;MAC9B,MAAMC,IAAI,GAAGV,OAAO,CAACW,GAAG,CAACH,SAAS,CAAC;MAEnC,IAAIE,IAAI,IAAIA,IAAI,CAACE,QAAQ,EAAE;QACvB,KAAK,MAAMC,KAAK,IAAIH,IAAI,CAACE,QAAQ,EAAE;UAC/BV,WAAW,CAACG,MAAM,CAACQ,KAAK,CAAChB,EAAE,CAAC;UAC5BS,KAAK,CAACQ,IAAI,CAACD,KAAK,CAAChB,EAAE,CAAC;QACxB;MACJ;IACJ;EACJ,CAAC;EAEDuB,GAAG,CAACG,OAAO,CAAE1B,EAAE,IAAK;IAChB;IACAK,WAAW,CAACG,MAAM,CAACR,EAAE,CAAC;IACtB4B,0BAA0B,CAAC5B,EAAE,CAAC;EAClC,CAAC,CAAC;EAEFE,cAAc,CAACG,WAAW,CAAC;AAC/B","ignoreList":[]}
@@ -6,7 +6,7 @@ import { useTreeViewStore } from "../store/treeView.store";
6
6
  * Function to toggle checkbox state for a tree structure.
7
7
  * It sets the checked and indeterminate state for all affected nodes in the tree after an action to check/uncheck is made.
8
8
  * @param {string[]} ids - The ids of nodes that need to be checked or unchecked.
9
- * @param {boolean} [forceCheck] - Optional. If provided, will force the check state of the nodes to be this value.
9
+ * @param {boolean} [forceCheck] - Optional. If provided, will force the check state of the nodes to be this value.
10
10
  * If not provided, the check state will be toggled based on the current state.
11
11
  */
12
12
  export function toggleCheckboxes(ids, forceCheck) {
@@ -28,142 +28,156 @@ export function toggleCheckboxes(ids, forceCheck) {
28
28
  const tempChecked = new Set(checked);
29
29
  const tempIndeterminate = new Set(indeterminate);
30
30
 
31
- // Maps for memoization of the recursive functions areAllDescendantsChecked and areAnyDescendantsChecked.
32
- const memoAllDescendantsChecked = new Map();
33
- const memoAnyDescendantsChecked = new Map();
31
+ // Keep track of nodes that have been toggled or affected.
32
+ const affectedNodes = new Set();
34
33
 
35
- /**
36
- * Recursive function to check if all descendants of a node are checked.
37
- * It uses memoization to avoid redundant calculations.
38
- * @param {string} nodeId - The id of the node to be checked.
39
- * @returns {boolean} - Whether all descendants of the node are checked.
40
- */
41
- const areAllDescendantsChecked = nodeId => {
42
- // If the result for this node is already in the map, return it.
43
- if (memoAllDescendantsChecked.has(nodeId)) {
44
- return memoAllDescendantsChecked.get(nodeId);
45
- }
46
- const node = nodeMap.get(nodeId);
47
- let allChecked = true;
48
- if (node?.children) {
49
- // If the node has children, recursively check all children.
50
- for (const childNode of node.children) {
51
- allChecked = allChecked && areAllDescendantsChecked(childNode.id);
52
- }
53
- } else {
54
- // If the node has no children, its state is equal to whether it is in the checked set.
55
- allChecked = tempChecked.has(nodeId);
56
- }
57
-
58
- // Store the result in the map and return it.
59
- memoAllDescendantsChecked.set(nodeId, allChecked);
60
- return allChecked;
61
- };
62
-
63
- /**
64
- * Updated function to check if any descendants of a node are checked.
65
- * It uses memoization to avoid redundant calculations and avoids unnecessarily deep recursion.
66
- * @param {string} nodeId - The id of the node to be checked.
67
- * @returns {boolean} - Whether any descendants of the node are checked.
68
- */
69
- const areAnyDescendantsChecked = nodeId => {
70
- // If the result for this node is already in the map, return it.
71
- if (memoAnyDescendantsChecked.has(nodeId)) {
72
- return memoAnyDescendantsChecked.get(nodeId);
73
- }
74
- const node = nodeMap.get(nodeId);
75
- let anyChecked = false;
76
- if (node?.children) {
77
- // Check if any direct child is checked, without requiring all descendants.
78
- for (const childNode of node.children) {
79
- if (tempChecked.has(childNode.id) || areAnyDescendantsChecked(childNode.id)) {
80
- anyChecked = true;
81
- break;
82
- }
83
- }
84
- } else {
85
- // If the node has no children, its state is equal to whether it is in the checked set.
86
- anyChecked = tempChecked.has(nodeId);
87
- }
88
-
89
- // Store the result in the map and return it.
90
- memoAnyDescendantsChecked.set(nodeId, anyChecked);
91
- return anyChecked;
92
- };
34
+ // Memoization maps for node depths.
35
+ const nodeDepths = new Map();
93
36
 
94
- // Toggle the clicked nodes and their children.
37
+ // Step 1: Toggle the clicked nodes and their children without updating parents yet.
95
38
  ids.forEach(id => {
39
+ const node = nodeMap.get(id);
40
+ if (!node) {
41
+ // Node does not exist; skip processing this ID
42
+ return;
43
+ }
96
44
  const isChecked = tempChecked.has(id);
97
45
  const newCheckedState = forceCheck === undefined ? !isChecked : forceCheck;
98
46
  if (newCheckedState) {
99
47
  tempChecked.add(id);
100
48
  tempIndeterminate.delete(id);
49
+ affectedNodes.add(id);
101
50
  if (toChildren) {
102
- recursivelyUpdateChildren(id, true);
51
+ updateChildrenIteratively(id, true);
103
52
  }
104
53
  } else {
105
54
  tempChecked.delete(id);
106
55
  tempIndeterminate.delete(id);
56
+ affectedNodes.add(id);
107
57
  if (toChildren) {
108
- recursivelyUpdateChildren(id, false);
58
+ updateChildrenIteratively(id, false);
109
59
  }
110
60
  }
111
-
112
- // Skip updating parent nodes if toParents is false
113
- if (toParents) {
114
- updateParentNodes(id);
115
- }
116
61
  });
117
62
 
118
- // Function to recursively update children nodes as per childrenChecked value
119
- function recursivelyUpdateChildren(nodeId, childrenChecked) {
120
- const node = nodeMap.get(nodeId);
121
- if (node && node.children) {
122
- node.children.forEach(childNode => {
123
- if (childrenChecked) {
124
- tempChecked.add(childNode.id);
125
- tempIndeterminate.delete(childNode.id);
63
+ // Step 2: Collect all affected parent nodes.
64
+ const nodesToUpdate = new Set();
65
+ if (toParents) {
66
+ affectedNodes.forEach(id => {
67
+ let currentNodeId = id;
68
+ while (currentNodeId) {
69
+ const parentNodeId = childToParentMap.get(currentNodeId);
70
+ if (parentNodeId) {
71
+ nodesToUpdate.add(parentNodeId);
72
+ currentNodeId = parentNodeId;
126
73
  } else {
127
- tempChecked.delete(childNode.id);
128
- tempIndeterminate.delete(childNode.id);
74
+ break;
75
+ }
76
+ }
77
+ });
78
+ }
79
+
80
+ // Step 3: Update parent nodes in bottom-up order.
81
+ if (toParents && nodesToUpdate.size > 0) {
82
+ // Convert the set to an array and sort nodes by depth (deepest first).
83
+ const sortedNodes = Array.from(nodesToUpdate).sort((a, b) => {
84
+ return getNodeDepth(b) - getNodeDepth(a);
85
+ });
86
+ sortedNodes.forEach(nodeId => {
87
+ updateNodeState(nodeId);
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Function to iteratively update children nodes as per childrenChecked value.
93
+ * @param rootId - The ID of the root node to start updating from.
94
+ * @param childrenChecked - The desired checked state for children.
95
+ */
96
+ function updateChildrenIteratively(rootId, childrenChecked) {
97
+ const stack = [rootId];
98
+ while (stack.length > 0) {
99
+ const nodeId = stack.pop();
100
+ const node = nodeMap.get(nodeId);
101
+ if (!node) continue; // Node does not exist; skip
102
+
103
+ if (childrenChecked) {
104
+ tempChecked.add(nodeId);
105
+ tempIndeterminate.delete(nodeId);
106
+ } else {
107
+ tempChecked.delete(nodeId);
108
+ tempIndeterminate.delete(nodeId);
109
+ }
110
+ affectedNodes.add(nodeId);
111
+ if (node.children && node.children.length > 0) {
112
+ for (const childNode of node.children) {
113
+ stack.push(childNode.id);
129
114
  }
130
- recursivelyUpdateChildren(childNode.id, childrenChecked);
131
- });
115
+ }
132
116
  }
133
117
  }
134
118
 
135
- // Function to update parent nodes
136
- function updateParentNodes(nodeId) {
119
+ /**
120
+ * Function to get the depth of a node for sorting purposes, with memoization.
121
+ * @param nodeId - The ID of the node to get the depth for.
122
+ * @returns The depth of the node.
123
+ */
124
+ function getNodeDepth(nodeId) {
125
+ if (nodeDepths.has(nodeId)) {
126
+ return nodeDepths.get(nodeId);
127
+ }
128
+ let depth = 0;
137
129
  let currentNodeId = nodeId;
138
130
  while (currentNodeId) {
139
131
  const parentNodeId = childToParentMap.get(currentNodeId);
140
132
  if (parentNodeId) {
141
- if (tempChecked.has(parentNodeId)) {
142
- // If the parent node is currently checked, but not all child nodes are checked,
143
- // move the parent node to an indeterminate state
144
- if (!areAllDescendantsChecked(parentNodeId)) {
145
- tempChecked.delete(parentNodeId);
146
- tempIndeterminate.add(parentNodeId);
147
- }
148
- } else if (tempIndeterminate.has(parentNodeId)) {
149
- // If the parent node is currently in an indeterminate state,
150
- // then check if all descendants are checked
151
- if (areAllDescendantsChecked(parentNodeId)) {
152
- tempIndeterminate.delete(parentNodeId);
153
- tempChecked.add(parentNodeId);
154
- } else if (!areAnyDescendantsChecked(parentNodeId)) {
155
- // If no descendants are checked, remove from indeterminate set
156
- tempIndeterminate.delete(parentNodeId);
157
- }
158
- } else {
159
- // If the parent node is not checked or indeterminate,
160
- // check if any descendants are checked and update appropriately
161
- if (areAnyDescendantsChecked(parentNodeId)) {
162
- tempIndeterminate.add(parentNodeId);
163
- }
164
- }
133
+ depth++;
134
+ currentNodeId = parentNodeId;
135
+ } else {
136
+ break;
165
137
  }
166
- currentNodeId = parentNodeId;
138
+ }
139
+ nodeDepths.set(nodeId, depth);
140
+ return depth;
141
+ }
142
+
143
+ /**
144
+ * Function to update the state of a node based on its children's states.
145
+ * @param nodeId - The ID of the node to update.
146
+ */
147
+ function updateNodeState(nodeId) {
148
+ const node = nodeMap.get(nodeId);
149
+ if (!node || !node.children || node.children.length === 0) {
150
+ // Leaf nodes are already updated.
151
+ return;
152
+ }
153
+ let allChildrenChecked = true;
154
+ let anyChildCheckedOrIndeterminate = false;
155
+ for (const child of node.children) {
156
+ const isChecked = tempChecked.has(child.id);
157
+ const isIndeterminate = tempIndeterminate.has(child.id);
158
+ if (isChecked) {
159
+ anyChildCheckedOrIndeterminate = true;
160
+ } else if (isIndeterminate) {
161
+ anyChildCheckedOrIndeterminate = true;
162
+ allChildrenChecked = false;
163
+ } else {
164
+ allChildrenChecked = false;
165
+ }
166
+
167
+ // If both conditions are met, we can break early.
168
+ if (!allChildrenChecked && anyChildCheckedOrIndeterminate) {
169
+ break;
170
+ }
171
+ }
172
+ if (allChildrenChecked) {
173
+ tempChecked.add(nodeId);
174
+ tempIndeterminate.delete(nodeId);
175
+ } else if (anyChildCheckedOrIndeterminate) {
176
+ tempChecked.delete(nodeId);
177
+ tempIndeterminate.add(nodeId);
178
+ } else {
179
+ tempChecked.delete(nodeId);
180
+ tempIndeterminate.delete(nodeId);
167
181
  }
168
182
  }
169
183
 
@@ -1 +1 @@
1
- {"version":3,"names":["useTreeViewStore","toggleCheckboxes","ids","forceCheck","checked","updateChecked","indeterminate","updateIndeterminate","nodeMap","childToParentMap","selectionPropagation","getState","toChildren","toParents","tempChecked","Set","tempIndeterminate","memoAllDescendantsChecked","Map","memoAnyDescendantsChecked","areAllDescendantsChecked","nodeId","has","get","node","allChecked","children","childNode","id","set","areAnyDescendantsChecked","anyChecked","forEach","isChecked","newCheckedState","undefined","add","delete","recursivelyUpdateChildren","updateParentNodes","childrenChecked","currentNodeId","parentNodeId"],"sourceRoot":"../../../src","sources":["helpers/toggleCheckbox.helper.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAyB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,GAAa,EAAEC,UAAoB,EAAE;EAClE,MAAM;IACFC,OAAO;IACPC,aAAa;IAEbC,aAAa;IACbC,mBAAmB;IAEnBC,OAAO;IACPC,gBAAgB;IAChBC;EACJ,CAAC,GA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,wBAAwB,CAACY,YAAY,CAAC,EAAE;YAChD;YACA1B,iBAAiB,CAACqB,MAAM,CAACK,YAAY,CAAC;UAC1C;QACJ,CAAC,MAAM;UACH;UACA;UACA,IAAIZ,wBAAwB,CAACY,YAAY,CAAC,EAAE;YACxC1B,iBAAiB,CAACoB,GAAG,CAACM,YAAY,CAAC;UACvC;QACJ;MACJ;MACAD,aAAa,GAAGC,YAAY;IAChC;EACJ;;EAEA;EACArC,aAAa,CAACS,WAAW,CAAC;EAC1BP,mBAAmB,CAACS,iBAAiB,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"names":["useTreeViewStore","toggleCheckboxes","ids","forceCheck","checked","updateChecked","indeterminate","updateIndeterminate","nodeMap","childToParentMap","selectionPropagation","getState","toChildren","toParents","tempChecked","Set","tempIndeterminate","affectedNodes","nodeDepths","Map","forEach","id","node","get","isChecked","has","newCheckedState","undefined","add","delete","updateChildrenIteratively","nodesToUpdate","currentNodeId","parentNodeId","size","sortedNodes","Array","from","sort","a","b","getNodeDepth","nodeId","updateNodeState","rootId","childrenChecked","stack","length","pop","children","childNode","push","depth","set","allChildrenChecked","anyChildCheckedOrIndeterminate","child","isIndeterminate"],"sourceRoot":"../../../src","sources":["helpers/toggleCheckbox.helper.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,yBAAyB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,GAAa,EAAEC,UAAoB,EAAE;EAClE,MAAM;IACFC,OAAO;IACPC,aAAa;IAEbC,aAAa;IACbC,mBAAmB;IAEnBC,OAAO;IACPC,gBAAgB;IAChBC;EACJ,CAAC,GAAGV,gBAAgB,CAACW,QAAQ,CAAC,CAAC;EAE/B,MAAM;IAAEC,UAAU;IAAEC;EAAU,CAAC,GAAGH,oBAAoB;;EAEtD;EACA,MAAMI,WAAW,GAAG,IAAIC,GAAG,CAACX,OAAO,CAAC;EACpC,MAAMY,iBAAiB,GAAG,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AAS,EAAE;QACX+B,8BAA8B,GAAG,IAAI;MACzC,CAAC,MAAM,IAAIE,eAAe,EAAE;QACxBF,8BAA8B,GAAG,IAAI;QACrCD,kBAAkB,GAAG,KAAK;MAC9B,CAAC,MAAM;QACHA,kBAAkB,GAAG,KAAK;MAC9B;;MAEA;MACA,IAAI,CAACA,kBAAkB,IAAIC,8BAA8B,EAAE;QACvD;MACJ;IACJ;IAEA,IAAID,kBAAkB,EAAE;MACpBxC,WAAW,CAACc,GAAG,CAACc,MAAM,CAAC;MACvB1B,iBAAiB,CAACa,MAAM,CAACa,MAAM,CAAC;IACpC,CAAC,MAAM,IAAIa,8BAA8B,EAAE;MACvCzC,WAAW,CAACe,MAAM,CAACa,MAAM,CAAC;MAC1B1B,iBAAiB,CAACY,GAAG,CAACc,MAAM,CAAC;IACjC,CAAC,MAAM;MACH5B,WAAW,CAACe,MAAM,CAACa,MAAM,CAAC;MAC1B1B,iBAAiB,CAACa,MAAM,CAACa,MAAM,CAAC;IACpC;EACJ;;EAEA;EACArC,aAAa,CAACS,WAAW,CAAC;EAC1BP,mBAAmB,CAACS,iBAAiB,CAAC;AAC1C","ignoreList":[]}
@@ -17,14 +17,14 @@ export declare function expandAll(): void;
17
17
  export declare function collapseAll(): void;
18
18
  /**
19
19
  * Expand tree nodes of given ids. If the id is of a child, it also expands
20
- * the parent which it belongs to.
21
- * @param ids Ids of nodes to expand.
20
+ * its ancestors up to the root.
21
+ * @param ids - Ids of nodes to expand.
22
22
  */
23
23
  export declare function expandNodes(ids: string[]): void;
24
24
  /**
25
25
  * Collapse tree nodes of given ids. If the id is of a parent, it also collapses
26
- * the children inside it.
27
- * @param ids Ids of nodes to collapse.
26
+ * its descendants.
27
+ * @param ids - Ids of nodes to collapse.
28
28
  */
29
29
  export declare function collapseNodes(ids: string[]): void;
30
30
  //# sourceMappingURL=expandCollapse.helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expandCollapse.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/expandCollapse.helper.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,QA+C5C;AAED;;GAEG;AACH,wBAAgB,SAAS,SAKxB;AAED;;GAEG;AACH,wBAAgB,WAAW,SAK1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAgCxC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QA4B1C"}
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,MAAM,QAmC5C;AAED;;GAEG;AACH,wBAAgB,SAAS,SAKxB;AAED;;GAEG;AACH,wBAAgB,WAAW,SAI1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAexC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QA4B1C"}
@@ -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,GAAG,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,OAAO,QAoKnE"}
1
+ {"version":3,"file":"toggleCheckbox.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/toggleCheckbox.helper.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,OAAO,QA2LnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tree-multi-select",
3
- "version": "1.5.0-beta.2",
3
+ "version": "1.5.0-beta.3",
4
4
  "description": "Super-fast Tree view with multi-selection capabilities, using checkboxes and search filtering.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",