react-native-tree-multi-select 1.9.0 → 1.9.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 +3 -3
- package/lib/commonjs/components/NodeList.js +3 -3
- package/lib/module/components/NodeList.js +4 -4
- package/lib/module/store/treeView.store.js +1 -1
- package/lib/typescript/store/treeView.store.d.ts +1 -1
- package/package.json +12 -13
- package/src/components/NodeList.tsx +4 -4
- package/src/store/treeView.store.ts +1 -1
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ export function TreeViewUsageExample(){
|
|
|
121
121
|
|
|
122
122
|
| Property | Type | Required | Description |
|
|
123
123
|
| ---------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
|
|
124
|
-
| `data` | [TreeNode](#
|
|
124
|
+
| `data` | [TreeNode](#treenodeid--string)`<ID = string>[]` | Yes | An array of `TreeNode` objects |
|
|
125
125
|
| `onCheck` | `(checkedIds: ID[], indeterminateIds: ID[]) => void` | No | Callback when a checkbox state changes |
|
|
126
126
|
| `onExpand` | `(expandedIds: ID[]) => void` | No | Callback when a node is expanded |
|
|
127
127
|
| `preselectedIds` | `ID[]` | No | An array of `id`s that should be pre-selected |
|
|
@@ -134,7 +134,7 @@ export function TreeViewUsageExample(){
|
|
|
134
134
|
| `CheckboxComponent` | `ComponentType<`[CheckBoxViewProps](#checkboxviewprops)`>` | No | A custom checkbox component. Defaults to React Native Paper's Checkbox |
|
|
135
135
|
| `ExpandCollapseIconComponent` | `ComponentType<`[ExpandIconProps](#expandiconprops)`>` | No | A custom expand/collapse icon component |
|
|
136
136
|
| `ExpandCollapseTouchableComponent` | `ComponentType<`[TouchableOpacityProps](https://reactnative.dev/docs/touchableopacity#props)`>` | No | A custom expand/collapse touchable component |
|
|
137
|
-
| `CustomNodeRowComponent` | `React.ComponentType<`[NodeRowProps](#
|
|
137
|
+
| `CustomNodeRowComponent` | `React.ComponentType<`[NodeRowProps](#noderowpropsid--string)`<ID>>` | No | Custom row item component |
|
|
138
138
|
|
|
139
139
|
##### Notes
|
|
140
140
|
|
|
@@ -257,7 +257,7 @@ Type: `boolean` OR `"indeterminate"`
|
|
|
257
257
|
|
|
258
258
|
| Property | Type | Required | Description |
|
|
259
259
|
| -------------- | --------------------------------------- | -------- | ------------------------------------------------------- |
|
|
260
|
-
| `node` | [TreeNode](#
|
|
260
|
+
| `node` | [TreeNode](#treenodeid--string) | Yes | The node to be rendered |
|
|
261
261
|
| `level` | `number` | Yes | The depth of the node in the tree |
|
|
262
262
|
| `checkedValue` | [CheckboxValueType](#checkboxvaluetype) | Yes | The current value of the checkbox |
|
|
263
263
|
| `isExpanded` | `boolean` | Yes | Whether the node is expanded or not |
|
|
@@ -105,7 +105,7 @@ function HeaderFooterView() {
|
|
|
105
105
|
}
|
|
106
106
|
function getValue(isChecked, isIndeterminate) {
|
|
107
107
|
if (isIndeterminate) {
|
|
108
|
-
return
|
|
108
|
+
return "indeterminate";
|
|
109
109
|
} else if (isChecked) {
|
|
110
110
|
return true;
|
|
111
111
|
} else {
|
|
@@ -180,8 +180,8 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
180
180
|
},
|
|
181
181
|
nodeCheckboxAndArrowRow: {
|
|
182
182
|
flex: 1,
|
|
183
|
-
flexDirection:
|
|
184
|
-
alignItems:
|
|
183
|
+
flexDirection: "row",
|
|
184
|
+
alignItems: "center",
|
|
185
185
|
minWidth: "100%"
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -8,7 +8,7 @@ import { getFilteredTreeData, getFlattenedTreeData, getInnerMostChildrenIdsInTre
|
|
|
8
8
|
import { CheckboxView } from "./CheckboxView";
|
|
9
9
|
import { CustomExpandCollapseIcon } from "./CustomExpandCollapseIcon";
|
|
10
10
|
import { defaultIndentationMultiplier } from "../constants/treeView.constants";
|
|
11
|
-
import { useShallow } from
|
|
11
|
+
import { useShallow } from "zustand/react/shallow";
|
|
12
12
|
import { typedMemo } from "../utils/typedMemo";
|
|
13
13
|
import { ScrollToNodeHandler } from "../handlers/ScrollToNodeHandler";
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -100,7 +100,7 @@ function HeaderFooterView() {
|
|
|
100
100
|
}
|
|
101
101
|
function getValue(isChecked, isIndeterminate) {
|
|
102
102
|
if (isIndeterminate) {
|
|
103
|
-
return
|
|
103
|
+
return "indeterminate";
|
|
104
104
|
} else if (isChecked) {
|
|
105
105
|
return true;
|
|
106
106
|
} else {
|
|
@@ -175,8 +175,8 @@ const styles = StyleSheet.create({
|
|
|
175
175
|
},
|
|
176
176
|
nodeCheckboxAndArrowRow: {
|
|
177
177
|
flex: 1,
|
|
178
|
-
flexDirection:
|
|
179
|
-
alignItems:
|
|
178
|
+
flexDirection: "row",
|
|
179
|
+
alignItems: "center",
|
|
180
180
|
minWidth: "100%"
|
|
181
181
|
}
|
|
182
182
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SelectionPropagation, TreeNode } from "src/types/treeView.types";
|
|
2
|
-
import { StoreApi, UseBoundStore } from
|
|
2
|
+
import { StoreApi, UseBoundStore } from "zustand";
|
|
3
3
|
export type TreeViewState<ID> = {
|
|
4
4
|
checked: Set<ID>;
|
|
5
5
|
updateChecked: (checked: Set<ID>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tree-multi-select",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "A super-fast, customizable tree view component for React Native with multi-selection, checkboxes, and search filtering capabilities.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
|
|
38
38
|
"build:ios": "cd example/ios && pod install && xcodebuild -workspace TreeMultiSelectExample.xcworkspace -scheme TreeMultiSelectExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
|
|
39
39
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
40
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
40
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
41
|
+
"postinstall": "patch-package"
|
|
41
42
|
},
|
|
42
43
|
"keywords": [
|
|
43
44
|
"react-native",
|
|
@@ -82,21 +83,21 @@
|
|
|
82
83
|
"provenance": true
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
|
-
"@commitlint/config-conventional": "^19.
|
|
86
|
-
"@evilmartians/lefthook": "^1.
|
|
86
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
87
|
+
"@evilmartians/lefthook": "^1.10.10",
|
|
87
88
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
88
|
-
"@release-it/conventional-changelog": "^
|
|
89
|
+
"@release-it/conventional-changelog": "^10.0.0",
|
|
89
90
|
"@semantic-release/changelog": "^6.0.3",
|
|
90
91
|
"@semantic-release/git": "^10.0.1",
|
|
91
|
-
"@semantic-release/github": "^
|
|
92
|
+
"@semantic-release/github": "^11.0.1",
|
|
92
93
|
"@semantic-release/npm": "^12.0.1",
|
|
93
94
|
"@shopify/flash-list": "1.x.x",
|
|
94
95
|
"@testing-library/jest-native": "^5.4.3",
|
|
95
96
|
"@testing-library/react-native": "^12.6.1",
|
|
96
97
|
"@types/color": "^3.0.6",
|
|
97
98
|
"@types/jest": "^29.5.3",
|
|
98
|
-
"@types/lodash": "^4.17.
|
|
99
|
-
"@types/react": "
|
|
99
|
+
"@types/lodash": "^4.17.16",
|
|
100
|
+
"@types/react": "^18.0.24",
|
|
100
101
|
"@types/react-native": "0.70.0",
|
|
101
102
|
"@types/react-native-vector-icons": "^6.4.18",
|
|
102
103
|
"@types/react-test-renderer": "18.3.0",
|
|
@@ -106,21 +107,19 @@
|
|
|
106
107
|
"eslint-config-prettier": "^8.5.0",
|
|
107
108
|
"eslint-plugin-prettier": "^4.0.0",
|
|
108
109
|
"jest": "^29.7.0",
|
|
110
|
+
"patch-package": "^8.0.0",
|
|
109
111
|
"prettier": "^3.3.3",
|
|
110
112
|
"react": "18.2.0",
|
|
111
113
|
"react-native": "^0.72.15",
|
|
112
114
|
"react-native-builder-bob": "^0.30.0",
|
|
113
115
|
"react-native-paper": "5.x.x",
|
|
114
116
|
"react-test-renderer": "18.2.0",
|
|
115
|
-
"release-it": "^
|
|
117
|
+
"release-it": "^18.1.2",
|
|
116
118
|
"semantic-release": "^24.1.0",
|
|
117
119
|
"ts-jest": "^29.1.1",
|
|
118
120
|
"turbo": "^2.1.0",
|
|
119
121
|
"typescript": "^5.0.2"
|
|
120
122
|
},
|
|
121
|
-
"resolutions": {
|
|
122
|
-
"@types/react": "17.0.21"
|
|
123
|
-
},
|
|
124
123
|
"peerDependencies": {
|
|
125
124
|
"@shopify/flash-list": "1.x.x",
|
|
126
125
|
"react": "*",
|
|
@@ -211,7 +210,7 @@
|
|
|
211
210
|
"dependencies": {
|
|
212
211
|
"lodash": "^4.17.21",
|
|
213
212
|
"react-native-uuid": "^2.0.3",
|
|
214
|
-
"zustand": "^
|
|
213
|
+
"zustand": "^5.0.3"
|
|
215
214
|
},
|
|
216
215
|
"funding": [
|
|
217
216
|
{
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import { CheckboxView } from "./CheckboxView";
|
|
26
26
|
import { CustomExpandCollapseIcon } from "./CustomExpandCollapseIcon";
|
|
27
27
|
import { defaultIndentationMultiplier } from "../constants/treeView.constants";
|
|
28
|
-
import { useShallow } from
|
|
28
|
+
import { useShallow } from "zustand/react/shallow";
|
|
29
29
|
import { typedMemo } from "../utils/typedMemo";
|
|
30
30
|
import { ScrollToNodeHandler } from "../handlers/ScrollToNodeHandler";
|
|
31
31
|
|
|
@@ -157,7 +157,7 @@ function getValue(
|
|
|
157
157
|
isIndeterminate: boolean
|
|
158
158
|
): CheckboxValueType {
|
|
159
159
|
if (isIndeterminate) {
|
|
160
|
-
return
|
|
160
|
+
return "indeterminate";
|
|
161
161
|
} else if (isChecked) {
|
|
162
162
|
return true;
|
|
163
163
|
} else {
|
|
@@ -249,8 +249,8 @@ const styles = StyleSheet.create({
|
|
|
249
249
|
},
|
|
250
250
|
nodeCheckboxAndArrowRow: {
|
|
251
251
|
flex: 1,
|
|
252
|
-
flexDirection:
|
|
253
|
-
alignItems:
|
|
252
|
+
flexDirection: "row",
|
|
253
|
+
alignItems: "center",
|
|
254
254
|
minWidth: "100%"
|
|
255
255
|
}
|
|
256
256
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SelectionPropagation, TreeNode } from "src/types/treeView.types";
|
|
2
|
-
import { create, StoreApi, UseBoundStore } from
|
|
2
|
+
import { create, StoreApi, UseBoundStore } from "zustand";
|
|
3
3
|
|
|
4
4
|
export type TreeViewState<ID> = {
|
|
5
5
|
// Store ids of checked tree nodes
|