react-native-tree-multi-select 0.5.3 → 0.8.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.
- package/README.md +5 -6
- package/lib/commonjs/TreeView.js +42 -48
- package/lib/commonjs/TreeView.js.map +1 -1
- package/lib/commonjs/components/NodeList.js +98 -92
- package/lib/commonjs/components/NodeList.js.map +1 -1
- package/lib/commonjs/helpers/expandCollapse.helper.js +21 -8
- package/lib/commonjs/helpers/expandCollapse.helper.js.map +1 -1
- package/lib/commonjs/helpers/initNodeMap.helper.js +14 -3
- package/lib/commonjs/helpers/initNodeMap.helper.js.map +1 -1
- package/lib/commonjs/helpers/selectAll.helper.js +32 -14
- package/lib/commonjs/helpers/selectAll.helper.js.map +1 -1
- package/lib/commonjs/helpers/toggleCheckbox.helper.js +34 -27
- package/lib/commonjs/helpers/toggleCheckbox.helper.js.map +1 -1
- package/lib/commonjs/store/global.store.js +92 -0
- package/lib/commonjs/store/global.store.js.map +1 -0
- package/lib/module/TreeView.js +42 -46
- package/lib/module/TreeView.js.map +1 -1
- package/lib/module/components/NodeList.js +96 -92
- package/lib/module/components/NodeList.js.map +1 -1
- package/lib/module/helpers/expandCollapse.helper.js +21 -8
- package/lib/module/helpers/expandCollapse.helper.js.map +1 -1
- package/lib/module/helpers/initNodeMap.helper.js +14 -3
- package/lib/module/helpers/initNodeMap.helper.js.map +1 -1
- package/lib/module/helpers/selectAll.helper.js +32 -14
- package/lib/module/helpers/selectAll.helper.js.map +1 -1
- package/lib/module/helpers/toggleCheckbox.helper.js +34 -27
- package/lib/module/helpers/toggleCheckbox.helper.js.map +1 -1
- package/lib/module/store/global.store.js +85 -0
- package/lib/module/store/global.store.js.map +1 -0
- package/lib/typescript/TreeView.d.ts.map +1 -1
- package/lib/typescript/components/NodeList.d.ts.map +1 -1
- package/lib/typescript/helpers/expandCollapse.helper.d.ts.map +1 -1
- package/lib/typescript/helpers/initNodeMap.helper.d.ts.map +1 -1
- package/lib/typescript/helpers/selectAll.helper.d.ts.map +1 -1
- package/lib/typescript/helpers/toggleCheckbox.helper.d.ts.map +1 -1
- package/lib/typescript/store/global.store.d.ts +24 -0
- package/lib/typescript/store/global.store.d.ts.map +1 -0
- package/lib/typescript/types/treeView.types.d.ts +0 -4
- package/lib/typescript/types/treeView.types.d.ts.map +1 -1
- package/package.json +23 -14
- package/src/TreeView.tsx +53 -62
- package/src/components/NodeList.tsx +102 -107
- package/src/helpers/expandCollapse.helper.ts +12 -12
- package/src/helpers/initNodeMap.helper.ts +15 -5
- package/src/helpers/selectAll.helper.ts +20 -13
- package/src/helpers/toggleCheckbox.helper.ts +36 -24
- package/src/store/global.store.ts +111 -0
- package/src/types/treeView.types.ts +0 -5
- package/lib/commonjs/signals/global.signals.js +0 -42
- package/lib/commonjs/signals/global.signals.js.map +0 -1
- package/lib/module/signals/global.signals.js +0 -26
- package/lib/module/signals/global.signals.js.map +0 -1
- package/lib/typescript/signals/global.signals.d.ts +0 -11
- package/lib/typescript/signals/global.signals.d.ts.map +0 -1
- package/src/signals/global.signals.ts +0 -36
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { TreeNode } from "src/types/treeView.types";
|
|
2
|
+
|
|
3
|
+
import { create } from 'zustand';
|
|
4
|
+
|
|
5
|
+
export type GlobalState = {
|
|
6
|
+
checked: Set<string>;
|
|
7
|
+
updateChecked: (checked: Set<string>) => void;
|
|
8
|
+
|
|
9
|
+
indeterminate: Set<string>;
|
|
10
|
+
updateIndeterminate: (indeterminate: Set<string>) => void;
|
|
11
|
+
|
|
12
|
+
expanded: Set<string>;
|
|
13
|
+
updateExpanded: (expanded: Set<string>) => void;
|
|
14
|
+
|
|
15
|
+
globalData: TreeNode[];
|
|
16
|
+
updateGlobalData: (globalData: TreeNode[]) => void;
|
|
17
|
+
|
|
18
|
+
nodeMap: Map<string, TreeNode>;
|
|
19
|
+
updateNodeMap: (nodeMap: Map<string, TreeNode>) => void;
|
|
20
|
+
|
|
21
|
+
childToParentMap: Map<string, string>;
|
|
22
|
+
updateChildToParentMap: (childToParentMap: Map<string, string>) => void;
|
|
23
|
+
|
|
24
|
+
searchText: string;
|
|
25
|
+
updatedSearchText: (searchText: string) => void;
|
|
26
|
+
|
|
27
|
+
searchKeys: string[];
|
|
28
|
+
updatedSearchKeys: (searchKeys: string[]) => void;
|
|
29
|
+
|
|
30
|
+
innerMostChildrenIds: string[];
|
|
31
|
+
updatedInnerMostChildrenIds: (innerMostChildrenIds: string[]) => void;
|
|
32
|
+
|
|
33
|
+
cleanUpGlobalSignals: () => void;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const useStore = create<GlobalState>((set) => ({
|
|
37
|
+
checked: new Set(),
|
|
38
|
+
updateChecked: (checked: Set<string>) => set({ checked }),
|
|
39
|
+
|
|
40
|
+
indeterminate: new Set(),
|
|
41
|
+
updateIndeterminate: (indeterminate: Set<string>) => set({ indeterminate }),
|
|
42
|
+
|
|
43
|
+
expanded: new Set<string>(),
|
|
44
|
+
updateExpanded: (expanded: Set<string>) => set({ expanded }),
|
|
45
|
+
|
|
46
|
+
globalData: [],
|
|
47
|
+
updateGlobalData: (globalData: TreeNode[]) => set({ globalData }),
|
|
48
|
+
|
|
49
|
+
nodeMap: new Map<string, TreeNode>(),
|
|
50
|
+
updateNodeMap: (nodeMap: Map<string, TreeNode>) => set({ nodeMap }),
|
|
51
|
+
|
|
52
|
+
childToParentMap: new Map<string, string>(),
|
|
53
|
+
updateChildToParentMap: (childToParentMap: Map<string, string>) => set({ childToParentMap }),
|
|
54
|
+
|
|
55
|
+
searchText: "",
|
|
56
|
+
updatedSearchText: (searchText: string) => set({ searchText }),
|
|
57
|
+
|
|
58
|
+
searchKeys: [""],
|
|
59
|
+
updatedSearchKeys: (searchKeys: string[]) => set({ searchKeys }),
|
|
60
|
+
|
|
61
|
+
innerMostChildrenIds: [],
|
|
62
|
+
updatedInnerMostChildrenIds: (innerMostChildrenIds: string[]) => set({ innerMostChildrenIds }),
|
|
63
|
+
|
|
64
|
+
cleanUpGlobalSignals: () =>
|
|
65
|
+
set({
|
|
66
|
+
checked: new Set(),
|
|
67
|
+
indeterminate: new Set(),
|
|
68
|
+
expanded: new Set<string>(),
|
|
69
|
+
globalData: [],
|
|
70
|
+
nodeMap: new Map<string, TreeNode>(),
|
|
71
|
+
childToParentMap: new Map<string, string>(),
|
|
72
|
+
searchText: "",
|
|
73
|
+
searchKeys: [""],
|
|
74
|
+
innerMostChildrenIds: [],
|
|
75
|
+
}),
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// export const state = signal<__CheckBoxState__>({
|
|
80
|
+
// checked: new Set(),
|
|
81
|
+
// indeterminate: new Set(),
|
|
82
|
+
// });
|
|
83
|
+
// export const expanded = signal(new Set<string>());
|
|
84
|
+
|
|
85
|
+
// export const globalData = signal<TreeNode[]>([]);
|
|
86
|
+
|
|
87
|
+
// export const nodeMap = signal(new Map<string, TreeNode>());
|
|
88
|
+
// export const childToParentMap = signal(new Map<string, string>());
|
|
89
|
+
|
|
90
|
+
// export const searchText = signal("");
|
|
91
|
+
// export const searchKeys = signal<string[]>([""]);
|
|
92
|
+
|
|
93
|
+
// export const innerMostChildrenIds = signal<string[]>([]);
|
|
94
|
+
|
|
95
|
+
// export function cleanUpGlobalSignals() {
|
|
96
|
+
// state.value = ({
|
|
97
|
+
// checked: new Set(),
|
|
98
|
+
// indeterminate: new Set(),
|
|
99
|
+
// });
|
|
100
|
+
// expanded.value = new Set<string>();
|
|
101
|
+
|
|
102
|
+
// globalData.value = [];
|
|
103
|
+
|
|
104
|
+
// nodeMap.value = new Map<string, TreeNode>();
|
|
105
|
+
// childToParentMap.value = new Map<string, string>();
|
|
106
|
+
|
|
107
|
+
// searchText.value = "";
|
|
108
|
+
// searchKeys.value = [];
|
|
109
|
+
|
|
110
|
+
// innerMostChildrenIds.value = [];
|
|
111
|
+
// }
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.childToParentMap = void 0;
|
|
7
|
-
exports.cleanUpGlobalSignals = cleanUpGlobalSignals;
|
|
8
|
-
exports.state = exports.searchText = exports.searchKeys = exports.nodeMap = exports.innerMostChildrenIds = exports.globalData = exports.expanded = void 0;
|
|
9
|
-
var _signalsReact = require("@preact/signals-react");
|
|
10
|
-
const state = (0, _signalsReact.signal)({
|
|
11
|
-
checked: new Set(),
|
|
12
|
-
indeterminate: new Set()
|
|
13
|
-
});
|
|
14
|
-
exports.state = state;
|
|
15
|
-
const expanded = (0, _signalsReact.signal)(new Set());
|
|
16
|
-
exports.expanded = expanded;
|
|
17
|
-
const globalData = (0, _signalsReact.signal)([]);
|
|
18
|
-
exports.globalData = globalData;
|
|
19
|
-
const nodeMap = (0, _signalsReact.signal)(new Map());
|
|
20
|
-
exports.nodeMap = nodeMap;
|
|
21
|
-
const childToParentMap = (0, _signalsReact.signal)(new Map());
|
|
22
|
-
exports.childToParentMap = childToParentMap;
|
|
23
|
-
const searchText = (0, _signalsReact.signal)("");
|
|
24
|
-
exports.searchText = searchText;
|
|
25
|
-
const searchKeys = (0, _signalsReact.signal)([""]);
|
|
26
|
-
exports.searchKeys = searchKeys;
|
|
27
|
-
const innerMostChildrenIds = (0, _signalsReact.signal)([]);
|
|
28
|
-
exports.innerMostChildrenIds = innerMostChildrenIds;
|
|
29
|
-
function cleanUpGlobalSignals() {
|
|
30
|
-
state.value = {
|
|
31
|
-
checked: new Set(),
|
|
32
|
-
indeterminate: new Set()
|
|
33
|
-
};
|
|
34
|
-
expanded.value = new Set();
|
|
35
|
-
globalData.value = [];
|
|
36
|
-
nodeMap.value = new Map();
|
|
37
|
-
childToParentMap.value = new Map();
|
|
38
|
-
searchText.value = "";
|
|
39
|
-
searchKeys.value = [];
|
|
40
|
-
innerMostChildrenIds.value = [];
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=global.signals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_signalsReact","require","state","signal","checked","Set","indeterminate","exports","expanded","globalData","nodeMap","Map","childToParentMap","searchText","searchKeys","innerMostChildrenIds","cleanUpGlobalSignals","value"],"sourceRoot":"../../../src","sources":["signals/global.signals.ts"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGO,MAAMC,KAAK,GAAG,IAAAC,oBAAM,EAAoB;EAC3CC,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;EAClBC,aAAa,EAAE,IAAID,GAAG,CAAC;AAC3B,CAAC,CAAC;AAACE,OAAA,CAAAL,KAAA,GAAAA,KAAA;AACI,MAAMM,QAAQ,GAAG,IAAAL,oBAAM,EAAC,IAAIE,GAAG,CAAS,CAAC,CAAC;AAACE,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAE3C,MAAMC,UAAU,GAAG,IAAAN,oBAAM,EAAa,EAAE,CAAC;AAACI,OAAA,CAAAE,UAAA,GAAAA,UAAA;AAE1C,MAAMC,OAAO,GAAG,IAAAP,oBAAM,EAAC,IAAIQ,GAAG,CAAmB,CAAC,CAAC;AAACJ,OAAA,CAAAG,OAAA,GAAAA,OAAA;AACpD,MAAME,gBAAgB,GAAG,IAAAT,oBAAM,EAAC,IAAIQ,GAAG,CAAiB,CAAC,CAAC;AAACJ,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAE3D,MAAMC,UAAU,GAAG,IAAAV,oBAAM,EAAC,EAAE,CAAC;AAACI,OAAA,CAAAM,UAAA,GAAAA,UAAA;AAC9B,MAAMC,UAAU,GAAG,IAAAX,oBAAM,EAAW,CAAC,EAAE,CAAC,CAAC;AAACI,OAAA,CAAAO,UAAA,GAAAA,UAAA;AAE1C,MAAMC,oBAAoB,GAAG,IAAAZ,oBAAM,EAAW,EAAE,CAAC;AAACI,OAAA,CAAAQ,oBAAA,GAAAA,oBAAA;AAElD,SAASC,oBAAoBA,CAAA,EAAG;EACnCd,KAAK,CAACe,KAAK,GAAI;IACXb,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;IAClBC,aAAa,EAAE,IAAID,GAAG,CAAC;EAC3B,CAAE;EACFG,QAAQ,CAACS,KAAK,GAAG,IAAIZ,GAAG,CAAS,CAAC;EAElCI,UAAU,CAACQ,KAAK,GAAG,EAAE;EAErBP,OAAO,CAACO,KAAK,GAAG,IAAIN,GAAG,CAAmB,CAAC;EAC3CC,gBAAgB,CAACK,KAAK,GAAG,IAAIN,GAAG,CAAiB,CAAC;EAElDE,UAAU,CAACI,KAAK,GAAG,EAAE;EACrBH,UAAU,CAACG,KAAK,GAAG,EAAE;EAErBF,oBAAoB,CAACE,KAAK,GAAG,EAAE;AACnC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { signal } from "@preact/signals-react";
|
|
2
|
-
export const state = signal({
|
|
3
|
-
checked: new Set(),
|
|
4
|
-
indeterminate: new Set()
|
|
5
|
-
});
|
|
6
|
-
export const expanded = signal(new Set());
|
|
7
|
-
export const globalData = signal([]);
|
|
8
|
-
export const nodeMap = signal(new Map());
|
|
9
|
-
export const childToParentMap = signal(new Map());
|
|
10
|
-
export const searchText = signal("");
|
|
11
|
-
export const searchKeys = signal([""]);
|
|
12
|
-
export const innerMostChildrenIds = signal([]);
|
|
13
|
-
export function cleanUpGlobalSignals() {
|
|
14
|
-
state.value = {
|
|
15
|
-
checked: new Set(),
|
|
16
|
-
indeterminate: new Set()
|
|
17
|
-
};
|
|
18
|
-
expanded.value = new Set();
|
|
19
|
-
globalData.value = [];
|
|
20
|
-
nodeMap.value = new Map();
|
|
21
|
-
childToParentMap.value = new Map();
|
|
22
|
-
searchText.value = "";
|
|
23
|
-
searchKeys.value = [];
|
|
24
|
-
innerMostChildrenIds.value = [];
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=global.signals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["signal","state","checked","Set","indeterminate","expanded","globalData","nodeMap","Map","childToParentMap","searchText","searchKeys","innerMostChildrenIds","cleanUpGlobalSignals","value"],"sourceRoot":"../../../src","sources":["signals/global.signals.ts"],"mappings":"AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAG9C,OAAO,MAAMC,KAAK,GAAGD,MAAM,CAAoB;EAC3CE,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;EAClBC,aAAa,EAAE,IAAID,GAAG,CAAC;AAC3B,CAAC,CAAC;AACF,OAAO,MAAME,QAAQ,GAAGL,MAAM,CAAC,IAAIG,GAAG,CAAS,CAAC,CAAC;AAEjD,OAAO,MAAMG,UAAU,GAAGN,MAAM,CAAa,EAAE,CAAC;AAEhD,OAAO,MAAMO,OAAO,GAAGP,MAAM,CAAC,IAAIQ,GAAG,CAAmB,CAAC,CAAC;AAC1D,OAAO,MAAMC,gBAAgB,GAAGT,MAAM,CAAC,IAAIQ,GAAG,CAAiB,CAAC,CAAC;AAEjE,OAAO,MAAME,UAAU,GAAGV,MAAM,CAAC,EAAE,CAAC;AACpC,OAAO,MAAMW,UAAU,GAAGX,MAAM,CAAW,CAAC,EAAE,CAAC,CAAC;AAEhD,OAAO,MAAMY,oBAAoB,GAAGZ,MAAM,CAAW,EAAE,CAAC;AAExD,OAAO,SAASa,oBAAoBA,CAAA,EAAG;EACnCZ,KAAK,CAACa,KAAK,GAAI;IACXZ,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;IAClBC,aAAa,EAAE,IAAID,GAAG,CAAC;EAC3B,CAAE;EACFE,QAAQ,CAACS,KAAK,GAAG,IAAIX,GAAG,CAAS,CAAC;EAElCG,UAAU,CAACQ,KAAK,GAAG,EAAE;EAErBP,OAAO,CAACO,KAAK,GAAG,IAAIN,GAAG,CAAmB,CAAC;EAC3CC,gBAAgB,CAACK,KAAK,GAAG,IAAIN,GAAG,CAAiB,CAAC;EAElDE,UAAU,CAACI,KAAK,GAAG,EAAE;EACrBH,UAAU,CAACG,KAAK,GAAG,EAAE;EAErBF,oBAAoB,CAACE,KAAK,GAAG,EAAE;AACnC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TreeNode, __CheckBoxState__ } from "src/types/treeView.types";
|
|
2
|
-
export declare const state: import("@preact/signals-core").Signal<__CheckBoxState__>;
|
|
3
|
-
export declare const expanded: import("@preact/signals-core").Signal<Set<string>>;
|
|
4
|
-
export declare const globalData: import("@preact/signals-core").Signal<TreeNode[]>;
|
|
5
|
-
export declare const nodeMap: import("@preact/signals-core").Signal<Map<string, TreeNode>>;
|
|
6
|
-
export declare const childToParentMap: import("@preact/signals-core").Signal<Map<string, string>>;
|
|
7
|
-
export declare const searchText: import("@preact/signals-core").Signal<string>;
|
|
8
|
-
export declare const searchKeys: import("@preact/signals-core").Signal<string[]>;
|
|
9
|
-
export declare const innerMostChildrenIds: import("@preact/signals-core").Signal<string[]>;
|
|
10
|
-
export declare function cleanUpGlobalSignals(): void;
|
|
11
|
-
//# sourceMappingURL=global.signals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global.signals.d.ts","sourceRoot":"","sources":["../../../src/signals/global.signals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,eAAO,MAAM,KAAK,0DAGhB,CAAC;AACH,eAAO,MAAM,QAAQ,oDAA4B,CAAC;AAElD,eAAO,MAAM,UAAU,mDAAyB,CAAC;AAEjD,eAAO,MAAM,OAAO,8DAAsC,CAAC;AAC3D,eAAO,MAAM,gBAAgB,4DAAoC,CAAC;AAElE,eAAO,MAAM,UAAU,+CAAa,CAAC;AACrC,eAAO,MAAM,UAAU,iDAAyB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,iDAAuB,CAAC;AAEzD,wBAAgB,oBAAoB,SAgBnC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { signal } from "@preact/signals-react";
|
|
2
|
-
import type { TreeNode, __CheckBoxState__ } from "src/types/treeView.types";
|
|
3
|
-
|
|
4
|
-
export const state = signal<__CheckBoxState__>({
|
|
5
|
-
checked: new Set(),
|
|
6
|
-
indeterminate: new Set(),
|
|
7
|
-
});
|
|
8
|
-
export const expanded = signal(new Set<string>());
|
|
9
|
-
|
|
10
|
-
export const globalData = signal<TreeNode[]>([]);
|
|
11
|
-
|
|
12
|
-
export const nodeMap = signal(new Map<string, TreeNode>());
|
|
13
|
-
export const childToParentMap = signal(new Map<string, string>());
|
|
14
|
-
|
|
15
|
-
export const searchText = signal("");
|
|
16
|
-
export const searchKeys = signal<string[]>([""]);
|
|
17
|
-
|
|
18
|
-
export const innerMostChildrenIds = signal<string[]>([]);
|
|
19
|
-
|
|
20
|
-
export function cleanUpGlobalSignals() {
|
|
21
|
-
state.value = ({
|
|
22
|
-
checked: new Set(),
|
|
23
|
-
indeterminate: new Set(),
|
|
24
|
-
});
|
|
25
|
-
expanded.value = new Set<string>();
|
|
26
|
-
|
|
27
|
-
globalData.value = [];
|
|
28
|
-
|
|
29
|
-
nodeMap.value = new Map<string, TreeNode>();
|
|
30
|
-
childToParentMap.value = new Map<string, string>();
|
|
31
|
-
|
|
32
|
-
searchText.value = "";
|
|
33
|
-
searchKeys.value = [];
|
|
34
|
-
|
|
35
|
-
innerMostChildrenIds.value = [];
|
|
36
|
-
}
|