@asup/tree-of-nodes 1.0.6 → 2.0.0
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 +70 -56
- package/dist/cjs/main.css +10 -0
- package/dist/cjs/main.css.map +1 -0
- package/dist/cjs/main.js +136 -53
- package/dist/cjs/main.js.map +1 -1
- package/dist/main.css +10 -0
- package/dist/main.css.map +1 -0
- package/dist/main.js +100 -31
- package/dist/main.js.map +1 -1
- package/dist/tree-of-nodes.d.ts +60 -54
- package/dist/tree-of-nodes.d.ts.map +1 -1
- package/package.json +6 -4
package/dist/tree-of-nodes.d.ts
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
import React, { Key } from "react";
|
|
2
|
-
export interface iNodeUpdate {
|
|
3
|
-
success: boolean;
|
|
4
|
-
ErrorText?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface TreeNodeBase {
|
|
7
|
-
id: Key;
|
|
8
|
-
label: string;
|
|
9
|
-
parentId?: Key;
|
|
10
|
-
}
|
|
11
|
-
export interface TreeNodeData<T> extends TreeNodeBase {
|
|
12
|
-
data: T;
|
|
13
|
-
}
|
|
14
|
-
declare const getAncestors: (id: Key, included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[];
|
|
15
|
-
interface WordEntryProps {
|
|
16
|
-
id: Key;
|
|
17
|
-
value?: string;
|
|
18
|
-
editing?: boolean;
|
|
19
|
-
saving?: boolean;
|
|
20
|
-
setValue?: (ret: string) => void;
|
|
21
|
-
sendEscape?: () => void;
|
|
22
|
-
style?: React.CSSProperties;
|
|
23
|
-
}
|
|
24
|
-
export const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
25
|
-
interface TreeNodeProps {
|
|
26
|
-
id: Key;
|
|
27
|
-
indentLevel?: number;
|
|
28
|
-
canRemove?: boolean;
|
|
29
|
-
canRename?: boolean;
|
|
30
|
-
canAddChildren?: boolean;
|
|
31
|
-
canRemoveChildren?: boolean;
|
|
32
|
-
canRenameChildren?: boolean;
|
|
33
|
-
refresh?: () => void;
|
|
34
|
-
}
|
|
35
|
-
export const TreeNode:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
import React, { Key } from "react";
|
|
2
|
+
export interface iNodeUpdate {
|
|
3
|
+
success: boolean;
|
|
4
|
+
ErrorText?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TreeNodeBase {
|
|
7
|
+
id: Key;
|
|
8
|
+
label: string;
|
|
9
|
+
parentId?: Key;
|
|
10
|
+
}
|
|
11
|
+
export interface TreeNodeData<T> extends TreeNodeBase {
|
|
12
|
+
data: T;
|
|
13
|
+
}
|
|
14
|
+
declare const getAncestors: (id: Key | Key[], included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[];
|
|
15
|
+
interface WordEntryProps {
|
|
16
|
+
id: Key;
|
|
17
|
+
value?: string;
|
|
18
|
+
editing?: boolean;
|
|
19
|
+
saving?: boolean;
|
|
20
|
+
setValue?: (ret: string) => void;
|
|
21
|
+
sendEscape?: () => void;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
}
|
|
24
|
+
export const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
25
|
+
interface TreeNodeProps {
|
|
26
|
+
id: Key;
|
|
27
|
+
indentLevel?: number;
|
|
28
|
+
canRemove?: boolean;
|
|
29
|
+
canRename?: boolean;
|
|
30
|
+
canAddChildren?: boolean;
|
|
31
|
+
canRemoveChildren?: boolean;
|
|
32
|
+
canRenameChildren?: boolean;
|
|
33
|
+
refresh?: () => void;
|
|
34
|
+
}
|
|
35
|
+
export const TreeNode: {
|
|
36
|
+
({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps): JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
39
|
+
interface TreeOfNodesProps<T> {
|
|
40
|
+
id: string;
|
|
41
|
+
nodeList: TreeNodeData<T>[];
|
|
42
|
+
roots: Key[];
|
|
43
|
+
showCheckBox?: boolean;
|
|
44
|
+
selected?: Key | Key[];
|
|
45
|
+
handleSelect?: (ret: Key | Key[]) => void;
|
|
46
|
+
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
47
|
+
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
48
|
+
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
49
|
+
canRemoveRoot?: boolean;
|
|
50
|
+
canRenameRoot?: boolean;
|
|
51
|
+
canAddChildren?: boolean;
|
|
52
|
+
canRemoveChildren?: boolean;
|
|
53
|
+
canRenameChildren?: boolean;
|
|
54
|
+
nodeHighlight?: string;
|
|
55
|
+
textHighlight?: string;
|
|
56
|
+
}
|
|
57
|
+
export const TreeOfNodes: {
|
|
58
|
+
<T extends unknown>({ id, nodeList, roots, selected, showCheckBox, handleSelect, onAdd, onRename, onRemove, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, nodeHighlight, textHighlight, }: TreeOfNodesProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
55
61
|
|
|
56
62
|
//# sourceMappingURL=tree-of-nodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AAEA;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;IACE,EAAE,EAAE,GAAG,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAA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C1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;IAC5B,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,OAAO,MAAM;;;CA4EZ,CAAC","sources":["src/src/components/interface.ts","src/src/functions/getAncestors.tsx","src/src/components/TreeOfNodesContext.ts","src/src/components/WordEntry.tsx","src/src/functions/getDescendentIds.ts","src/src/components/TreeNode.tsx","src/src/functions/checkExpandedNodes.ts","src/src/components/TreeOfNodes.tsx","src/src/components/index.ts","src/src/functions/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"export * from './components';\nexport * from './functions';\n"],"names":[],"version":3,"file":"tree-of-nodes.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asup/tree-of-nodes",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "REACT Typescript Treeview component",
|
|
5
5
|
"author": "Paul Thomas <@PaulDThomas>",
|
|
6
6
|
"private": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/PaulDThomas/tree-of-nodes#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@asup/context-menu": "^1.0.0",
|
|
24
|
-
"@swc/helpers": "^0.
|
|
24
|
+
"@swc/helpers": "^0.5.1",
|
|
25
25
|
"bootstrap": "^5.2.2",
|
|
26
26
|
"react": "^18.0.0",
|
|
27
27
|
"react-bootstrap": "^2.5.0",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"react-dom": "^18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
+
"@swc/helpers": "^0.5.1",
|
|
32
33
|
"react": "^18.0.0",
|
|
33
34
|
"react-dom": "^18.0.0"
|
|
34
35
|
},
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"@parcel/transformer-typescript-types": "^2.8.0",
|
|
40
41
|
"@parcel/transformer-webmanifest": "^2.7.0",
|
|
41
42
|
"@testing-library/jest-dom": "^5.16.5",
|
|
42
|
-
"@testing-library/react": "^
|
|
43
|
+
"@testing-library/react": "^14.0.0",
|
|
43
44
|
"@testing-library/user-event": "^14.4.3",
|
|
44
45
|
"@types/jest": "^29.2.2",
|
|
45
46
|
"@types/node": "^18.11.9",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"husky": "^8.0.1",
|
|
57
58
|
"jest": "^29.2.2",
|
|
58
59
|
"jest-environment-jsdom": "^29.3.1",
|
|
60
|
+
"jest-watch-typeahead": "^2.2.2",
|
|
59
61
|
"lint-staged": "^13.0.3",
|
|
60
62
|
"parcel": "^2.7.0",
|
|
61
63
|
"postcss": "^8.4.18",
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
"process": "^0.11.10",
|
|
64
66
|
"ts-jest": "^29.0.3",
|
|
65
67
|
"ts-node": "^10.9.1",
|
|
66
|
-
"typescript": "^
|
|
68
|
+
"typescript": "^5.0.4"
|
|
67
69
|
},
|
|
68
70
|
"lint-staged": {
|
|
69
71
|
"**/*": "prettier --write --ignore-unknown"
|