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
|
@@ -0,0 +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,QAkJnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAE1C,YAAY,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TreeNode } from "src/types/treeView.types";
|
|
2
|
-
type TreeViewState = {
|
|
2
|
+
export type TreeViewState = {
|
|
3
3
|
checked: Set<string>;
|
|
4
4
|
updateChecked: (checked: Set<string>) => void;
|
|
5
5
|
indeterminate: Set<string>;
|
|
@@ -13,13 +13,12 @@ type TreeViewState = {
|
|
|
13
13
|
childToParentMap: Map<string, string>;
|
|
14
14
|
updateChildToParentMap: (childToParentMap: Map<string, string>) => void;
|
|
15
15
|
searchText: string;
|
|
16
|
-
|
|
16
|
+
updateSearchText: (searchText: string) => void;
|
|
17
17
|
searchKeys: string[];
|
|
18
|
-
|
|
18
|
+
updateSearchKeys: (searchKeys: string[]) => void;
|
|
19
19
|
innerMostChildrenIds: string[];
|
|
20
|
-
|
|
20
|
+
updateInnerMostChildrenIds: (innerMostChildrenIds: string[]) => void;
|
|
21
21
|
cleanUpTreeViewStore: () => void;
|
|
22
22
|
};
|
|
23
23
|
export declare const useTreeViewStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TreeViewState>>;
|
|
24
|
-
export {};
|
|
25
24
|
//# sourceMappingURL=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AGjD,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,EAAE,CAAC,oBAAoB,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAGrE,oBAAoB,EAAE,MAAM,IAAI,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,4EA0C1B,CAAC"}
|
|
@@ -38,9 +38,9 @@ export interface TreeViewProps extends NodeListProps {
|
|
|
38
38
|
}
|
|
39
39
|
type CheckboxProps = Omit<RNPaperCheckboxAndroidProps, "onPress" | "status">;
|
|
40
40
|
export interface CheckBoxViewStyleProps {
|
|
41
|
-
outermostParentViewStyle?: StyleProp<ViewStyle
|
|
42
|
-
checkboxParentViewStyle?: StyleProp<ViewStyle
|
|
43
|
-
textTouchableStyle?: StyleProp<ViewStyle
|
|
41
|
+
outermostParentViewStyle?: StyleProp<ViewStyle>;
|
|
42
|
+
checkboxParentViewStyle?: StyleProp<ViewStyle>;
|
|
43
|
+
textTouchableStyle?: StyleProp<ViewStyle>;
|
|
44
44
|
checkboxProps?: CheckboxProps;
|
|
45
45
|
textProps?: TextProps;
|
|
46
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeView.types.d.ts","sourceRoot":"","sources":["../../../../src/types/treeView.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACR,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACH,KAAK,KAAK,IAAI,2BAA2B,EAC5C,MAAM,4DAA4D,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,eAAe,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC5B,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAC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E,SAAS,CAAC,SAAS,CAAC,CAAC;IAChD,uBAAuB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/C,kBAAkB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAG1C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC7D,KAAK,EAAE,iBAAiB,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAEhC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tree-multi-select",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "Tree view with multi selection using checkbox",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -66,24 +66,29 @@
|
|
|
66
66
|
"@react-native-community/eslint-config": "^3.0.2",
|
|
67
67
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
68
68
|
"@shopify/flash-list": "1.x.x",
|
|
69
|
+
"@testing-library/jest-native": "^5.4.2",
|
|
70
|
+
"@testing-library/react-native": "^12.1.2",
|
|
69
71
|
"@types/color": "^3.0.3",
|
|
70
|
-
"@types/jest": "^
|
|
72
|
+
"@types/jest": "^29.5.3",
|
|
71
73
|
"@types/react": "~17.0.21",
|
|
72
74
|
"@types/react-native": "0.70.0",
|
|
73
75
|
"@types/react-native-vector-icons": "^6.4.13",
|
|
76
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
74
77
|
"commitlint": "^17.0.2",
|
|
75
78
|
"del-cli": "^5.0.0",
|
|
76
79
|
"eslint": "^8.4.1",
|
|
77
80
|
"eslint-config-prettier": "^8.5.0",
|
|
78
81
|
"eslint-plugin-prettier": "^4.0.0",
|
|
79
|
-
"jest": "^
|
|
82
|
+
"jest": "^29.6.1",
|
|
80
83
|
"pod-install": "^0.1.0",
|
|
81
84
|
"prettier": "^2.0.5",
|
|
82
85
|
"react": "18.2.0",
|
|
83
86
|
"react-native": "0.72.1",
|
|
84
87
|
"react-native-builder-bob": "^0.20.0",
|
|
85
88
|
"react-native-paper": "5.x.x",
|
|
89
|
+
"react-test-renderer": "^18.2.0",
|
|
86
90
|
"release-it": "^15.0.0",
|
|
91
|
+
"ts-jest": "^29.1.1",
|
|
87
92
|
"turbo": "^1.10.7",
|
|
88
93
|
"typescript": "^5.0.2"
|
|
89
94
|
},
|
|
@@ -103,6 +108,12 @@
|
|
|
103
108
|
"packageManager": "^yarn@1.22.15",
|
|
104
109
|
"jest": {
|
|
105
110
|
"preset": "react-native",
|
|
111
|
+
"setupFilesAfterEnv": [
|
|
112
|
+
"./jest.setup.ts"
|
|
113
|
+
],
|
|
114
|
+
"transformIgnorePatterns": [
|
|
115
|
+
"node_modules/(?!(jest-)?react-native|@react-native-community|@react-navigation|@react-native/js-polyfills)"
|
|
116
|
+
],
|
|
106
117
|
"modulePathIgnorePatterns": [
|
|
107
118
|
"<rootDir>/example/node_modules",
|
|
108
119
|
"<rootDir>/lib/"
|
package/src/TreeView.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { InteractionManager } from 'react-native';
|
|
2
3
|
import type {
|
|
3
4
|
TreeNode,
|
|
4
5
|
TreeViewProps,
|
|
@@ -12,10 +13,10 @@ import {
|
|
|
12
13
|
unselectAllFiltered,
|
|
13
14
|
initializeNodeMaps,
|
|
14
15
|
expandAll,
|
|
15
|
-
collapseAll
|
|
16
|
+
collapseAll,
|
|
17
|
+
toggleCheckboxes
|
|
16
18
|
} from './helpers';
|
|
17
19
|
import { useTreeViewStore } from './store/treeView.store';
|
|
18
|
-
import { InteractionManager } from 'react-native';
|
|
19
20
|
|
|
20
21
|
const _TreeView = React.forwardRef<TreeViewRef, TreeViewProps>(
|
|
21
22
|
(props, ref) => {
|
|
@@ -25,7 +26,7 @@ const _TreeView = React.forwardRef<TreeViewRef, TreeViewProps>(
|
|
|
25
26
|
onCheck,
|
|
26
27
|
onExpand,
|
|
27
28
|
|
|
28
|
-
preselectedIds,
|
|
29
|
+
preselectedIds = [],
|
|
29
30
|
|
|
30
31
|
treeFlashListProps,
|
|
31
32
|
checkBoxViewStyleProps,
|
|
@@ -45,9 +46,9 @@ const _TreeView = React.forwardRef<TreeViewRef, TreeViewProps>(
|
|
|
45
46
|
updateInitialTreeViewData,
|
|
46
47
|
|
|
47
48
|
searchText,
|
|
48
|
-
|
|
49
|
+
updateSearchText,
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
updateSearchKeys,
|
|
51
52
|
|
|
52
53
|
checked,
|
|
53
54
|
|
|
@@ -68,23 +69,19 @@ const _TreeView = React.forwardRef<TreeViewRef, TreeViewProps>(
|
|
|
68
69
|
}));
|
|
69
70
|
|
|
70
71
|
function setSearchText(text: string, keys: string[] = ["name"]) {
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
updateSearchText(text);
|
|
73
|
+
updateSearchKeys(keys);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
React.useEffect(() => {
|
|
76
77
|
updateInitialTreeViewData(data);
|
|
77
78
|
|
|
78
|
-
initializeNodeMaps(
|
|
79
|
-
data,
|
|
80
|
-
preselectedIds,
|
|
81
|
-
);
|
|
82
|
-
}, [
|
|
83
|
-
updateInitialTreeViewData,
|
|
84
|
-
data,
|
|
85
|
-
preselectedIds
|
|
86
|
-
]);
|
|
79
|
+
initializeNodeMaps(data);
|
|
87
80
|
|
|
81
|
+
// Check any preselected nodes
|
|
82
|
+
toggleCheckboxes(preselectedIds, true);
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, []);
|
|
88
85
|
|
|
89
86
|
const getIds = React.useCallback((node: TreeNode): string[] => {
|
|
90
87
|
if (!node.children || node.children.length === 0) {
|
|
@@ -3,7 +3,11 @@ import Icon from 'react-native-vector-icons/FontAwesome';
|
|
|
3
3
|
|
|
4
4
|
import { ExpandIconProps } from "src/types/treeView.types";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const CustomExpandCollapseIcon = React.memo(
|
|
7
|
+
_CustomExpandCollapseIcon
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
function _CustomExpandCollapseIcon(props: ExpandIconProps) {
|
|
7
11
|
const { isExpanded } = props;
|
|
8
12
|
|
|
9
13
|
return (
|
|
@@ -18,12 +18,14 @@ import type {
|
|
|
18
18
|
|
|
19
19
|
import { useTreeViewStore } from "../store/treeView.store";
|
|
20
20
|
import {
|
|
21
|
-
|
|
21
|
+
getFilteredTreeData,
|
|
22
|
+
getFlattenedTreeData,
|
|
23
|
+
getInnerMostChildrenIdsInTree,
|
|
22
24
|
handleToggleExpand,
|
|
23
25
|
toggleCheckboxes
|
|
24
26
|
} from "../helpers";
|
|
25
27
|
import { CheckboxView } from "./CheckboxView";
|
|
26
|
-
import CustomExpandCollapseIcon from "./CustomExpandCollapseIcon";
|
|
28
|
+
import { CustomExpandCollapseIcon } from "./CustomExpandCollapseIcon";
|
|
27
29
|
import { defaultIndentationMultiplier } from "../constants/treeView.constants";
|
|
28
30
|
|
|
29
31
|
const NodeList = React.memo(_NodeList);
|
|
@@ -43,7 +45,7 @@ function _NodeList(props: NodeListProps) {
|
|
|
43
45
|
const {
|
|
44
46
|
expanded,
|
|
45
47
|
initialTreeViewData,
|
|
46
|
-
|
|
48
|
+
updateInnerMostChildrenIds,
|
|
47
49
|
searchKeys,
|
|
48
50
|
searchText
|
|
49
51
|
} = useTreeViewStore();
|
|
@@ -52,68 +54,33 @@ function _NodeList(props: NodeListProps) {
|
|
|
52
54
|
const [flattenedFilteredNodes, setFlattenedFilteredNodes]
|
|
53
55
|
= React.useState<__FlattenedTreeNode__[]>([]);
|
|
54
56
|
|
|
57
|
+
// First we filter the tree as per the search term and keys
|
|
55
58
|
React.useEffect(() => {
|
|
56
59
|
const searchTrimmed = searchText.trim().toLowerCase();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!searchTrimmed || doesNodeContainSearchTerm(node, searchTrimmed, searchKeys)) {
|
|
63
|
-
// If node itself matches, include it and all its descendants
|
|
64
|
-
filtered.push(node);
|
|
65
|
-
} else if (node.children) {
|
|
66
|
-
// If node does not match, check its children and include them if they match
|
|
67
|
-
const childMatches = filterTreeData(node.children);
|
|
68
|
-
if (childMatches.length > 0) {
|
|
69
|
-
// If any children match, include the node, replacing its children with the matching ones
|
|
70
|
-
filtered.push({ ...node, children: childMatches });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return filtered;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const tempFilterTree = filterTreeData(initialTreeViewData);
|
|
60
|
+
const tempFilterTree = getFilteredTreeData(
|
|
61
|
+
initialTreeViewData,
|
|
62
|
+
searchTrimmed,
|
|
63
|
+
searchKeys
|
|
64
|
+
);
|
|
79
65
|
setFilteredTree(tempFilterTree);
|
|
80
66
|
}, [searchText, searchKeys, initialTreeViewData]);
|
|
81
67
|
|
|
68
|
+
// Then we flatten the treen to make it "render-compatible" in a "flat" list
|
|
82
69
|
React.useEffect(() => {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
let flattened: __FlattenedTreeNode__[] = [];
|
|
88
|
-
for (let node of _nodes) {
|
|
89
|
-
flattened.push({ ...node, level });
|
|
90
|
-
if (node.children && expanded.has(node.id)) {
|
|
91
|
-
flattened = [...flattened, ...flattenTreeData(node.children, level + 1)];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return flattened;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const tempFlattenTreeData = flattenTreeData(filteredTree);
|
|
70
|
+
const tempFlattenTreeData = getFlattenedTreeData(
|
|
71
|
+
filteredTree,
|
|
72
|
+
expanded,
|
|
73
|
+
);
|
|
98
74
|
setFlattenedFilteredNodes(tempFlattenTreeData);
|
|
99
75
|
}, [filteredTree, expanded]);
|
|
100
76
|
|
|
77
|
+
// And update the innermost children id -> required to un/select filtered tree
|
|
101
78
|
React.useEffect(() => {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} else {
|
|
108
|
-
allLeafIds.push(node.id);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
getLeafNodes(filteredTree);
|
|
114
|
-
|
|
115
|
-
updatedInnerMostChildrenIds(allLeafIds);
|
|
116
|
-
}, [filteredTree, updatedInnerMostChildrenIds]);
|
|
79
|
+
const updatedInnerMostChildrenIds = getInnerMostChildrenIdsInTree(
|
|
80
|
+
filteredTree
|
|
81
|
+
);
|
|
82
|
+
updateInnerMostChildrenIds(updatedInnerMostChildrenIds);
|
|
83
|
+
}, [filteredTree, updateInnerMostChildrenIds]);
|
|
117
84
|
|
|
118
85
|
const nodeRenderer = React.useCallback((
|
|
119
86
|
{ item }: { item: __FlattenedTreeNode__; }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TreeNode, __FlattenedTreeNode__ } from "../types/treeView.types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Flatten the tree and attach a "level" key to object to indicate it's depth. This
|
|
5
|
+
* returns the flattened tree data of expanded ids only. We do not prune the tree off the
|
|
6
|
+
* children after the flattening as it would be unnecessary computation.
|
|
7
|
+
*
|
|
8
|
+
* @param nodes - Input recursive tree
|
|
9
|
+
* @param expandedIds - ids of currently expanded nodes
|
|
10
|
+
* @param level - (optional) for internal recursive use only
|
|
11
|
+
* @returns Flattened tree data with expanded ids only
|
|
12
|
+
*/
|
|
13
|
+
export function getFlattenedTreeData(
|
|
14
|
+
nodes: TreeNode[],
|
|
15
|
+
expandedIds: Set<string>,
|
|
16
|
+
__level__: number = 0,
|
|
17
|
+
): __FlattenedTreeNode__[] {
|
|
18
|
+
let flattened: __FlattenedTreeNode__[] = [];
|
|
19
|
+
for (let node of nodes) {
|
|
20
|
+
flattened.push({ ...node, level: __level__ });
|
|
21
|
+
if (node.children && expandedIds.has(node.id)) {
|
|
22
|
+
flattened = [
|
|
23
|
+
...flattened,
|
|
24
|
+
...getFlattenedTreeData(node.children, expandedIds, __level__ + 1)
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return flattened;
|
|
29
|
+
};
|
package/src/helpers/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { TreeNode } from "../types/treeView.types";
|
|
|
2
2
|
import {
|
|
3
3
|
useTreeViewStore
|
|
4
4
|
} from "../store/treeView.store";
|
|
5
|
-
import { toggleCheckboxes } from "./toggleCheckbox.helper";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Initialize the maps for tracking tree nodes and their parent-child relationships.
|
|
@@ -13,10 +12,7 @@ import { toggleCheckboxes } from "./toggleCheckbox.helper";
|
|
|
13
12
|
* @param initialData - An array of TreeNode objects that represent the initial tree structure.
|
|
14
13
|
* @param preselectedIds - An optional array of TreeNode IDs that should be preselected.
|
|
15
14
|
*/
|
|
16
|
-
export function initializeNodeMaps(
|
|
17
|
-
initialData: TreeNode[],
|
|
18
|
-
preselectedIds: string[] = [],
|
|
19
|
-
) {
|
|
15
|
+
export function initializeNodeMaps(initialData: TreeNode[]) {
|
|
20
16
|
const {
|
|
21
17
|
updateNodeMap,
|
|
22
18
|
updateChildToParentMap
|
|
@@ -50,7 +46,4 @@ export function initializeNodeMaps(
|
|
|
50
46
|
|
|
51
47
|
updateNodeMap(tempNodeMap);
|
|
52
48
|
updateChildToParentMap(tempChildToParentMap);
|
|
53
|
-
|
|
54
|
-
// Check any preselected nodes
|
|
55
|
-
toggleCheckboxes(preselectedIds, true);
|
|
56
49
|
}
|
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
import { TreeNode } from "../types/treeView.types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Get filtered tree data based on the search term and the search keys
|
|
5
|
+
* If any of the parent contains the search term, the tree will also contain
|
|
6
|
+
* it's children.
|
|
7
|
+
*
|
|
8
|
+
* If only one of the innermost children contains the search term then it's siblings
|
|
9
|
+
* won't be included in the search. But all it's ancestor nodes will be included
|
|
10
|
+
*
|
|
11
|
+
* @param nodes Input tree data
|
|
12
|
+
* @param trimmedSearchTerm search term
|
|
13
|
+
* @param searchKeys search key
|
|
14
|
+
* @returns filtered tree data
|
|
15
|
+
*/
|
|
16
|
+
export function getFilteredTreeData(
|
|
17
|
+
nodes: TreeNode[],
|
|
18
|
+
trimmedSearchTerm: string,
|
|
19
|
+
searchKeys: string[]
|
|
20
|
+
): TreeNode[] {
|
|
21
|
+
let filtered: TreeNode[] = [];
|
|
22
|
+
|
|
23
|
+
for (let node of nodes) {
|
|
24
|
+
const isSearchTermInNode = doesNodeContainSearchTerm(
|
|
25
|
+
node,
|
|
26
|
+
trimmedSearchTerm,
|
|
27
|
+
searchKeys
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (!trimmedSearchTerm || isSearchTermInNode) {
|
|
31
|
+
// If node itself matches, include it and all its descendants
|
|
32
|
+
filtered.push(node);
|
|
33
|
+
} else if (node.children) {
|
|
34
|
+
// If node does not match, check its children and include them if they match
|
|
35
|
+
const childMatches = getFilteredTreeData(
|
|
36
|
+
node.children,
|
|
37
|
+
trimmedSearchTerm,
|
|
38
|
+
searchKeys
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if (childMatches.length > 0) {
|
|
42
|
+
// If any children match, include the node, replacing its children with the matching ones
|
|
43
|
+
filtered.push({ ...node, children: childMatches });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return filtered;
|
|
49
|
+
};
|
|
50
|
+
|
|
3
51
|
/**
|
|
4
52
|
* Checks if a given tree node contains a specific search term in any of its specified keys.
|
|
5
53
|
*
|
|
@@ -11,7 +59,7 @@ import { TreeNode } from "../types/treeView.types";
|
|
|
11
59
|
* @param searchKeys - The keys in the tree node to search in.
|
|
12
60
|
* @returns True if the search term is found in any of the specified keys, false otherwise.
|
|
13
61
|
*/
|
|
14
|
-
|
|
62
|
+
function doesNodeContainSearchTerm(
|
|
15
63
|
node: TreeNode,
|
|
16
64
|
searchTerm: string,
|
|
17
65
|
searchKeys: string[]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TreeNode } from "../types/treeView.types";
|
|
1
2
|
import { useTreeViewStore } from "../store/treeView.store";
|
|
2
3
|
import { toggleCheckboxes } from "./toggleCheckbox.helper";
|
|
3
4
|
|
|
@@ -68,3 +69,29 @@ export function unselectAll() {
|
|
|
68
69
|
updateChecked(new Set());
|
|
69
70
|
updateIndeterminate(new Set());
|
|
70
71
|
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get the ids of the innermost children in the tree
|
|
75
|
+
*
|
|
76
|
+
* @param filteredTreeNodes - The filtered tree data
|
|
77
|
+
* @returns - array of ids of the inner most children only
|
|
78
|
+
*/
|
|
79
|
+
export function getInnerMostChildrenIdsInTree(
|
|
80
|
+
filteredTreeNodes: TreeNode[]
|
|
81
|
+
): string[] {
|
|
82
|
+
const allLeafIds: string[] = [];
|
|
83
|
+
|
|
84
|
+
const getLeafNodes = (_nodes: TreeNode[]) => {
|
|
85
|
+
for (let node of _nodes) {
|
|
86
|
+
if (node.children) {
|
|
87
|
+
getLeafNodes(node.children);
|
|
88
|
+
} else {
|
|
89
|
+
allLeafIds.push(node.id);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
getLeafNodes(filteredTreeNodes);
|
|
95
|
+
|
|
96
|
+
return allLeafIds;
|
|
97
|
+
}
|
|
@@ -2,34 +2,44 @@ import type { TreeNode } from "src/types/treeView.types";
|
|
|
2
2
|
|
|
3
3
|
import { create } from 'zustand';
|
|
4
4
|
|
|
5
|
-
type TreeViewState = {
|
|
5
|
+
export type TreeViewState = {
|
|
6
|
+
// Store ids of checked tree nodes
|
|
6
7
|
checked: Set<string>;
|
|
7
8
|
updateChecked: (checked: Set<string>) => void;
|
|
8
9
|
|
|
10
|
+
// Store ids of indeterminate state nodes
|
|
9
11
|
indeterminate: Set<string>;
|
|
10
12
|
updateIndeterminate: (indeterminate: Set<string>) => void;
|
|
11
13
|
|
|
14
|
+
// Store ids of expanded parent nodes
|
|
12
15
|
expanded: Set<string>;
|
|
13
16
|
updateExpanded: (expanded: Set<string>) => void;
|
|
14
17
|
|
|
18
|
+
// Store initial tree view data exactly as passed by the consumer
|
|
15
19
|
initialTreeViewData: TreeNode[];
|
|
16
20
|
updateInitialTreeViewData: (initialTreeViewData: TreeNode[]) => void;
|
|
17
21
|
|
|
22
|
+
// Map to store the id to the tree node map
|
|
18
23
|
nodeMap: Map<string, TreeNode>;
|
|
19
24
|
updateNodeMap: (nodeMap: Map<string, TreeNode>) => void;
|
|
20
25
|
|
|
26
|
+
// Map to store child id to parent id map
|
|
21
27
|
childToParentMap: Map<string, string>;
|
|
22
28
|
updateChildToParentMap: (childToParentMap: Map<string, string>) => void;
|
|
23
29
|
|
|
30
|
+
// Search text state
|
|
24
31
|
searchText: string;
|
|
25
|
-
|
|
32
|
+
updateSearchText: (searchText: string) => void;
|
|
26
33
|
|
|
34
|
+
// Search keys state
|
|
27
35
|
searchKeys: string[];
|
|
28
|
-
|
|
36
|
+
updateSearchKeys: (searchKeys: string[]) => void;
|
|
29
37
|
|
|
38
|
+
// To store inner most children ids - required to un/select all filtered-only nodes
|
|
30
39
|
innerMostChildrenIds: string[];
|
|
31
|
-
|
|
40
|
+
updateInnerMostChildrenIds: (innerMostChildrenIds: string[]) => void;
|
|
32
41
|
|
|
42
|
+
// Cleanup all states in this store
|
|
33
43
|
cleanUpTreeViewStore: () => void;
|
|
34
44
|
};
|
|
35
45
|
|
|
@@ -55,13 +65,13 @@ export const useTreeViewStore = create<TreeViewState>((set) => ({
|
|
|
55
65
|
updateChildToParentMap: (childToParentMap: Map<string, string>) => set({ childToParentMap }),
|
|
56
66
|
|
|
57
67
|
searchText: "",
|
|
58
|
-
|
|
68
|
+
updateSearchText: (searchText: string) => set({ searchText }),
|
|
59
69
|
|
|
60
70
|
searchKeys: [""],
|
|
61
|
-
|
|
71
|
+
updateSearchKeys: (searchKeys: string[]) => set({ searchKeys }),
|
|
62
72
|
|
|
63
73
|
innerMostChildrenIds: [],
|
|
64
|
-
|
|
74
|
+
updateInnerMostChildrenIds: (innerMostChildrenIds: string[]) => set({ innerMostChildrenIds }),
|
|
65
75
|
|
|
66
76
|
cleanUpTreeViewStore: () =>
|
|
67
77
|
set({
|
|
@@ -65,9 +65,9 @@ type CheckboxProps = Omit<RNPaperCheckboxAndroidProps, "onPress" | "status">;
|
|
|
65
65
|
|
|
66
66
|
export interface CheckBoxViewStyleProps {
|
|
67
67
|
// Optional style modifiers
|
|
68
|
-
outermostParentViewStyle?: StyleProp<ViewStyle
|
|
69
|
-
checkboxParentViewStyle?: StyleProp<ViewStyle
|
|
70
|
-
textTouchableStyle?: StyleProp<ViewStyle
|
|
68
|
+
outermostParentViewStyle?: StyleProp<ViewStyle>;
|
|
69
|
+
checkboxParentViewStyle?: StyleProp<ViewStyle>;
|
|
70
|
+
textTouchableStyle?: StyleProp<ViewStyle>;
|
|
71
71
|
|
|
72
72
|
// Optional checkbox and text component props
|
|
73
73
|
checkboxProps?: CheckboxProps;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAEV,aAAa,EACb,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAsIhC,eAAO,MAAM,QAAQ,8GAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxView.d.ts","sourceRoot":"","sources":["../../../src/components/CheckboxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EACR,iBAAiB,EAEpB,MAAM,yBAAyB,CAAC;AAYjC,eAAO,MAAM,YAAY,iDAA2C,CAAC;AAErE,iBAAS,aAAa,CAAC,KAAK,EAAE,iBAAiB,qBA+D9C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;CAgBpC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomExpandCollapseIcon.d.ts","sourceRoot":"","sources":["../../../src/components/CustomExpandCollapseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAK,EAAE,eAAe,qBActE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeList.d.ts","sourceRoot":"","sources":["../../../src/components/NodeList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAKR,aAAa,EAEhB,MAAM,yBAAyB,CAAC;AAYjC,QAAA,MAAM,QAAQ,6CAAwB,CAAC;AACvC,eAAe,QAAQ,CAAC;AAExB,iBAAS,SAAS,CAAC,KAAK,EAAE,aAAa,qBA2HtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"treeView.constants.d.ts","sourceRoot":"","sources":["../../../src/constants/treeView.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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,QA4D5C;AAED;;GAEG;AACH,wBAAgB,SAAS,SAKxB;AAED;;GAEG;AACH,wBAAgB,WAAW,SAK1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initNodeMap.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/initNodeMap.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAMxD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,WAAW,EAAE,QAAQ,EAAE,EACvB,cAAc,GAAE,MAAM,EAAO,QAsChC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TreeNode } from "../types/treeView.types";
|
|
2
|
-
/**
|
|
3
|
-
* Checks if a given tree node contains a specific search term in any of its specified keys.
|
|
4
|
-
*
|
|
5
|
-
* This function will check each of the specified keys in the tree node, convert the key's value to a string,
|
|
6
|
-
* and check if it includes the search term.
|
|
7
|
-
*
|
|
8
|
-
* @param node - The tree node to search through.
|
|
9
|
-
* @param searchTerm - The term to search for.
|
|
10
|
-
* @param searchKeys - The keys in the tree node to search in.
|
|
11
|
-
* @returns True if the search term is found in any of the specified keys, false otherwise.
|
|
12
|
-
*/
|
|
13
|
-
export declare function doesNodeContainSearchTerm(node: TreeNode, searchTerm: string, searchKeys: string[]): boolean;
|
|
14
|
-
//# sourceMappingURL=search.helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/search.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACrC,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAAE,GACrB,OAAO,CAUT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selectAll.helper.d.ts","sourceRoot":"","sources":["../../../src/helpers/selectAll.helper.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,SAWhC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,SAUlC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,SAaxB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,SAM1B"}
|
|
@@ -1 +0,0 @@
|
|
|
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,QAkJnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAE1C,YAAY,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"treeView.store.d.ts","sourceRoot":"","sources":["../../../src/store/treeView.store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzD,KAAK,aAAa,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,aAAa,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAE9C,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAE1D,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,cAAc,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAEhD,mBAAmB,EAAE,QAAQ,EAAE,CAAC;IAChC,yBAAyB,EAAE,CAAC,mBAAmB,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IAErE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/B,aAAa,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;IAExD,gBAAgB,EAAE,GAAG,CAAC,MAAM,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