react-native-tree-multi-select 0.8.8 → 0.8.10
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 +65 -32
- package/lib/commonjs/TreeView.js +12 -8
- package/lib/commonjs/TreeView.js.map +1 -1
- package/lib/commonjs/components/CustomExpandCollapseIcon.js +4 -2
- package/lib/commonjs/components/CustomExpandCollapseIcon.js.map +1 -1
- package/lib/commonjs/components/NodeList.js +14 -52
- package/lib/commonjs/components/NodeList.js.map +1 -1
- package/lib/commonjs/helpers/flattenTree.helper.js +32 -0
- package/lib/commonjs/helpers/flattenTree.helper.js.map +1 -0
- package/lib/commonjs/helpers/index.js +11 -0
- package/lib/commonjs/helpers/index.js.map +1 -1
- package/lib/commonjs/helpers/initNodeMap.helper.js +0 -5
- package/lib/commonjs/helpers/initNodeMap.helper.js.map +1 -1
- package/lib/commonjs/helpers/search.helper.js +37 -1
- package/lib/commonjs/helpers/search.helper.js.map +1 -1
- package/lib/commonjs/helpers/selectAll.helper.js +22 -0
- package/lib/commonjs/helpers/selectAll.helper.js.map +1 -1
- package/lib/commonjs/store/treeView.store.js +3 -3
- package/lib/commonjs/store/treeView.store.js.map +1 -1
- package/lib/module/TreeView.js +13 -9
- package/lib/module/TreeView.js.map +1 -1
- package/lib/module/components/CustomExpandCollapseIcon.js +2 -1
- package/lib/module/components/CustomExpandCollapseIcon.js.map +1 -1
- package/lib/module/components/NodeList.js +14 -52
- package/lib/module/components/NodeList.js.map +1 -1
- package/lib/module/helpers/flattenTree.helper.js +26 -0
- package/lib/module/helpers/flattenTree.helper.js.map +1 -0
- package/lib/module/helpers/index.js +1 -0
- package/lib/module/helpers/index.js.map +1 -1
- package/lib/module/helpers/initNodeMap.helper.js +0 -5
- package/lib/module/helpers/initNodeMap.helper.js.map +1 -1
- package/lib/module/helpers/search.helper.js +37 -1
- package/lib/module/helpers/search.helper.js.map +1 -1
- package/lib/module/helpers/selectAll.helper.js +21 -0
- package/lib/module/helpers/selectAll.helper.js.map +1 -1
- package/lib/module/store/treeView.store.js +3 -3
- package/lib/module/store/treeView.store.js.map +1 -1
- package/lib/typescript/jest.setup.d.ts +2 -0
- package/lib/typescript/jest.setup.d.ts.map +1 -0
- package/lib/typescript/src/TreeView.d.ts.map +1 -0
- package/lib/typescript/src/components/CheckboxView.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomExpandCollapseIcon.d.ts +6 -0
- package/lib/typescript/src/components/CustomExpandCollapseIcon.d.ts.map +1 -0
- package/lib/typescript/src/components/NodeList.d.ts.map +1 -0
- package/lib/typescript/src/constants/treeView.constants.d.ts.map +1 -0
- package/lib/typescript/src/helpers/expandCollapse.helper.d.ts.map +1 -0
- package/lib/typescript/src/helpers/flattenTree.helper.d.ts +13 -0
- package/lib/typescript/src/helpers/flattenTree.helper.d.ts.map +1 -0
- package/lib/typescript/{helpers → src/helpers}/index.d.ts +1 -0
- package/lib/typescript/src/helpers/index.d.ts.map +1 -0
- package/lib/typescript/{helpers → src/helpers}/initNodeMap.helper.d.ts +1 -1
- package/lib/typescript/src/helpers/initNodeMap.helper.d.ts.map +1 -0
- package/lib/typescript/src/helpers/search.helper.d.ts +16 -0
- package/lib/typescript/src/helpers/search.helper.d.ts.map +1 -0
- package/lib/typescript/{helpers → src/helpers}/selectAll.helper.d.ts +8 -0
- package/lib/typescript/src/helpers/selectAll.helper.d.ts.map +1 -0
- package/lib/typescript/src/helpers/toggleCheckbox.helper.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/{store → src/store}/treeView.store.d.ts +4 -5
- package/lib/typescript/src/store/treeView.store.d.ts.map +1 -0
- package/lib/typescript/{types → src/types}/treeView.types.d.ts +3 -3
- package/lib/typescript/src/types/treeView.types.d.ts.map +1 -0
- package/package.json +14 -3
- package/src/TreeView.tsx +13 -16
- package/src/components/CustomExpandCollapseIcon.tsx +5 -1
- package/src/components/NodeList.tsx +22 -55
- package/src/helpers/flattenTree.helper.ts +29 -0
- package/src/helpers/index.ts +2 -1
- package/src/helpers/initNodeMap.helper.ts +1 -8
- package/src/helpers/search.helper.ts +49 -1
- package/src/helpers/selectAll.helper.ts +27 -0
- package/src/store/treeView.store.ts +17 -7
- package/src/types/treeView.types.ts +3 -3
- package/lib/typescript/TreeView.d.ts.map +0 -1
- package/lib/typescript/components/CheckboxView.d.ts.map +0 -1
- package/lib/typescript/components/CustomExpandCollapseIcon.d.ts +0 -4
- package/lib/typescript/components/CustomExpandCollapseIcon.d.ts.map +0 -1
- package/lib/typescript/components/NodeList.d.ts.map +0 -1
- package/lib/typescript/constants/treeView.constants.d.ts.map +0 -1
- package/lib/typescript/helpers/expandCollapse.helper.d.ts.map +0 -1
- package/lib/typescript/helpers/index.d.ts.map +0 -1
- package/lib/typescript/helpers/initNodeMap.helper.d.ts.map +0 -1
- package/lib/typescript/helpers/search.helper.d.ts +0 -14
- package/lib/typescript/helpers/search.helper.d.ts.map +0 -1
- package/lib/typescript/helpers/selectAll.helper.d.ts.map +0 -1
- package/lib/typescript/helpers/toggleCheckbox.helper.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/store/treeView.store.d.ts.map +0 -1
- package/lib/typescript/types/treeView.types.d.ts.map +0 -1
- /package/lib/typescript/{TreeView.d.ts → src/TreeView.d.ts} +0 -0
- /package/lib/typescript/{components → src/components}/CheckboxView.d.ts +0 -0
- /package/lib/typescript/{components → src/components}/NodeList.d.ts +0 -0
- /package/lib/typescript/{constants → src/constants}/treeView.constants.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/expandCollapse.helper.d.ts +0 -0
- /package/lib/typescript/{helpers → src/helpers}/toggleCheckbox.helper.d.ts +0 -0
- /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-native-tree-multi-select
|
|
2
2
|
|
|
3
|
-
Tree view with multi
|
|
3
|
+
Super-fast Tree view with multi-selection capabilities, using checkboxes and search filtering.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/react-native-tree-multi-select)    
|
|
6
6
|
|
|
@@ -13,22 +13,22 @@ Tree view with multi selection using checkbox + search filtering.
|
|
|
13
13
|
Using yarn
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
yarn add react-native-tree-multi-select
|
|
16
|
+
yarn add react-native-tree-multi-select
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
using npm:
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
npm install react-native-tree-multi-select
|
|
22
|
+
npm install react-native-tree-multi-select
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Dependencies
|
|
25
|
+
Dependencies that need to be installed for this library to work:
|
|
26
26
|
|
|
27
27
|
1. [@shopify/flash-list](https://github.com/Shopify/flash-list)
|
|
28
28
|
2. [react-native-paper](https://github.com/callstack/react-native-paper)
|
|
29
29
|
3. [react-native-vector-icons](https://github.com/oblador/react-native-vector-icons)
|
|
30
30
|
|
|
31
|
-
Make sure to follow the native-related installation for these dependencies.
|
|
31
|
+
Make sure to follow the native-related installation instructions for these dependencies.
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
@@ -39,18 +39,19 @@ import {
|
|
|
39
39
|
type TreeViewRef
|
|
40
40
|
} from 'react-native-tree-multi-select';
|
|
41
41
|
|
|
42
|
+
// Refer to the Properties table below or the example app for the TreeNode type
|
|
42
43
|
const myData: TreeNode[] = [...];
|
|
43
44
|
|
|
44
|
-
export function
|
|
45
|
+
export function TreeViewUsageExample(){
|
|
45
46
|
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
46
47
|
|
|
47
|
-
//
|
|
48
|
+
// It's recommended to use debounce for the search function (refer to the example app)
|
|
48
49
|
function triggerSearch(text: string){
|
|
49
50
|
// Pass search text to the tree along with the keys on which search is to be done(optional)
|
|
50
51
|
treeViewRef.current?.setSearchText(text, ["name"]);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
// Callback functions for check and expand state changes
|
|
54
|
+
// Callback functions for check and expand state changes:
|
|
54
55
|
const handleSelectionChange = (checkedIds: string[]) => {
|
|
55
56
|
// NOTE: Do something with updated checkedIds here
|
|
56
57
|
};
|
|
@@ -69,7 +70,7 @@ export function MyAppScreen(){
|
|
|
69
70
|
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
70
71
|
|
|
71
72
|
return(
|
|
72
|
-
// ...
|
|
73
|
+
// ... Remember to keep a fixed height for the parent. Read Flash List docs to know why
|
|
73
74
|
<TreeView
|
|
74
75
|
ref={treeViewRef}
|
|
75
76
|
data={myData}
|
|
@@ -82,19 +83,29 @@ export function MyAppScreen(){
|
|
|
82
83
|
|
|
83
84
|
### Properties
|
|
84
85
|
|
|
85
|
-
| Property | Type
|
|
86
|
-
| ---------------------------------- |
|
|
87
|
-
| `data` | `TreeNode[]`
|
|
88
|
-
| `onCheck` | `(checkedIds: string[]) => void`
|
|
89
|
-
| `onExpand` | `(expandedIds: string[]) => void`
|
|
90
|
-
| `preselectedIds` | `string[]`
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
86
|
+
| Property | Type | Required | Description |
|
|
87
|
+
| ---------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
|
|
88
|
+
| `data` | `TreeNode[]` | Yes | An array of `TreeNode` objects |
|
|
89
|
+
| `onCheck` | `(checkedIds: string[]) => void` | No | Callback when a checkbox is checked |
|
|
90
|
+
| `onExpand` | `(expandedIds: string[]) => void` | No | Callback when a node is expanded |
|
|
91
|
+
| `preselectedIds` | `string[]` | No | An array of `id`s that should be preselected |
|
|
92
|
+
| `indentationMultiplier` | `number` | No | Indentation (`marginStart`) per level (defaults to 15) |
|
|
93
|
+
| `treeFlashListProps` | `TreeFlatListProps` | No | Props for the flash list |
|
|
94
|
+
| `checkBoxViewStyleProps` | `CheckBoxViewStyleProps` | No | Props for the checkbox view |
|
|
95
|
+
| `CheckboxComponent` | `ComponentType<CheckBoxViewProps>` | No | A custom checkbox component. Defaults to React Native Paper's Checkbox |
|
|
96
|
+
| `ExpandCollapseIconComponent` | `ComponentType<ExpandIconProps>` | No | A custom expand/collapse icon component |
|
|
97
|
+
| `ExpandCollapseTouchableComponent` | `ComponentType<TouchableOpacityProps>`<br />(React Native's `TouchableOpacityProps`) | No | A custom expand/collapse touchable component |
|
|
98
|
+
|
|
99
|
+
#### TreeNode
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
| Property | Type | Required | Description |
|
|
102
|
+
| --------------- | ------------ | -------- | ------------------------------------------------------------ |
|
|
103
|
+
| `id` | `string` | Yes | Unique identifier for the node |
|
|
104
|
+
| `name` | `string` | Yes | The display name of the node |
|
|
105
|
+
| `children` | `TreeNode[]` | No | An array of child `TreeNode` objects |
|
|
106
|
+
| `[key: string]` | `any` | No | Any additional properties for the node <br />(May be useful to perform search on) |
|
|
107
|
+
|
|
108
|
+
#### TreeViewRef
|
|
98
109
|
|
|
99
110
|
| Property | Type | Description |
|
|
100
111
|
| --------------------- | ----------------------------------------------------- | ------------------------------------------------------------ |
|
|
@@ -106,14 +117,35 @@ export function MyAppScreen(){
|
|
|
106
117
|
| `collapseAll` | `() => void` | Collapses all nodes |
|
|
107
118
|
| `setSearchText` | `(searchText: string, searchKeys?: string[]) => void` | Set the search text and optionally the search keys. Default search key is "name"<br /><br />Recommended to call this inside a debounced function if you find any performance issue otherwise. |
|
|
108
119
|
|
|
109
|
-
|
|
120
|
+
#### CheckBoxViewStyleProps
|
|
110
121
|
|
|
111
|
-
| Property
|
|
112
|
-
|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
122
|
+
| Property | Type | Required | Description |
|
|
123
|
+
| -------------------------- | -------------------------------- | -------- | ------------------------------------------------------ |
|
|
124
|
+
| `outermostParentViewStyle` | `StyleProp<ViewStyle>` | No | Optional style modifier for the outermost parent view. |
|
|
125
|
+
| `checkboxParentViewStyle` | `StyleProp<ViewStyle>` | No | Optional style modifier for the checkbox parent view. |
|
|
126
|
+
| `textTouchableStyle` | `StyleProp<ViewStyle>` | No | Optional style modifier for the text touchable style. |
|
|
127
|
+
| `checkboxProps` | `CheckboxProps` | No | Optional props for the checkbox component. |
|
|
128
|
+
| `textProps` | `TextProps` <br />(React Native) | No | Optional props for the text component. |
|
|
129
|
+
|
|
130
|
+
#### CheckboxProps
|
|
131
|
+
|
|
132
|
+
All properties of `RNPaperCheckboxAndroidProps`(from `react-native-paper`) except for `onPress` and `status`
|
|
133
|
+
|
|
134
|
+
#### TreeFlatListProps
|
|
135
|
+
|
|
136
|
+
All properties of `FlashListProps`(from `@shopify/flash-list`) except for `data` and `renderItem`
|
|
137
|
+
|
|
138
|
+
#### ExpandIconProps
|
|
139
|
+
|
|
140
|
+
| Property | Type | Required | Description |
|
|
141
|
+
| ---------- | ------- | -------- | --------------------------------- |
|
|
142
|
+
| isExpanded | boolean | Yes | Indicates if the icon is expanded |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
More customization options are on the way 🙌
|
|
147
|
+
|
|
148
|
+
---
|
|
117
149
|
|
|
118
150
|
## Contributing
|
|
119
151
|
|
|
@@ -127,18 +159,19 @@ MIT
|
|
|
127
159
|
|
|
128
160
|
<p align="center" valign="center">
|
|
129
161
|
<a href="https://liberapay.com/FutureJJ/donate">
|
|
130
|
-
<img src="https://liberapay.com/assets/widgets/donate.svg" alt="LiberPay_Donation_Button"
|
|
162
|
+
<img src="https://liberapay.com/assets/widgets/donate.svg" alt="LiberPay_Donation_Button" height="50" >
|
|
131
163
|
</a>
|
|
132
164
|
|
|
133
|
-
<a href="
|
|
134
|
-
<img src="
|
|
165
|
+
<a href=".github/assets/Jairaj_Jangle_Google_Pay_UPI_QR_Code.jpg">
|
|
166
|
+
<img src=".github/assets/upi.png" alt="Paypal_Donation_Button" height="50" >
|
|
135
167
|
</a>
|
|
136
168
|
|
|
137
169
|
<a href="https://www.paypal.com/paypalme/jairajjangle001/usd">
|
|
138
|
-
<img src="
|
|
170
|
+
<img src=".github/assets/paypal_donate.png" alt="Paypal_Donation_Button" height="50" >
|
|
139
171
|
</a>
|
|
140
172
|
</p>
|
|
141
173
|
|
|
174
|
+
|
|
142
175
|
---
|
|
143
176
|
|
|
144
177
|
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/lib/commonjs/TreeView.js
CHANGED
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TreeView = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
8
9
|
var _NodeList = _interopRequireDefault(require("./components/NodeList"));
|
|
9
10
|
var _helpers = require("./helpers");
|
|
10
11
|
var _treeView = require("./store/treeView.store");
|
|
11
|
-
var _reactNative = require("react-native");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const _TreeView = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
14
14
|
const {
|
|
15
15
|
data,
|
|
16
16
|
onCheck,
|
|
17
17
|
onExpand,
|
|
18
|
-
preselectedIds,
|
|
18
|
+
preselectedIds = [],
|
|
19
19
|
treeFlashListProps,
|
|
20
20
|
checkBoxViewStyleProps,
|
|
21
21
|
CheckboxComponent,
|
|
@@ -29,8 +29,8 @@ const _TreeView = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
29
29
|
initialTreeViewData,
|
|
30
30
|
updateInitialTreeViewData,
|
|
31
31
|
searchText,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
updateSearchText,
|
|
33
|
+
updateSearchKeys,
|
|
34
34
|
checked,
|
|
35
35
|
cleanUpTreeViewStore
|
|
36
36
|
} = (0, _treeView.useTreeViewStore)();
|
|
@@ -45,13 +45,17 @@ const _TreeView = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
45
45
|
}));
|
|
46
46
|
function setSearchText(text) {
|
|
47
47
|
let keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ["name"];
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
updateSearchText(text);
|
|
49
|
+
updateSearchKeys(keys);
|
|
50
50
|
}
|
|
51
51
|
_react.default.useEffect(() => {
|
|
52
52
|
updateInitialTreeViewData(data);
|
|
53
|
-
(0, _helpers.initializeNodeMaps)(data
|
|
54
|
-
|
|
53
|
+
(0, _helpers.initializeNodeMaps)(data);
|
|
54
|
+
|
|
55
|
+
// Check any preselected nodes
|
|
56
|
+
(0, _helpers.toggleCheckboxes)(preselectedIds, true);
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, []);
|
|
55
59
|
const getIds = _react.default.useCallback(node => {
|
|
56
60
|
if (!node.children || node.children.length === 0) {
|
|
57
61
|
return [node.id];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_NodeList","_helpers","_treeView","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_NodeList","_helpers","_treeView","obj","__esModule","default","_TreeView","React","forwardRef","props","ref","data","onCheck","onExpand","preselectedIds","treeFlashListProps","checkBoxViewStyleProps","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","indentationMultiplier","expanded","updateExpanded","initialTreeViewData","updateInitialTreeViewData","searchText","updateSearchText","updateSearchKeys","checked","cleanUpTreeViewStore","useTreeViewStore","useImperativeHandle","selectAll","unselectAll","selectAllFiltered","unselectAllFiltered","expandAll","collapseAll","setSearchText","text","keys","arguments","length","undefined","useEffect","initializeNodeMaps","toggleCheckboxes","getIds","useCallback","node","children","id","flatMap","item","Array","from","InteractionManager","runAfterInteractions","Set","createElement","TreeView","memo","exports"],"sourceRoot":"../../src","sources":["T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,CAAC,CAAC;IACJ,CAAC,MACI;MACHG,+BAAkB,CAACC,oBAAoB,CAAC,MAAM;QAC5CnC,cAAc,CAAC,IAAIoC,GAAG,CAAC,CAAC,CAAC;MAC3B,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACX,MAAM,EAAExB,mBAAmB,EAAEE,UAAU,EAAEH,cAAc,CAAC,CAAC;EAE7Df,cAAK,CAACqC,SAAS,CAAC,MAAM;IACpB,OAAO,MAAM;MACXf,oBAAoB,CAAC,CAAC;IACxB,CAAC;EACH,CAAC,EAAE,CAACA,oBAAoB,CAAC,CAAC;EAE1B,oBACEjC,MAAA,CAAAS,OAAA,CAAAsD,aAAA,CAAC3D,SAAA,CAAAK,OAAQ;IACPU,kBAAkB,EAAEA,kBAAmB;IACvCC,sBAAsB,EAAEA,sBAAuB;IAC/CI,qBAAqB,EAAEA,qBAAsB;IAE7CH,iBAAiB,EAAEA,iBAAkB;IACrCC,2BAA2B,EAAEA,2BAA4B;IACzDC,gCAAgC,EAAEA;EAAiC,CACpE,CAAC;AAEN,CACF,CAAC;AAEM,MAAMyC,QAAQ,gBAAGrD,cAAK,CAACsD,IAAI,CAACvD,SAAS,CAAC;AAACwD,OAAA,CAAAF,QAAA,GAAAA,QAAA"}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.CustomExpandCollapseIcon = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _FontAwesome = _interopRequireDefault(require("react-native-vector-icons/FontAwesome"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
10
|
+
const CustomExpandCollapseIcon = /*#__PURE__*/_react.default.memo(_CustomExpandCollapseIcon);
|
|
11
|
+
exports.CustomExpandCollapseIcon = CustomExpandCollapseIcon;
|
|
12
|
+
function _CustomExpandCollapseIcon(props) {
|
|
11
13
|
const {
|
|
12
14
|
isExpanded
|
|
13
15
|
} = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_FontAwesome","obj","__esModule","default","CustomExpandCollapseIcon","props","isExpanded","createElement","name","size","color"],"sourceRoot":"../../../src","sources":["components/CustomExpandCollapseIcon.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_FontAwesome","obj","__esModule","default","CustomExpandCollapseIcon","React","memo","_CustomExpandCollapseIcon","exports","props","isExpanded","createElement","name","size","color"],"sourceRoot":"../../../src","sources":["components/CustomExpandCollapseIcon.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIlD,MAAMG,wBAAwB,gBAAGC,cAAK,CAACC,IAAI,CAC9CC,yBACJ,CAAC;AAACC,OAAA,CAAAJ,wBAAA,GAAAA,wBAAA;AAEF,SAASG,yBAAyBA,CAACE,KAAsB,EAAE;EACvD,MAAM;IAAEC;EAAW,CAAC,GAAGD,KAAK;EAE5B,oBACIZ,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,YAAA,CAAAG,OAAI;IACDS,IAAI,EACAF,UAAU,GACJ,YAAY,GACZ,aACT;IACDG,IAAI,EAAE,EAAG;IACTC,KAAK,EAAC;EAAO,CAChB,CAAC;AAEV"}
|
|
@@ -10,7 +10,7 @@ var _flashList = require("@shopify/flash-list");
|
|
|
10
10
|
var _treeView = require("../store/treeView.store");
|
|
11
11
|
var _helpers = require("../helpers");
|
|
12
12
|
var _CheckboxView = require("./CheckboxView");
|
|
13
|
-
var _CustomExpandCollapseIcon =
|
|
13
|
+
var _CustomExpandCollapseIcon = require("./CustomExpandCollapseIcon");
|
|
14
14
|
var _treeView2 = require("../constants/treeView.constants");
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -29,69 +29,31 @@ function _NodeList(props) {
|
|
|
29
29
|
const {
|
|
30
30
|
expanded,
|
|
31
31
|
initialTreeViewData,
|
|
32
|
-
|
|
32
|
+
updateInnerMostChildrenIds,
|
|
33
33
|
searchKeys,
|
|
34
34
|
searchText
|
|
35
35
|
} = (0, _treeView.useTreeViewStore)();
|
|
36
36
|
const [filteredTree, setFilteredTree] = _react.default.useState([]);
|
|
37
37
|
const [flattenedFilteredNodes, setFlattenedFilteredNodes] = _react.default.useState([]);
|
|
38
|
+
|
|
39
|
+
// First we filter the tree as per the search term and keys
|
|
38
40
|
_react.default.useEffect(() => {
|
|
39
41
|
const searchTrimmed = searchText.trim().toLowerCase();
|
|
40
|
-
const
|
|
41
|
-
let filtered = [];
|
|
42
|
-
for (let node of _nodes) {
|
|
43
|
-
if (!searchTrimmed || (0, _helpers.doesNodeContainSearchTerm)(node, searchTrimmed, searchKeys)) {
|
|
44
|
-
// If node itself matches, include it and all its descendants
|
|
45
|
-
filtered.push(node);
|
|
46
|
-
} else if (node.children) {
|
|
47
|
-
// If node does not match, check its children and include them if they match
|
|
48
|
-
const childMatches = filterTreeData(node.children);
|
|
49
|
-
if (childMatches.length > 0) {
|
|
50
|
-
// If any children match, include the node, replacing its children with the matching ones
|
|
51
|
-
filtered.push({
|
|
52
|
-
...node,
|
|
53
|
-
children: childMatches
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return filtered;
|
|
59
|
-
};
|
|
60
|
-
const tempFilterTree = filterTreeData(initialTreeViewData);
|
|
42
|
+
const tempFilterTree = (0, _helpers.getFilteredTreeData)(initialTreeViewData, searchTrimmed, searchKeys);
|
|
61
43
|
setFilteredTree(tempFilterTree);
|
|
62
44
|
}, [searchText, searchKeys, initialTreeViewData]);
|
|
45
|
+
|
|
46
|
+
// Then we flatten the treen to make it "render-compatible" in a "flat" list
|
|
63
47
|
_react.default.useEffect(() => {
|
|
64
|
-
const
|
|
65
|
-
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
66
|
-
let flattened = [];
|
|
67
|
-
for (let node of _nodes) {
|
|
68
|
-
flattened.push({
|
|
69
|
-
...node,
|
|
70
|
-
level
|
|
71
|
-
});
|
|
72
|
-
if (node.children && expanded.has(node.id)) {
|
|
73
|
-
flattened = [...flattened, ...flattenTreeData(node.children, level + 1)];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return flattened;
|
|
77
|
-
};
|
|
78
|
-
const tempFlattenTreeData = flattenTreeData(filteredTree);
|
|
48
|
+
const tempFlattenTreeData = (0, _helpers.getFlattenedTreeData)(filteredTree, expanded);
|
|
79
49
|
setFlattenedFilteredNodes(tempFlattenTreeData);
|
|
80
50
|
}, [filteredTree, expanded]);
|
|
51
|
+
|
|
52
|
+
// And update the innermost children id -> required to un/select filtered tree
|
|
81
53
|
_react.default.useEffect(() => {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (node.children) {
|
|
86
|
-
getLeafNodes(node.children);
|
|
87
|
-
} else {
|
|
88
|
-
allLeafIds.push(node.id);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
getLeafNodes(filteredTree);
|
|
93
|
-
updatedInnerMostChildrenIds(allLeafIds);
|
|
94
|
-
}, [filteredTree, updatedInnerMostChildrenIds]);
|
|
54
|
+
const updatedInnerMostChildrenIds = (0, _helpers.getInnerMostChildrenIdsInTree)(filteredTree);
|
|
55
|
+
updateInnerMostChildrenIds(updatedInnerMostChildrenIds);
|
|
56
|
+
}, [filteredTree, updateInnerMostChildrenIds]);
|
|
95
57
|
const nodeRenderer = _react.default.useCallback(_ref => {
|
|
96
58
|
let {
|
|
97
59
|
item
|
|
@@ -140,7 +102,7 @@ function _Node(props) {
|
|
|
140
102
|
level,
|
|
141
103
|
checkBoxViewStyleProps,
|
|
142
104
|
indentationMultiplier = _treeView2.defaultIndentationMultiplier,
|
|
143
|
-
ExpandCollapseIconComponent = _CustomExpandCollapseIcon.
|
|
105
|
+
ExpandCollapseIconComponent = _CustomExpandCollapseIcon.CustomExpandCollapseIcon,
|
|
144
106
|
CheckboxComponent = _CheckboxView.CheckboxView,
|
|
145
107
|
ExpandCollapseTouchableComponent = _reactNative.TouchableOpacity
|
|
146
108
|
} = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_flashList","_treeView","_helpers","_CheckboxView","_CustomExpandCollapseIcon","_treeView2","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","NodeList","React","memo","_NodeList","_default","exports","props","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","expanded","initialTreeViewData","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_flashList","_treeView","_helpers","_CheckboxView","_CustomExpandCollapseIcon","_treeView2","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","NodeList","React","memo","_NodeList","_default","exports","props","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","expanded","initialTreeViewData","updateInnerMostChildrenIds","searchKeys","searchText","useTreeViewStore","filteredTree","setFilteredTree","useState","flattenedFilteredNodes","setFlattenedFilteredNodes","useEffect","searchTrimmed","trim","toLowerCase","tempFilterTree","getFilteredTreeData","tempFlattenTreeData","getFlattenedTreeData","updatedInnerMostChildrenIds","getInnerMostChildrenIdsInTree","nodeRenderer","useCallback","_ref","item","createElement","Node","node","level","FlashList","estimatedItemSize","removeClippedSubviews","keyboardShouldPersistTaps","drawDistance","data","renderItem","ListHeaderComponent","HeaderFooterView","ListFooterComponent","View","style","styles","defaultHeaderFooter","getValue","isChecked","isIndeterminate","_Node","_node$children","defaultIndentationMultiplier","CustomExpandCollapseIcon","CheckboxView","TouchableOpacity","checked","indeterminate","has","id","isExpanded","value","setValue","_onToggleExpand","handleToggleExpand","_onCheck","toggleCheckboxes","nodeParentView","marginStart","nodeCheckboxAndArrowRow","text","name","onValueChange","children","nodeExpandableArrowTouchable","onPress","StyleSheet","create","padding","flex","flexDirection","alignItems","minWidth"],"sourceRoot":"../../../src","sources":["components/NodeList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,UAAA,GAAAF,OAAA;AAWA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,yBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAA+E,SAAAD,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,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AAApB,IAAI,CAAC0C,QAAQ,cAAAtB,cAAA,eAAbA,cAAA,CAAenE,MAAM,gBAClBpB,MAAA,CAAAY,OAAA,CAAAqD,aAAA,CAAC1B,gCAAgC;IAC7ByC,KAAK,EAAEC,MAAM,CAAC6B,4BAA6B;IAC3CC,OAAO,EAAEZ;EAAgB,gBACzBnG,MAAA,CAAAY,OAAA,CAAAqD,aAAA,CAAC3B,2BAA2B;IACxB0D,UAAU,EAAEA;EAAW,CAC1B,CAC6B,CAAC,GACnC,IACF,CACJ,CAAC;AAEf;AAAC;AAED,MAAMf,MAAM,GAAG+B,uBAAU,CAACC,MAAM,CAAC;EAC7B/B,mBAAmB,EAAE;IACjBgC,OAAO,EAAE;EACb,CAAC;EACDX,cAAc,EAAE;IACZY,IAAI,EAAE;EACV,CAAC;EACDL,4BAA4B,EAAE;IAC1BK,IAAI,EAAE;EACV,CAAC;EACDV,uBAAuB,EAAE;IACrBW,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE;EACd;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFlattenedTreeData = getFlattenedTreeData;
|
|
7
|
+
/**
|
|
8
|
+
* Flatten the tree and attach a "level" key to object to indicate it's depth. This
|
|
9
|
+
* returns the flattened tree data of expanded ids only. We do not prune the tree off the
|
|
10
|
+
* children after the flattening as it would be unnecessary computation.
|
|
11
|
+
*
|
|
12
|
+
* @param nodes - Input recursive tree
|
|
13
|
+
* @param expandedIds - ids of currently expanded nodes
|
|
14
|
+
* @param level - (optional) for internal recursive use only
|
|
15
|
+
* @returns Flattened tree data with expanded ids only
|
|
16
|
+
*/
|
|
17
|
+
function getFlattenedTreeData(nodes, expandedIds) {
|
|
18
|
+
let __level__ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
19
|
+
let flattened = [];
|
|
20
|
+
for (let node of nodes) {
|
|
21
|
+
flattened.push({
|
|
22
|
+
...node,
|
|
23
|
+
level: __level__
|
|
24
|
+
});
|
|
25
|
+
if (node.children && expandedIds.has(node.id)) {
|
|
26
|
+
flattened = [...flattened, ...getFlattenedTreeData(node.children, expandedIds, __level__ + 1)];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return flattened;
|
|
30
|
+
}
|
|
31
|
+
;
|
|
32
|
+
//# sourceMappingURL=flattenTree.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getFlattenedTreeData","nodes","expandedIds","__level__","arguments","length","undefined","flattened","node","push","level","children","has","id"],"sourceRoot":"../../../src","sources":["helpers/flattenTree.helper.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,oBAAoBA,CAChCC,KAAiB,EACjBC,WAAwB,EAED;EAAA,IADvBC,SAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAErB,IAAIG,SAAkC,GAAG,EAAE;EAC3C,KAAK,IAAIC,IAAI,IAAIP,KAAK,EAAE;IACpBM,SAAS,CAACE,IAAI,CAAC;MAAE,GAAGD,IAAI;MAAEE,KAAK,EAAEP;IAAU,CAAC,CAAC;IAC7C,IAAIK,IAAI,CAACG,QAAQ,IAAIT,WAAW,CAACU,GAAG,CAACJ,IAAI,CAACK,EAAE,CAAC,EAAE;MAC3CN,SAAS,GAAG,CACR,GAAGA,SAAS,EACZ,GAAGP,oBAAoB,CAACQ,IAAI,CAACG,QAAQ,EAAET,WAAW,EAAEC,SAAS,GAAG,CAAC,CAAC,CACrE;IACL;EACJ;EACA,OAAOI,SAAS;AACpB;AAAC"}
|
|
@@ -58,4 +58,15 @@ Object.keys(_search).forEach(function (key) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var _flattenTree = require("./flattenTree.helper");
|
|
62
|
+
Object.keys(_flattenTree).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _flattenTree[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _flattenTree[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
61
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_expandCollapse","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_initNodeMap","_selectAll","_toggleCheckbox","_search"],"sourceRoot":"../../../src","sources":["helpers/index.ts"],"mappings":";;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,eAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,eAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,eAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,UAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,UAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,UAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,UAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,eAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,eAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,eAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,eAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,OAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,OAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,OAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,OAAA,CAAAR,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["_expandCollapse","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_initNodeMap","_selectAll","_toggleCheckbox","_search","_flattenTree"],"sourceRoot":"../../../src","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AA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,eAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,eAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,OAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,OAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,OAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,OAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,YAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,YAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,YAAA,CAAAT,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initializeNodeMaps = initializeNodeMaps;
|
|
7
7
|
var _treeView = require("../store/treeView.store");
|
|
8
|
-
var _toggleCheckbox = require("./toggleCheckbox.helper");
|
|
9
8
|
/**
|
|
10
9
|
* Initialize the maps for tracking tree nodes and their parent-child relationships.
|
|
11
10
|
*
|
|
@@ -16,7 +15,6 @@ var _toggleCheckbox = require("./toggleCheckbox.helper");
|
|
|
16
15
|
* @param preselectedIds - An optional array of TreeNode IDs that should be preselected.
|
|
17
16
|
*/
|
|
18
17
|
function initializeNodeMaps(initialData) {
|
|
19
|
-
let preselectedIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
20
18
|
const {
|
|
21
19
|
updateNodeMap,
|
|
22
20
|
updateChildToParentMap
|
|
@@ -48,8 +46,5 @@ function initializeNodeMaps(initialData) {
|
|
|
48
46
|
processNodes(initialData);
|
|
49
47
|
updateNodeMap(tempNodeMap);
|
|
50
48
|
updateChildToParentMap(tempChildToParentMap);
|
|
51
|
-
|
|
52
|
-
// Check any preselected nodes
|
|
53
|
-
(0, _toggleCheckbox.toggleCheckboxes)(preselectedIds, true);
|
|
54
49
|
}
|
|
55
50
|
//# sourceMappingURL=initNodeMap.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_treeView","require","
|
|
1
|
+
{"version":3,"names":["_treeView","require","initializeNodeMaps","initialData","updateNodeMap","updateChildToParentMap","useTreeViewStore","getState","tempNodeMap","Map","tempChildToParentMap","processNodes","nodes","parentId","arguments","length","undefined","forEach","node","set","id","children"],"sourceRoot":"../../../src","sources":["helpers/initNodeMap.helper.ts"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,WAAuB,EAAE;EACxD,MAAM;IACFC,aAAa;IACbC;EACJ,CAAC,GAAGC,0BAAgB,CAACC,QAAQ,CAAC,CAAC;EAE/B,MAAMC,WAAkC,GAAG,IAAIC,GAAG,CAAC,CAAC;EAAC;EACrD,MAAMC,oBAAyC,GAAG,IAAID,GAAG,CAAC,CAAC;EAAC;;EAE5D;AACJ;AACA;AACA;AACA;AACA;EACI,MAAME,YAAY,GAAG,SAAAA,CACjBC,KAAiB,EAEhB;IAAA,IADDC,QAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAE9BF,KAAK,CAACK,OAAO,CAAEC,IAAI,IAAK;MACpB;MACAV,WAAW,CAACW,GAAG,CAACD,IAAI,CAACE,EAAE,EAAEF,IAAI,CAAC;MAC9B;MACA,IAAIL,QAAQ,EAAEH,oBAAoB,CAACS,GAAG,CAACD,IAAI,CAACE,EAAE,EAAEP,QAAQ,CAAC;MACzD;MACA,IAAIK,IAAI,CAACG,QAAQ,EAAEV,YAAY,CAACO,IAAI,CAACG,QAAQ,EAAEH,IAAI,CAACE,EAAE,CAAC;IAC3D,CAAC,CAAC;EACN,CAAC;;EAED;EACAT,YAAY,CAACR,WAAW,CAAC;EAEzBC,aAAa,CAACI,WAAW,CAAC;EAC1BH,sBAAsB,CAACK,oBAAoB,CAAC;AAChD"}
|
|
@@ -3,7 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getFilteredTreeData = getFilteredTreeData;
|
|
7
|
+
/**
|
|
8
|
+
* Get filtered tree data based on the search term and the search keys
|
|
9
|
+
* If any of the parent contains the search term, the tree will also contain
|
|
10
|
+
* it's children.
|
|
11
|
+
*
|
|
12
|
+
* If only one of the innermost children contains the search term then it's siblings
|
|
13
|
+
* won't be included in the search. But all it's ancestor nodes will be included
|
|
14
|
+
*
|
|
15
|
+
* @param nodes Input tree data
|
|
16
|
+
* @param trimmedSearchTerm search term
|
|
17
|
+
* @param searchKeys search key
|
|
18
|
+
* @returns filtered tree data
|
|
19
|
+
*/
|
|
20
|
+
function getFilteredTreeData(nodes, trimmedSearchTerm, searchKeys) {
|
|
21
|
+
let filtered = [];
|
|
22
|
+
for (let node of nodes) {
|
|
23
|
+
const isSearchTermInNode = doesNodeContainSearchTerm(node, trimmedSearchTerm, searchKeys);
|
|
24
|
+
if (!trimmedSearchTerm || isSearchTermInNode) {
|
|
25
|
+
// If node itself matches, include it and all its descendants
|
|
26
|
+
filtered.push(node);
|
|
27
|
+
} else if (node.children) {
|
|
28
|
+
// If node does not match, check its children and include them if they match
|
|
29
|
+
const childMatches = getFilteredTreeData(node.children, trimmedSearchTerm, searchKeys);
|
|
30
|
+
if (childMatches.length > 0) {
|
|
31
|
+
// If any children match, include the node, replacing its children with the matching ones
|
|
32
|
+
filtered.push({
|
|
33
|
+
...node,
|
|
34
|
+
children: childMatches
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return filtered;
|
|
40
|
+
}
|
|
41
|
+
;
|
|
42
|
+
|
|
7
43
|
/**
|
|
8
44
|
* Checks if a given tree node contains a specific search term in any of its specified keys.
|
|
9
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getFilteredTreeData","nodes","trimmedSearchTerm","searchKeys","filtered","node","isSearchTermInNode","doesNodeContainSearchTerm","push","children","childMatches","length","searchTerm","some","key","nodeValue","toString","toLowerCase","includes"],"sourceRoot":"../../../src","sources":["helpers/search.helper.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CAC/BC,KAAiB,EACjBC,iBAAyB,EACzBC,UAAoB,EACV;EACV,IAAIC,QAAoB,GAAG,EAAE;EAE7B,KAAK,IAAIC,IAAI,IAAIJ,KAAK,EAAE;IACpB,MAAMK,kBAAkB,GAAGC,yBAAyB,CAChDF,IAAI,EACJH,iBAAiB,EACjBC,UACJ,CAAC;IAED,IAAI,CAACD,iBAAiB,IAAII,kBAAkB,EAAE;MAC1C;MACAF,QAAQ,CAACI,IAAI,CAACH,IAAI,CAAC;IACvB,CAAC,MAAM,IAAIA,IAAI,CAACI,QAAQ,EAAE;MACtB;MACA,MAAMC,YAAY,GAAGV,mBAAmB,CACpCK,IAAI,CAACI,QAAQ,EACbP,iBAAiB,EACjBC,UACJ,CAAC;MAED,IAAIO,YAAY,CAACC,MAAM,GAAG,CAAC,EAAE;QACzB;QACAP,QAAQ,CAACI,IAAI,CAAC;UAAE,GAAGH,IAAI;UAAEI,QAAQ,EAAEC;QAAa,CAAC,CAAC;MACtD;IACJ;EACJ;EAEA,OAAON,QAAQ;AACnB;AAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,yBAAyBA,CAC9BF,IAAc,EACdO,UAAkB,EAClBT,UAAoB,EACb;EACP;EACA,OAAOA,UAAU,CAACU,IAAI,CAACC,GAAG,IAAI;IAC1B;IACA,MAAMC,SAAS,GAAGV,IAAI,CAACS,GAAG,CAAC;IAC3B;IACA;IACA;IACA,OAAQC,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEC,QAAQ,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAACN,UAAU,CAAC;EACpE,CAAC,CAAC;AACN"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getInnerMostChildrenIdsInTree = getInnerMostChildrenIdsInTree;
|
|
6
7
|
exports.selectAll = selectAll;
|
|
7
8
|
exports.selectAllFiltered = selectAllFiltered;
|
|
8
9
|
exports.unselectAll = unselectAll;
|
|
@@ -88,4 +89,25 @@ function unselectAll() {
|
|
|
88
89
|
updateIndeterminate(new Set());
|
|
89
90
|
}
|
|
90
91
|
;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get the ids of the innermost children in the tree
|
|
95
|
+
*
|
|
96
|
+
* @param filteredTreeNodes - The filtered tree data
|
|
97
|
+
* @returns - array of ids of the inner most children only
|
|
98
|
+
*/
|
|
99
|
+
function getInnerMostChildrenIdsInTree(filteredTreeNodes) {
|
|
100
|
+
const allLeafIds = [];
|
|
101
|
+
const getLeafNodes = _nodes => {
|
|
102
|
+
for (let node of _nodes) {
|
|
103
|
+
if (node.children) {
|
|
104
|
+
getLeafNodes(node.children);
|
|
105
|
+
} else {
|
|
106
|
+
allLeafIds.push(node.id);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
getLeafNodes(filteredTreeNodes);
|
|
111
|
+
return allLeafIds;
|
|
112
|
+
}
|
|
91
113
|
//# sourceMappingURL=selectAll.helper.js.map
|