apextree 1.1.0 → 1.3.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.
Files changed (55) hide show
  1. package/README.md +60 -62
  2. package/apextree.es.min.js +7127 -0
  3. package/apextree.min.js +1 -0
  4. package/demo/bottom_to_top_view.html +9 -7
  5. package/demo/custom_font_options.html +3 -6
  6. package/demo/dynamic_view_change.html +3 -6
  7. package/demo/expand_collapse_nodes.html +2 -2
  8. package/demo/left_to_right_view.html +2 -2
  9. package/demo/per_node_options.html +3 -6
  10. package/demo/right_to_left_view.html +2 -2
  11. package/demo/top_to_bottom_view.html +2 -2
  12. package/index.d.ts +1 -0
  13. package/lib/ApexTree.d.ts +9 -0
  14. package/lib/models/Export.d.ts +9 -0
  15. package/lib/models/Graph.d.ts +35 -0
  16. package/lib/models/Paper.d.ts +32 -0
  17. package/lib/models/Toolbar.d.ts +15 -0
  18. package/lib/models/index.d.ts +2 -0
  19. package/lib/settings/DirectionConfig.d.ts +47 -0
  20. package/lib/settings/Options.d.ts +49 -0
  21. package/lib/utils/EdgeUtils.d.ts +2 -0
  22. package/lib/utils/GraphUtils.d.ts +10 -0
  23. package/package.json +19 -27
  24. package/.editorconfig +0 -7
  25. package/.eslintignore +0 -2
  26. package/.eslintrc +0 -9
  27. package/.prettierrc +0 -5
  28. package/.vscode/settings.json +0 -5
  29. package/LICENSE +0 -674
  30. package/dist/ApexTree.js +0 -608
  31. package/dist/ApexTree.min.js +0 -2
  32. package/dist/ApexTree.min.js.LICENSE.txt +0 -10
  33. package/globals.d.ts +0 -4
  34. package/src/ApexTree.ts +0 -34
  35. package/src/icons/add-circle.svg +0 -3
  36. package/src/icons/export-icon.svg +0 -2
  37. package/src/icons/fit-screen-icon.svg +0 -9
  38. package/src/icons/minus-circle.svg +0 -3
  39. package/src/icons/zoom-in-icon.svg +0 -8
  40. package/src/icons/zoom-out-icon.svg +0 -8
  41. package/src/models/Export.ts +0 -39
  42. package/src/models/Graph.ts +0 -284
  43. package/src/models/Paper.ts +0 -117
  44. package/src/models/Toolbar.ts +0 -71
  45. package/src/models/index.ts +0 -2
  46. package/src/settings/DirectionConfig.ts +0 -227
  47. package/src/settings/Options.ts +0 -98
  48. package/src/utils/EdgeUtils.ts +0 -30
  49. package/src/utils/GraphUtils.ts +0 -135
  50. package/tsconfig.json +0 -28
  51. package/webpack.common.ts +0 -68
  52. package/webpack.config.ts +0 -7
  53. package/webpack.dev.ts +0 -12
  54. package/webpack.prod.ts +0 -9
  55. /package/{src/utils/index.ts → lib/utils/index.d.ts} +0 -0
package/README.md CHANGED
@@ -4,6 +4,7 @@ The Apextree is a javascript library built on SVG that helps to create organizat
4
4
 
5
5
  <img width="811" alt="Screenshot 2023-12-17 at 10 28 04 PM" src="https://github.com/apexcharts/tree/assets/17950663/e09212ec-6322-4c68-ac12-9afc524d2abd">
6
6
 
7
+
7
8
  ## Installation
8
9
 
9
10
  To add the Apextree to your project and its dependencies, install the package from npm.
@@ -15,7 +16,7 @@ npm install apextree
15
16
  ## Usage
16
17
 
17
18
  ```js
18
- import ApexTree from 'apextree';
19
+ import ApexTree from 'apextree'
19
20
  ```
20
21
 
21
22
  To create a basic tree with minimal configuration, write as follows:
@@ -46,41 +47,41 @@ To create a basic tree with minimal configuration, write as follows:
46
47
 
47
48
  The layout can be configured by either setting the properties in the table below by passing a second arg to Apextree with these properties set. The latter takes precedence.
48
49
 
49
- | Options | Default | Description |
50
- | ------------------ | ---------------------------- | -------------------------------------------------------------------------------------------------- |
51
- | width | 400 | The width of graph container |
52
- | height | 400 | The height of graph container |
53
- | direction | top | The direction of the tree to start rendering. Possible values: `top`, `bottom`, `left` and `right` |
54
- | contentKey | name | The key of content in passed data object |
55
- | siblingSpacing | 50 | The spacing between sibling nodes |
56
- | childrenSpacing | 50 | The spacing between children and parent |
57
- | highlightOnHover | true | Enable/disable highlight on hover |
58
- | containerClassName | root | The class name for the root container |
59
- | canvasStyle | None | The css styles for canvas root container |
60
- | enableToolbar | false | Enable/disable graph toolbar |
61
- | nodeWidth | 50 | The width of graph nodes |
62
- | nodeHeight | 30 | The height of graph nodes |
63
- | nodeTemplate | defaultNodeTemplate | The HTML template for nodes |
64
- | nodeBGColor | `#FFFFFF` | The background color of nodes |
65
- | nodeBGColorHover | `#FFFFFF` | The background color on hover of nodes |
66
- | borderWidth | 1 | The border width of the nodes in pixels |
67
- | borderStyle | solid | The border style of the nodes |
68
- | borderRadius | 5px | The border radius of the nodes in pixels |
69
- | borderColor | `#BCBCBC` | The border color of the nodes |
70
- | borderColorHover | `#5C6BC0` | The border color on hover of the nodes |
71
- | edgeWidth | `1` | The width for the edges |
72
- | edgeColor | `#BCBCBC` | The color for the edges |
73
- | edgeColorHover | `#BCBCBC` | The color for the edges when highlighted |
74
- | enableTooltip | false | Enable tooltip on hover of nodes |
75
- | tooltipId | `apextree-tooltip-container` | The tooltip HTML element id |
76
- | tooltipTemplate | defaultNodeTemplate | The HTML template for tooltip |
77
- | tooltipMaxWidth | 100 | The max width of the tooltip |
78
- | tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
79
- | tooltipBGColor | `#FFFFFF` | The background color of tooltip |
80
- | fontSize | 14px | The size of font of nodes |
81
- | fontFamily | None | The font family of nodes |
82
- | fontWeight | 400 | The font weight of nodes |
83
- | fontColor | `#000000` | The font color of nodes |
50
+ Options | Default | Description
51
+ --- |------------------------------| ---
52
+ width | 400 | The width of graph container
53
+ height | 400 | The height of graph container
54
+ direction | top | The direction of the tree to start rendering. Possible values: `top`, `bottom`, `left` and `right`
55
+ contentKey | name | The key of content in passed data object
56
+ siblingSpacing | 50 | The spacing between sibling nodes
57
+ childrenSpacing | 50 | The spacing between children and parent
58
+ highlightOnHover | true | Enable/disable highlight on hover
59
+ containerClassName | root | The class name for the root container
60
+ canvasStyle | None | The css styles for canvas root container
61
+ enableToolbar | false | Enable/disable graph toolbar
62
+ nodeWidth | 50 | The width of graph nodes
63
+ nodeHeight | 30 | The height of graph nodes
64
+ nodeTemplate | defaultNodeTemplate | The HTML template for nodes
65
+ nodeBGColor | `#FFFFFF` | The background color of nodes
66
+ nodeBGColorHover | `#FFFFFF` | The background color on hover of nodes
67
+ borderWidth | 1 | The border width of the nodes in pixels
68
+ borderStyle | solid | The border style of the nodes
69
+ borderRadius | 5px | The border radius of the nodes in pixels
70
+ borderColor | `#BCBCBC` | The border color of the nodes
71
+ borderColorHover | `#5C6BC0` | The border color on hover of the nodes
72
+ edgeWidth | `1` | The width for the edges
73
+ edgeColor | `#BCBCBC` | The color for the edges
74
+ edgeColorHover | `#BCBCBC` | The color for the edges when highlighted
75
+ enableTooltip | false | Enable tooltip on hover of nodes
76
+ tooltipId | `apextree-tooltip-container` | The tooltip HTML element id
77
+ tooltipTemplate | defaultNodeTemplate | The HTML template for tooltip
78
+ tooltipMaxWidth | 100 | The max width of the tooltip
79
+ tooltipBorderColor | `#BCBCBC` | The border color of tooltip
80
+ tooltipBGColor | `#FFFFFF` | The background color of tooltip
81
+ fontSize | 14px | The size of font of nodes
82
+ fontFamily | None | The font family of nodes
83
+ fontWeight | 400 | The font weight of nodes
84
+ fontColor | `#000000` | The font color of nodes
84
85
 
85
86
  Default node template
86
87
 
@@ -89,46 +90,43 @@ const defaultNodeTemplate = (content: string) => {
89
90
  return `<div style='display: flex;justify-content: center;align-items: center; text-align: center; height: 100%;'>${content}</div>`;
90
91
  };
91
92
  ```
92
-
93
93
  ### Expected data format
94
94
 
95
95
  ```json
96
96
  {
97
- "id": "1",
97
+ "id": "1",
98
98
  "name": "A",
99
99
  "children": []
100
100
  }
101
101
  ```
102
-
103
102
  Passed data object should contain id, name and children.
104
103
 
105
- For _id_ key, value of id can be unique otherwise edge highlight won't work as expected.
104
+ For *id* key, value of id can be unique otherwise edge highlight won't work as expected.
106
105
 
107
- For _name_ key, if using other than _name_ then specify key name in contentKey option
106
+ For *name* key, if using other than *name* then specify key name in contentKey option
108
107
 
109
- For _children_ key, it contains list of child objects
108
+ For *children* key, it contains list of child objects
110
109
 
111
110
  **Example**
112
-
113
111
  ```js
114
112
  const data = {
115
- id: '1',
116
- name: 'A',
117
- children: [
118
- {
119
- id: '2',
120
- name: 'B',
121
- children: [
122
- {
123
- id: '3',
124
- name: 'C',
125
- },
126
- {
127
- id: '4',
128
- name: 'D',
129
- },
130
- ],
131
- },
132
- ],
133
- };
113
+ "id": "1",
114
+ "name": "A",
115
+ "children": [
116
+ {
117
+ "id": "2",
118
+ "name": "B",
119
+ "children": [
120
+ {
121
+ "id": "3",
122
+ "name": "C"
123
+ },
124
+ {
125
+ "id": "4",
126
+ "name": "D"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
134
132
  ```