treege 0.10.4 → 0.11.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/CHANGELOG.md +2 -6
- package/README.md +39 -4
- package/dist/main.js +968 -932
- package/dist/main.umd.cjs +30 -30
- package/dist/src/features/Treege/Treege.d.ts +12 -7
- package/dist/src/features/Treege/context/TreegeContext.d.ts +29 -28
- package/dist/src/features/Treege/context/TreegeProvider.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import type { TreeNode } from '../../features/Treege/type/TreeNode';
|
|
2
|
-
|
|
2
|
+
export interface BackendConfig {
|
|
3
|
+
baseUrl: string;
|
|
3
4
|
authToken?: string;
|
|
4
|
-
|
|
5
|
+
endpoints?: {
|
|
6
|
+
workflow?: string;
|
|
7
|
+
workflows?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
type TreegeProps = {
|
|
5
11
|
initialTree?: never;
|
|
6
12
|
initialTreeId?: never;
|
|
13
|
+
backendConfig?: BackendConfig;
|
|
7
14
|
} | {
|
|
8
|
-
authToken?: string;
|
|
9
|
-
endPoint?: string;
|
|
10
15
|
initialTree?: TreeNode;
|
|
11
16
|
initialTreeId?: never;
|
|
17
|
+
backendConfig?: BackendConfig;
|
|
12
18
|
} | {
|
|
13
|
-
authToken?: string;
|
|
14
|
-
endPoint?: string;
|
|
15
19
|
initialTree?: never;
|
|
16
20
|
initialTreeId?: string;
|
|
21
|
+
backendConfig?: BackendConfig;
|
|
17
22
|
};
|
|
18
|
-
declare const Treege: ({
|
|
23
|
+
declare const Treege: ({ initialTree, initialTreeId, backendConfig }: TreegeProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
24
|
export default Treege;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HierarchyPointNode } from "d3-hierarchy";
|
|
2
2
|
import { ReducerAction, SetStateAction } from "react";
|
|
3
|
+
import { BackendConfig } from '../../../features/Treege/Treege';
|
|
3
4
|
import type { TreeNode } from '../../../features/Treege/type/TreeNode';
|
|
4
5
|
type ModalType = "add" | "edit" | "delete" | "save" | null;
|
|
5
6
|
type TreePath = {
|
|
@@ -13,37 +14,17 @@ type CurrentTree = {
|
|
|
13
14
|
};
|
|
14
15
|
export interface TreeDefaultValue {
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* This is the backend configuration
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
backendConfig?: BackendConfig;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* CurrentHierarchyPointNode is the current node selected
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
currentHierarchyPointNode: null | HierarchyPointNode<TreeNode>;
|
|
23
24
|
/**
|
|
24
25
|
* This is the function to set the current node selected
|
|
25
26
|
* @param state
|
|
26
27
|
*/
|
|
27
|
-
/**
|
|
28
|
-
* This is the tree modal open state
|
|
29
|
-
*/
|
|
30
|
-
treeModalOpen: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* This is the tree path
|
|
33
|
-
*/
|
|
34
|
-
treePath: TreePath[] | [];
|
|
35
|
-
/**
|
|
36
|
-
* This is the tree node object
|
|
37
|
-
*/
|
|
38
|
-
tree: null | TreeNode;
|
|
39
|
-
/**
|
|
40
|
-
* This is endpoint of the API
|
|
41
|
-
*/
|
|
42
|
-
endPoint?: string;
|
|
43
|
-
/**
|
|
44
|
-
* This is the version of Treege
|
|
45
|
-
*/
|
|
46
|
-
version: string;
|
|
47
28
|
/**
|
|
48
29
|
* This is the current tree information
|
|
49
30
|
* This is not the node to display tree
|
|
@@ -54,11 +35,21 @@ export interface TreeDefaultValue {
|
|
|
54
35
|
* @param state
|
|
55
36
|
*/
|
|
56
37
|
dispatchTree(state: ReducerAction<any>): void;
|
|
38
|
+
/**
|
|
39
|
+
* This is the modal open state
|
|
40
|
+
*/
|
|
41
|
+
modalOpen: ModalType;
|
|
57
42
|
/**
|
|
58
43
|
* This is the function to set the modal open state
|
|
59
44
|
* @param state
|
|
60
45
|
*/
|
|
61
46
|
setCurrentHierarchyPointNode(state: SetStateAction<null | HierarchyPointNode<TreeNode>>): void;
|
|
47
|
+
/**
|
|
48
|
+
* This is the function to set the current tree information
|
|
49
|
+
* Not the node to display tree
|
|
50
|
+
* @param state
|
|
51
|
+
*/
|
|
52
|
+
setCurrentTree(state: SetStateAction<CurrentTree>): void;
|
|
62
53
|
/**
|
|
63
54
|
* This is the function to set the modal open state
|
|
64
55
|
* @param state
|
|
@@ -75,11 +66,21 @@ export interface TreeDefaultValue {
|
|
|
75
66
|
*/
|
|
76
67
|
setTreePath(state: SetStateAction<TreePath[] | []>): void;
|
|
77
68
|
/**
|
|
78
|
-
* This is the
|
|
79
|
-
* Not the node to display tree
|
|
80
|
-
* @param state
|
|
69
|
+
* This is the tree node object
|
|
81
70
|
*/
|
|
82
|
-
|
|
71
|
+
tree: null | TreeNode;
|
|
72
|
+
/**
|
|
73
|
+
* This is the tree modal open state
|
|
74
|
+
*/
|
|
75
|
+
treeModalOpen: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* This is the tree path
|
|
78
|
+
*/
|
|
79
|
+
treePath: TreePath[] | [];
|
|
80
|
+
/**
|
|
81
|
+
* This is the version of Treege
|
|
82
|
+
*/
|
|
83
|
+
version: string;
|
|
83
84
|
}
|
|
84
85
|
export declare const treeDefaultValue: TreeDefaultValue;
|
|
85
86
|
export declare const TreegeContext: import("react").Context<TreeDefaultValue>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { BackendConfig } from '../../../features/Treege/Treege';
|
|
2
3
|
import type { TreeNode } from '../../../features/Treege/type/TreeNode';
|
|
3
4
|
interface TreegeProviderProps {
|
|
4
5
|
children: ReactNode;
|
|
5
|
-
endPoint?: string;
|
|
6
6
|
initialTree?: TreeNode;
|
|
7
7
|
initialTreeId?: string;
|
|
8
|
+
backendConfig?: BackendConfig;
|
|
8
9
|
}
|
|
9
|
-
declare const TreegeProvider: ({ children,
|
|
10
|
+
declare const TreegeProvider: ({ children, initialTree, initialTreeId, backendConfig }: TreegeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export default TreegeProvider;
|