treege 1.5.0 → 1.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/treege/releases)
2
2
 
3
- ## v1.5.0
4
- - **[feat]** : Add date pattern
5
- - **[fix]** : Disable pattern for `radio`, `hidden`, `checkbox`, `switch`, `autocomplete`, and `dynamic select`
3
+ ## v1.5.1
4
+ - **[fix]** : Context props
@@ -1,6 +1,6 @@
1
1
  import { TreeNode } from '@tracktor/types-treege';
2
2
  export interface BackendConfig {
3
- baseUrl: string;
3
+ baseUrl?: string;
4
4
  authToken?: string;
5
5
  endpoints?: {
6
6
  workflow?: string;
@@ -1,5 +1,6 @@
1
- import { TreeNode } from '@tracktor/types-treege';
2
- import { ReactNode } from 'react';
1
+ import { CurrentTree, ModalType, TreeNode, TreePath } from '@tracktor/types-treege';
2
+ import { HierarchyPointNode } from 'd3-hierarchy';
3
+ import { ReactNode, ReducerAction, SetStateAction } from 'react';
3
4
  import { BackendConfig } from '../../../src/features/Treege/Treege';
4
5
  interface TreegeProviderProps {
5
6
  children: ReactNode;
@@ -7,5 +8,82 @@ interface TreegeProviderProps {
7
8
  initialTreeId?: string;
8
9
  backendConfig?: BackendConfig;
9
10
  }
11
+ export interface TreeDefaultValue {
12
+ /**
13
+ * This is the backend configuration
14
+ */
15
+ backendConfig?: BackendConfig;
16
+ /**
17
+ * CurrentHierarchyPointNode is the current node selected
18
+ */
19
+ currentHierarchyPointNode: null | HierarchyPointNode<TreeNode>;
20
+ /**
21
+ * This is the current tree information
22
+ * {
23
+ * "id": "treeId",
24
+ * "name": "Tree name"
25
+ * }
26
+ */
27
+ currentTree: CurrentTree;
28
+ /**
29
+ * This is the tree node object
30
+ */
31
+ tree: null | TreeNode;
32
+ /**
33
+ * This is the tree modal open state
34
+ */
35
+ treeModalOpen: boolean;
36
+ /**
37
+ * This is the tree path
38
+ * [
39
+ * {
40
+ * "label": "Tree name",
41
+ * "path": "uuid"
42
+ * }
43
+ * ]
44
+ */
45
+ treePath: TreePath[] | [];
46
+ /**
47
+ * This is the modal open state
48
+ */
49
+ modalOpen: ModalType;
50
+ /**
51
+ * This is the version of Treege
52
+ */
53
+ version: string;
54
+ /**
55
+ * This is the tree node dispatch function
56
+ * @param state
57
+ */
58
+ dispatchTree(state: ReducerAction<any>): void;
59
+ /**
60
+ * This is the function to set the modal open state
61
+ * @param state
62
+ */
63
+ setCurrentHierarchyPointNode(state: SetStateAction<null | HierarchyPointNode<TreeNode>>): void;
64
+ /**
65
+ * This is the function to set the current tree information
66
+ * Not the node to display tree
67
+ * @param state
68
+ */
69
+ setCurrentTree(state: SetStateAction<CurrentTree>): void;
70
+ /**
71
+ * This is the function to set the modal open state
72
+ * @param state
73
+ */
74
+ setModalOpen(state: SetStateAction<ModalType>): void;
75
+ /**
76
+ * This is the function to set the modal open state
77
+ * @param state
78
+ */
79
+ setTreeModalOpen(state: SetStateAction<boolean>): void;
80
+ /**
81
+ * This is the function to set the tree path
82
+ * @param state
83
+ */
84
+ setTreePath(state: SetStateAction<TreePath[] | []>): void;
85
+ }
86
+ export declare const treeDefaultValue: TreeDefaultValue;
87
+ export declare const TreegeContext: import('react').Context<TreeDefaultValue>;
10
88
  declare const TreegeProvider: ({ children, initialTree, initialTreeId, backendConfig }: TreegeProviderProps) => import("react/jsx-runtime").JSX.Element;
11
89
  export default TreegeProvider;
@@ -1,2 +1,2 @@
1
- declare const useTreegeContext: () => import('../../src/features/Treege/context/TreegeContext').TreeDefaultValue;
1
+ declare const useTreegeContext: () => import('../../src/features/Treege/context/TreegeProvider').TreeDefaultValue;
2
2
  export default useTreegeContext;
package/dist/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as Treege } from './src/features/Treege';
2
- export * from './src/features/Treege';
1
+ export { default as Treege } from './src/features/Treege/Treege';
2
+ export * from './src/features/Treege/Treege';
3
3
  export { default as TreePlusIcon } from './src/components/DataDisplay/Icons/TreePlusIcon';
4
4
  export * from './src/components/DataDisplay/Icons/TreePlusIcon';