@asup/tree-of-nodes 1.0.0 → 1.0.1
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/src/__mocks__ → __mocks__}/mockNodes.d.ts +0 -0
- package/dist/{cjs/src/__mocks__ → __mocks__}/styleMock.d.ts +0 -0
- package/dist/{cjs/src/__tests__/TreeNode.test.d.ts → __tests__/ContextMenu.d.ts} +0 -0
- package/dist/{src/__tests__ → __tests__}/TreeNode.test.d.ts +0 -0
- package/dist/{cjs/src/__tests__ → __tests__}/TreeOfNodes.test.d.ts +0 -0
- package/dist/{cjs/src/__tests__ → __tests__}/WordEntry.test.d.ts +0 -0
- package/dist/{src → cjs}/__mocks__/mockNodes.d.ts +0 -0
- package/dist/{src → cjs}/__mocks__/styleMock.d.ts +0 -0
- package/dist/{src/__tests__/TreeOfNodes.test.d.ts → cjs/__tests__/ContextMenu.d.ts} +0 -0
- package/dist/{src/__tests__/WordEntry.test.d.ts → cjs/__tests__/TreeNode.test.d.ts} +0 -0
- package/dist/cjs/__tests__/TreeOfNodes.test.d.ts +1 -0
- package/dist/cjs/__tests__/WordEntry.test.d.ts +1 -0
- package/dist/cjs/{src/components → components}/ContextMenu.d.ts +0 -0
- package/dist/cjs/{src/components → components}/ContextMenuProvider.d.ts +0 -0
- package/dist/cjs/{src/components → components}/TreeNode.d.ts +0 -0
- package/dist/cjs/{src/components → components}/TreeOfNodes.d.ts +0 -0
- package/dist/{src → cjs}/components/TreeOfNodesContext.d.ts +6 -6
- package/dist/cjs/{src/components → components}/WordEntry.d.ts +0 -0
- package/dist/cjs/{src/components → components}/index.d.ts +0 -0
- package/dist/cjs/{src/main.d.ts → main.d.ts} +0 -0
- package/dist/cjs/main.js +13 -13
- package/dist/{src/components → components}/ContextMenu.d.ts +0 -0
- package/dist/{src/components → components}/ContextMenuProvider.d.ts +0 -0
- package/dist/{src/components → components}/TreeNode.d.ts +0 -0
- package/dist/{src/components → components}/TreeOfNodes.d.ts +0 -0
- package/dist/{cjs/src/components → components}/TreeOfNodesContext.d.ts +6 -6
- package/dist/{src/components → components}/WordEntry.d.ts +0 -0
- package/dist/{src/components → components}/index.d.ts +0 -0
- package/dist/{src/main.d.ts → main.d.ts} +0 -0
- package/dist/tree-of-nodes.d.ts +75 -30
- package/package.json +2 -4
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,18 +3,18 @@ export interface iNodeUpdate {
|
|
|
3
3
|
success: boolean;
|
|
4
4
|
ErrorText?: string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface TreeNodeBase {
|
|
7
7
|
id: Key;
|
|
8
8
|
label: string;
|
|
9
9
|
parentId?: Key;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
}
|
|
11
|
+
export interface TreeNodeData<T> {
|
|
12
12
|
id: Key;
|
|
13
13
|
label: string;
|
|
14
14
|
parentId?: Key;
|
|
15
15
|
data: T;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
16
|
+
}
|
|
17
|
+
export interface TreeOfNodesContextData<T> {
|
|
18
18
|
id: string;
|
|
19
19
|
nodeList: TreeNodeData<T>[];
|
|
20
20
|
selectedId?: Key;
|
|
@@ -24,5 +24,5 @@ export type TreeOfNodesContextData<T> = {
|
|
|
24
24
|
onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
25
25
|
onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;
|
|
26
26
|
onRemove?: (id: Key) => Promise<iNodeUpdate>;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
export declare const TreeOfNodesContext: import("react").Context<TreeOfNodesContextData<unknown>>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/main.js
CHANGED
|
@@ -4,20 +4,20 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopNamespaceDefault(e) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
15
17
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,18 +3,18 @@ export interface iNodeUpdate {
|
|
|
3
3
|
success: boolean;
|
|
4
4
|
ErrorText?: string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface TreeNodeBase {
|
|
7
7
|
id: Key;
|
|
8
8
|
label: string;
|
|
9
9
|
parentId?: Key;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
}
|
|
11
|
+
export interface TreeNodeData<T> {
|
|
12
12
|
id: Key;
|
|
13
13
|
label: string;
|
|
14
14
|
parentId?: Key;
|
|
15
15
|
data: T;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
16
|
+
}
|
|
17
|
+
export interface TreeOfNodesContextData<T> {
|
|
18
18
|
id: string;
|
|
19
19
|
nodeList: TreeNodeData<T>[];
|
|
20
20
|
selectedId?: Key;
|
|
@@ -24,5 +24,5 @@ export type TreeOfNodesContextData<T> = {
|
|
|
24
24
|
onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
25
25
|
onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;
|
|
26
26
|
onRemove?: (id: Key) => Promise<iNodeUpdate>;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
export declare const TreeOfNodesContext: import("react").Context<TreeOfNodesContextData<unknown>>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/tree-of-nodes.d.ts
CHANGED
|
@@ -1,32 +1,77 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { Key } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
nodeList: any;
|
|
18
|
-
roots: any;
|
|
19
|
-
canRemoveRoot?: boolean | undefined;
|
|
20
|
-
canRenameRoot?: boolean | undefined;
|
|
21
|
-
canAddChildren?: boolean | undefined;
|
|
22
|
-
canRemoveChildren?: boolean | undefined;
|
|
23
|
-
canRenameChildren?: boolean | undefined;
|
|
24
|
-
selectedId: any;
|
|
25
|
-
handleSelect?: (() => void) | undefined;
|
|
26
|
-
onAdd: any;
|
|
27
|
-
onRename: any;
|
|
28
|
-
onRemove: any;
|
|
29
|
-
}): any;
|
|
30
|
-
declare const WordEntry: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
+
interface contextMenuProps {
|
|
4
|
+
entries: iMenuItem[];
|
|
5
|
+
visible: boolean;
|
|
6
|
+
xPos: number;
|
|
7
|
+
yPos: number;
|
|
8
|
+
}
|
|
9
|
+
interface iMenuItem {
|
|
10
|
+
label?: string;
|
|
11
|
+
action?: () => void;
|
|
12
|
+
}
|
|
13
|
+
interface iContextMenuProvider {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const ContextMenuProvider: ({ children }: iContextMenuProvider) => JSX.Element;
|
|
31
17
|
|
|
32
|
-
|
|
18
|
+
declare const ContextMenu: React.ForwardRefExoticComponent<contextMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
|
|
20
|
+
interface TreeNodeProps {
|
|
21
|
+
id: Key;
|
|
22
|
+
indentLevel?: number;
|
|
23
|
+
canRemove?: boolean;
|
|
24
|
+
canRename?: boolean;
|
|
25
|
+
canAddChildren?: boolean;
|
|
26
|
+
canRemoveChildren?: boolean;
|
|
27
|
+
canRenameChildren?: boolean;
|
|
28
|
+
refresh?: () => void;
|
|
29
|
+
}
|
|
30
|
+
declare const TreeNode: ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps) => JSX.Element;
|
|
31
|
+
|
|
32
|
+
interface iNodeUpdate {
|
|
33
|
+
success: boolean;
|
|
34
|
+
ErrorText?: string;
|
|
35
|
+
}
|
|
36
|
+
interface TreeNodeBase {
|
|
37
|
+
id: Key;
|
|
38
|
+
label: string;
|
|
39
|
+
parentId?: Key;
|
|
40
|
+
}
|
|
41
|
+
interface TreeNodeData<T> {
|
|
42
|
+
id: Key;
|
|
43
|
+
label: string;
|
|
44
|
+
parentId?: Key;
|
|
45
|
+
data: T;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface iTreeOfNodes<T> {
|
|
49
|
+
id: string;
|
|
50
|
+
nodeList: TreeNodeData<T>[];
|
|
51
|
+
roots: Key[];
|
|
52
|
+
selectedId?: Key;
|
|
53
|
+
handleSelect?: (ret: Key) => void;
|
|
54
|
+
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
55
|
+
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
56
|
+
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
57
|
+
canAddRoot?: boolean;
|
|
58
|
+
canRemoveRoot?: boolean;
|
|
59
|
+
canRenameRoot?: boolean;
|
|
60
|
+
canAddChildren?: boolean;
|
|
61
|
+
canRemoveChildren?: boolean;
|
|
62
|
+
canRenameChildren?: boolean;
|
|
63
|
+
}
|
|
64
|
+
declare const TreeOfNodes: <T extends unknown>({ id, nodeList, roots, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, selectedId, handleSelect, onAdd, onRename, onRemove, }: iTreeOfNodes<T>) => JSX.Element;
|
|
65
|
+
|
|
66
|
+
interface WordEntryProps {
|
|
67
|
+
id: Key;
|
|
68
|
+
value?: string;
|
|
69
|
+
editing?: boolean;
|
|
70
|
+
saving?: boolean;
|
|
71
|
+
setValue?: (ret: string) => void;
|
|
72
|
+
sendEscape?: () => void;
|
|
73
|
+
style?: React.CSSProperties;
|
|
74
|
+
}
|
|
75
|
+
declare const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
76
|
+
|
|
77
|
+
export { ContextMenu, ContextMenuProvider, TreeNode, TreeNodeBase, TreeNodeData, TreeOfNodes, WordEntry, iNodeUpdate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asup/tree-of-nodes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "REACT Typescript Treeview component",
|
|
5
5
|
"author": "Paul Thomas <@PaulDThomas>",
|
|
6
6
|
"private": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
52
52
|
"husky": "^8.0.1",
|
|
53
53
|
"jest": "^29.2.2",
|
|
54
|
-
"jest-environment-jsdom": "^29.3.
|
|
54
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
55
55
|
"lint-staged": "^13.0.3",
|
|
56
56
|
"parcel": "^2.7.0",
|
|
57
57
|
"postcss": "^8.4.18",
|
|
@@ -62,10 +62,8 @@
|
|
|
62
62
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
63
63
|
"rollup-plugin-postcss": "^4.0.2",
|
|
64
64
|
"rollup-plugin-terser": "^7.0.2",
|
|
65
|
-
"rollup-plugin-typescript2": "^0.34.1",
|
|
66
65
|
"ts-jest": "^29.0.3",
|
|
67
66
|
"ts-node": "^10.9.1",
|
|
68
|
-
"tslib": "^2.4.1",
|
|
69
67
|
"typescript": "^4.9.3"
|
|
70
68
|
},
|
|
71
69
|
"lint-staged": {
|