@asup/tree-of-nodes 2.0.5 → 3.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/dist/cjs/main.css +47 -11
- package/dist/cjs/main.css.map +1 -1
- package/dist/cjs/main.js +114 -170
- package/dist/cjs/main.js.map +1 -1
- package/dist/main.css +47 -11
- package/dist/main.css.map +1 -1
- package/dist/main.js +115 -167
- package/dist/main.js.map +1 -1
- package/dist/tree-of-nodes.d.ts +21 -19
- package/dist/tree-of-nodes.d.ts.map +1 -1
- package/package.json +32 -20
package/dist/tree-of-nodes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Key, CSSProperties, RefAttributes, ForwardRefExoticComponent, ReactNode } from "react";
|
|
2
2
|
import { JSX } from "react/jsx-runtime";
|
|
3
|
-
export interface
|
|
3
|
+
export interface INodeUpdate {
|
|
4
4
|
success: boolean;
|
|
5
5
|
ErrorText?: string;
|
|
6
6
|
}
|
|
@@ -15,15 +15,16 @@ export interface TreeNodeData<T> extends TreeNodeBase {
|
|
|
15
15
|
declare const getAncestors: (id: Key | Key[], included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[];
|
|
16
16
|
interface WordEntryProps {
|
|
17
17
|
id: Key;
|
|
18
|
-
|
|
18
|
+
className?: string;
|
|
19
19
|
editing?: boolean;
|
|
20
20
|
saving?: boolean;
|
|
21
|
-
setValue?: (ret: string) => void;
|
|
22
21
|
sendEscape?: () => void;
|
|
23
|
-
|
|
22
|
+
setValue?: (ret: string) => void;
|
|
24
23
|
spellCheck?: "true" | "false";
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
value?: string;
|
|
25
26
|
}
|
|
26
|
-
export const WordEntry:
|
|
27
|
+
export const WordEntry: ForwardRefExoticComponent<WordEntryProps & RefAttributes<HTMLInputElement>>;
|
|
27
28
|
interface TreeNodeProps {
|
|
28
29
|
id: Key;
|
|
29
30
|
indentLevel?: number;
|
|
@@ -39,26 +40,27 @@ export const TreeNode: {
|
|
|
39
40
|
displayName: string;
|
|
40
41
|
};
|
|
41
42
|
interface TreeOfNodesProps<T> {
|
|
42
|
-
|
|
43
|
-
nodeList: TreeNodeData<T>[];
|
|
44
|
-
roots: Key[];
|
|
45
|
-
showCheckBox?: boolean;
|
|
46
|
-
selected?: Key | Key[];
|
|
47
|
-
handleSelect?: (ret: Key | Key[]) => void;
|
|
48
|
-
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
49
|
-
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
50
|
-
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
51
|
-
canRemoveRoot?: boolean;
|
|
52
|
-
canRenameRoot?: boolean;
|
|
43
|
+
alwaysShowSelected?: "always" | "first";
|
|
53
44
|
canAddChildren?: boolean;
|
|
54
45
|
canRemoveChildren?: boolean;
|
|
46
|
+
canRemoveRoot?: boolean;
|
|
55
47
|
canRenameChildren?: boolean;
|
|
48
|
+
canRenameRoot?: boolean;
|
|
49
|
+
handleSelect?: (ret: Key | Key[]) => void;
|
|
50
|
+
id: string;
|
|
56
51
|
nodeHighlight?: string;
|
|
57
|
-
|
|
52
|
+
nodeList: TreeNodeData<T>[];
|
|
53
|
+
onAdd?: (parentId: Key, newName: string) => Promise<INodeUpdate>;
|
|
54
|
+
onRemove?: (childId: Key) => Promise<INodeUpdate>;
|
|
55
|
+
onRename?: (childId: Key, newName: string) => Promise<INodeUpdate>;
|
|
56
|
+
roots: Key[];
|
|
57
|
+
selected?: Key | Key[];
|
|
58
|
+
showCheckBox?: boolean;
|
|
58
59
|
spellCheck?: "true" | "false";
|
|
60
|
+
textHighlight?: string;
|
|
59
61
|
}
|
|
60
62
|
export const TreeOfNodes: {
|
|
61
|
-
<T
|
|
63
|
+
<T>({ alwaysShowSelected, canAddChildren, canRemoveChildren, canRemoveRoot, canRenameChildren, canRenameRoot, handleSelect, id, nodeHighlight, nodeList, onAdd, onRemove, onRename, roots, selected, showCheckBox, spellCheck, textHighlight, }: TreeOfNodesProps<T>): JSX.Element;
|
|
62
64
|
displayName: string;
|
|
63
65
|
};
|
|
64
66
|
|
|
@@ -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,EAAE,GAAG,CAAC;CAChB;AAED,8BAA8B,CAAC,CAAE,SAAQ,YAAY;IACnD,IAAI,EAAE,CAAC,CAAC;CACT;ACZD,QAAO,MAAM,eACX,IAAI,GAAG,GAAG,GAAG,EAAE,EACf,UAAU,YAAY,EAAE,EACxB,gBAAgB,YAAY,EAAE,KAC7B,YAAY,EAoBd,CAAC;AGxBF;IACE,EAAE,EAAE,GAAG,CAAC;IACR,
|
|
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,EAAE,GAAG,CAAC;CAChB;AAED,8BAA8B,CAAC,CAAE,SAAQ,YAAY;IACnD,IAAI,EAAE,CAAC,CAAC;CACT;ACZD,QAAO,MAAM,eACX,IAAI,GAAG,GAAG,GAAG,EAAE,EACf,UAAU,YAAY,EAAE,EACxB,gBAAgB,YAAY,EAAE,KAC7B,YAAY,EAoBd,CAAC;AGxBF;IACE,EAAE,EAAE,GAAG,CAAC;IACR,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,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AAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACnE,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,OAAO,MAAM;KAAe,CAAC,+OAmB1B,iBAAiB,CAAC,CAAC;;CA4DrB,CAAC","sources":["src/src/components/interface.ts","src/src/functions/getAncestors.tsx","src/src/functions/getDescendentIds.ts","src/src/components/TreeOfNodesContext.ts","src/src/components/WordEntry.tsx","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": "3.0.0",
|
|
4
4
|
"description": "REACT Typescript Treeview component",
|
|
5
5
|
"author": "Paul Thomas <@PaulDThomas>",
|
|
6
6
|
"private": false,
|
|
@@ -21,28 +21,29 @@
|
|
|
21
21
|
"homepage": "https://github.com/PaulDThomas/tree-of-nodes#readme",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"prepare": "husky",
|
|
24
|
-
"start": "rmdir /q/s .\\.parcel-cache && parcel demo/index.html --dist-dir demo/dist",
|
|
25
24
|
"test": "jest --collectCoverage=true",
|
|
26
25
|
"test-watch": "jest --watch --collectCoverage=true --maxWorkers=4",
|
|
27
|
-
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"
|
|
28
|
-
"build": "
|
|
26
|
+
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
27
|
+
"build": "npx rimraf .parcel-cache && parcel build src/main.ts",
|
|
28
|
+
"storybook": "storybook dev -p 6006",
|
|
29
|
+
"build-storybook": "storybook build"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@asup/context-menu": "^
|
|
32
|
+
"@asup/context-menu": "^2.0.0",
|
|
32
33
|
"@swc/helpers": "^0.5.1",
|
|
33
34
|
"bootstrap": "^5.2.2",
|
|
34
|
-
"react": "^
|
|
35
|
+
"react": "^19.2.0",
|
|
35
36
|
"react-bootstrap": "^2.5.0",
|
|
36
37
|
"react-bootstrap-icons": "^1.9.1",
|
|
37
|
-
"react-dom": "^
|
|
38
|
+
"react-dom": "^19.2.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@swc/helpers": "^0.5.1",
|
|
41
|
-
"react": "^
|
|
42
|
-
"react-dom": "^
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@eslint/compat": "^
|
|
46
|
+
"@eslint/compat": "^2.0.0",
|
|
46
47
|
"@eslint/eslintrc": "^3.3.1",
|
|
47
48
|
"@eslint/js": "^9.29.0",
|
|
48
49
|
"@parcel/packager-raw-url": "^2.7.0",
|
|
@@ -53,23 +54,23 @@
|
|
|
53
54
|
"@testing-library/jest-dom": "^6.1.4",
|
|
54
55
|
"@testing-library/react": "^16.3.0",
|
|
55
56
|
"@testing-library/user-event": "^14.4.3",
|
|
56
|
-
"@types/jest": "^
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"@types/react": "^
|
|
59
|
-
"@types/react-dom": "^
|
|
57
|
+
"@types/jest": "^30.0.0",
|
|
58
|
+
"@types/node": "^22.19.1",
|
|
59
|
+
"@types/react": "^19.2.7",
|
|
60
|
+
"@types/react-dom": "^19.2.3",
|
|
60
61
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
61
62
|
"@typescript-eslint/parser": "^8.34.0",
|
|
62
63
|
"eslint": "^9.29.0",
|
|
63
64
|
"eslint-config-prettier": "^10.1.5",
|
|
64
|
-
"eslint-plugin-jest": "^
|
|
65
|
+
"eslint-plugin-jest": "^29.2.1",
|
|
65
66
|
"eslint-plugin-prettier": "^5.0.1",
|
|
66
67
|
"eslint-plugin-react": "^7.31.10",
|
|
67
|
-
"eslint-plugin-react-hooks": "^
|
|
68
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
68
69
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
69
70
|
"husky": "^9.1.7",
|
|
70
|
-
"jest": "^
|
|
71
|
-
"jest-environment-jsdom": "^
|
|
72
|
-
"jest-watch-typeahead": "^
|
|
71
|
+
"jest": "^30.2.0",
|
|
72
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
73
|
+
"jest-watch-typeahead": "^3.0.1",
|
|
73
74
|
"lint-staged": "^16.1.0",
|
|
74
75
|
"parcel": "^2.7.0",
|
|
75
76
|
"postcss": "^8.4.18",
|
|
@@ -78,7 +79,18 @@
|
|
|
78
79
|
"process": "^0.11.10",
|
|
79
80
|
"ts-jest": "^29.0.3",
|
|
80
81
|
"ts-node": "^10.9.1",
|
|
81
|
-
"typescript": "^5.0.4"
|
|
82
|
+
"typescript": "^5.0.4",
|
|
83
|
+
"storybook": "^10.1.2",
|
|
84
|
+
"@storybook/react-vite": "^10.1.2",
|
|
85
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
86
|
+
"@storybook/addon-vitest": "^10.1.2",
|
|
87
|
+
"@storybook/addon-a11y": "^10.1.2",
|
|
88
|
+
"@storybook/addon-docs": "^10.1.2",
|
|
89
|
+
"@storybook/addon-onboarding": "^10.1.2",
|
|
90
|
+
"vitest": "^4.0.14",
|
|
91
|
+
"playwright": "^1.57.0",
|
|
92
|
+
"@vitest/browser-playwright": "^4.0.14",
|
|
93
|
+
"@vitest/coverage-v8": "^4.0.14"
|
|
82
94
|
},
|
|
83
95
|
"lint-staged": {
|
|
84
96
|
"**/*": "prettier --write --ignore-unknown"
|