apextree 1.5.0 → 1.6.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/README.md +69 -62
- package/apextree.es.min.js +187 -38
- package/apextree.min.js +1 -1
- package/lib/models/Paper.d.ts +2 -0
- package/lib/settings/Options.d.ts +5 -0
- package/lib/utils/GraphUtils.d.ts +1 -1
- package/lib/utils/TooltipUtils.d.ts +31 -0
- package/lib/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@ 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
|
-
|
|
8
7
|
## Installation
|
|
9
8
|
|
|
10
9
|
To add the Apextree to your project and its dependencies, install the package from npm.
|
|
@@ -16,7 +15,7 @@ npm install apextree
|
|
|
16
15
|
## Usage
|
|
17
16
|
|
|
18
17
|
```js
|
|
19
|
-
import ApexTree from 'apextree'
|
|
18
|
+
import ApexTree from 'apextree';
|
|
20
19
|
```
|
|
21
20
|
|
|
22
21
|
To create a basic tree with minimal configuration, write as follows:
|
|
@@ -47,43 +46,48 @@ To create a basic tree with minimal configuration, write as follows:
|
|
|
47
46
|
|
|
48
47
|
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.
|
|
49
48
|
|
|
50
|
-
Options | Default
|
|
51
|
-
---
|
|
52
|
-
width | 400
|
|
53
|
-
height | 400
|
|
54
|
-
direction | top
|
|
55
|
-
contentKey | name
|
|
56
|
-
siblingSpacing | 50
|
|
57
|
-
childrenSpacing | 50
|
|
58
|
-
highlightOnHover | true
|
|
59
|
-
containerClassName | root
|
|
60
|
-
canvasStyle | None
|
|
61
|
-
enableToolbar | false
|
|
62
|
-
nodeWidth | 50
|
|
63
|
-
nodeHeight | 30
|
|
64
|
-
nodeTemplate | defaultNodeTemplate
|
|
65
|
-
nodeBGColor | `#FFFFFF`
|
|
66
|
-
nodeBGColorHover | `#FFFFFF`
|
|
67
|
-
borderWidth | 1
|
|
68
|
-
borderStyle | solid
|
|
69
|
-
borderRadius | 5px
|
|
70
|
-
borderColor | `#BCBCBC`
|
|
71
|
-
borderColorHover | `#5C6BC0`
|
|
72
|
-
edgeWidth | `1`
|
|
73
|
-
edgeColor | `#BCBCBC`
|
|
74
|
-
edgeColorHover | `#
|
|
75
|
-
enableTooltip | false
|
|
76
|
-
groupLeafNodes | false
|
|
77
|
-
groupLeafNodesSpacing | 10
|
|
78
|
-
tooltipId | `apextree-tooltip-container` | The tooltip HTML element id
|
|
79
|
-
tooltipTemplate | defaultNodeTemplate
|
|
80
|
-
tooltipMaxWidth |
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 | `#5C6BC0` | The color for the edges when highlighted |
|
|
74
|
+
| enableTooltip | false | Enable tooltip on hover of nodes |
|
|
75
|
+
| groupLeafNodes | false | For stacking leaf nodes |
|
|
76
|
+
| groupLeafNodesSpacing | 10 | Spacing between stacked leaf nodes |
|
|
77
|
+
| tooltipId | `apextree-tooltip-container` | The tooltip HTML element id |
|
|
78
|
+
| tooltipTemplate | defaultNodeTemplate | The HTML template for tooltip |
|
|
79
|
+
| tooltipMaxWidth | undefined | The max width of the tooltip in pixels |
|
|
80
|
+
| tooltipMinWidth | 100 | The min width of the tooltip in pixels |
|
|
81
|
+
| tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
|
|
82
|
+
| tooltipBGColor | `#FFFFFF` | The background color of tooltip |
|
|
83
|
+
| tooltipFontColor | `#000000` | The font color of tooltip text |
|
|
84
|
+
| tooltipFontSize | `12px` | The font size of tooltip text |
|
|
85
|
+
| tooltipPadding | 8 | The padding of tooltip in pixels (0 if custom tooltipTemplate is used) |
|
|
86
|
+
| tooltipOffset | 10 | The offset distance between tooltip and cursor in pixels |
|
|
87
|
+
| fontSize | 14px | The size of font of nodes |
|
|
88
|
+
| fontFamily | None | The font family of nodes |
|
|
89
|
+
| fontWeight | 400 | The font weight of nodes |
|
|
90
|
+
| fontColor | `#000000` | The font color of nodes |
|
|
87
91
|
|
|
88
92
|
Default node template
|
|
89
93
|
|
|
@@ -92,43 +96,46 @@ const defaultNodeTemplate = (content: string) => {
|
|
|
92
96
|
return `<div style='display: flex;justify-content: center;align-items: center; text-align: center; height: 100%;'>${content}</div>`;
|
|
93
97
|
};
|
|
94
98
|
```
|
|
99
|
+
|
|
95
100
|
### Expected data format
|
|
96
101
|
|
|
97
102
|
```json
|
|
98
103
|
{
|
|
99
|
-
"id": "1",
|
|
104
|
+
"id": "1",
|
|
100
105
|
"name": "A",
|
|
101
106
|
"children": []
|
|
102
107
|
}
|
|
103
108
|
```
|
|
109
|
+
|
|
104
110
|
Passed data object should contain id, name and children.
|
|
105
111
|
|
|
106
|
-
For
|
|
112
|
+
For _id_ key, value of id can be unique otherwise edge highlight won't work as expected.
|
|
107
113
|
|
|
108
|
-
For
|
|
114
|
+
For _name_ key, if using other than _name_ then specify key name in contentKey option
|
|
109
115
|
|
|
110
|
-
For
|
|
116
|
+
For _children_ key, it contains list of child objects
|
|
111
117
|
|
|
112
118
|
**Example**
|
|
119
|
+
|
|
113
120
|
```js
|
|
114
121
|
const data = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
]
|
|
131
|
-
|
|
132
|
-
]
|
|
133
|
-
}
|
|
122
|
+
id: '1',
|
|
123
|
+
name: 'A',
|
|
124
|
+
children: [
|
|
125
|
+
{
|
|
126
|
+
id: '2',
|
|
127
|
+
name: 'B',
|
|
128
|
+
children: [
|
|
129
|
+
{
|
|
130
|
+
id: '3',
|
|
131
|
+
name: 'C',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: '4',
|
|
135
|
+
name: 'D',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
134
141
|
```
|
package/apextree.es.min.js
CHANGED
|
@@ -6613,21 +6613,23 @@ const getTooltipStyles = ({
|
|
|
6613
6613
|
fontFamily,
|
|
6614
6614
|
fontSize,
|
|
6615
6615
|
fontWeight,
|
|
6616
|
-
maxWidth
|
|
6616
|
+
maxWidth,
|
|
6617
6617
|
padding,
|
|
6618
6618
|
placement = "top",
|
|
6619
6619
|
x: x2,
|
|
6620
6620
|
y: y2
|
|
6621
6621
|
}) => {
|
|
6622
6622
|
const styles = ["position: absolute;", "z-index: 1000;", "pointer-events: none;"];
|
|
6623
|
-
styles.push(`width: ${maxWidth}px;`);
|
|
6624
|
-
styles.push(`max-width: ${maxWidth}px;`);
|
|
6625
6623
|
styles.push("box-sizing: border-box;");
|
|
6626
6624
|
styles.push("word-wrap: break-word;");
|
|
6627
6625
|
styles.push("overflow-wrap: break-word;");
|
|
6628
6626
|
styles.push(`left: ${x2}px;`);
|
|
6629
6627
|
styles.push(`top: ${y2}px;`);
|
|
6630
6628
|
styles.push(`data-placement: ${placement};`);
|
|
6629
|
+
if (maxWidth) {
|
|
6630
|
+
styles.push(`width: ${maxWidth}px;`);
|
|
6631
|
+
styles.push(`max-width: ${maxWidth}px;`);
|
|
6632
|
+
}
|
|
6631
6633
|
if (borderColor) {
|
|
6632
6634
|
styles.push(`border: 1px solid ${borderColor};`);
|
|
6633
6635
|
}
|
|
@@ -9992,8 +9994,13 @@ const DefaultOptions = {
|
|
|
9992
9994
|
siblingSpacing: 50,
|
|
9993
9995
|
tooltipBGColor: "#FFFFFF",
|
|
9994
9996
|
tooltipBorderColor: "#BCBCBC",
|
|
9997
|
+
tooltipFontColor: "#000000",
|
|
9998
|
+
tooltipFontSize: "12px",
|
|
9995
9999
|
tooltipId: "apextree-tooltip-container",
|
|
9996
|
-
tooltipMaxWidth:
|
|
10000
|
+
tooltipMaxWidth: void 0,
|
|
10001
|
+
tooltipMinWidth: 100,
|
|
10002
|
+
tooltipPadding: 8,
|
|
10003
|
+
tooltipOffset: 10,
|
|
9997
10004
|
viewPortHeight: 600,
|
|
9998
10005
|
viewPortWidth: 800,
|
|
9999
10006
|
width: "100%"
|
|
@@ -10074,7 +10081,7 @@ const applyButtonHoverEffects = (buttonGroup) => {
|
|
|
10074
10081
|
buttonGroup.attr("style", "cursor: pointer;");
|
|
10075
10082
|
});
|
|
10076
10083
|
};
|
|
10077
|
-
const highlightToPath = (selfNode, nodeMap, isHighlighted, options, chartContext) => {
|
|
10084
|
+
const highlightToPath = (selfNode, nodeMap, isHighlighted, options, chartContext, containerClassName) => {
|
|
10078
10085
|
const nodeOptions = selfNode == null ? void 0 : selfNode.options;
|
|
10079
10086
|
const nodeBorderWidth = (nodeOptions == null ? void 0 : nodeOptions.borderWidth) || options.borderWidth;
|
|
10080
10087
|
let borderColor = (nodeOptions == null ? void 0 : nodeOptions.borderColor) || options.borderColor;
|
|
@@ -10084,7 +10091,7 @@ const highlightToPath = (selfNode, nodeMap, isHighlighted, options, chartContext
|
|
|
10084
10091
|
backgroundColor = (nodeOptions == null ? void 0 : nodeOptions.nodeBGColorHover) || options.nodeBGColorHover;
|
|
10085
10092
|
}
|
|
10086
10093
|
const selfContentElement = chartContext.querySelector(
|
|
10087
|
-
|
|
10094
|
+
`#${containerClassName} [data-self='${selfNode.id}'] foreignObject div`
|
|
10088
10095
|
);
|
|
10089
10096
|
if (selfContentElement && !selfNode.id.endsWith("_leafs")) {
|
|
10090
10097
|
selfContentElement.style.borderWidth = `${nodeBorderWidth}px`;
|
|
@@ -10092,7 +10099,7 @@ const highlightToPath = (selfNode, nodeMap, isHighlighted, options, chartContext
|
|
|
10092
10099
|
selfContentElement.style.backgroundColor = backgroundColor;
|
|
10093
10100
|
}
|
|
10094
10101
|
if (selfNode.parent) {
|
|
10095
|
-
const edge = chartContext.
|
|
10102
|
+
const edge = chartContext.querySelector(`#${containerClassName} #${selfNode.parent}-${selfNode.id}`);
|
|
10096
10103
|
if (isHighlighted) {
|
|
10097
10104
|
setAttributes(edge, {
|
|
10098
10105
|
stroke: options.edgeColorHover,
|
|
@@ -10105,7 +10112,7 @@ const highlightToPath = (selfNode, nodeMap, isHighlighted, options, chartContext
|
|
|
10105
10112
|
});
|
|
10106
10113
|
}
|
|
10107
10114
|
if (selfNode.parent) {
|
|
10108
|
-
highlightToPath(nodeMap[selfNode.parent], nodeMap, isHighlighted, options, chartContext);
|
|
10115
|
+
highlightToPath(nodeMap[selfNode.parent], nodeMap, isHighlighted, options, chartContext, containerClassName);
|
|
10109
10116
|
}
|
|
10110
10117
|
}
|
|
10111
10118
|
};
|
|
@@ -10147,6 +10154,77 @@ function findParentsWithOnlyLeafNodes(tree) {
|
|
|
10147
10154
|
dfs2(tree);
|
|
10148
10155
|
return result;
|
|
10149
10156
|
}
|
|
10157
|
+
function calculateTooltipPosition(mouseX, mouseY, tooltipWidth, tooltipHeight, offset) {
|
|
10158
|
+
const viewportWidth = window.innerWidth;
|
|
10159
|
+
const viewportHeight = window.innerHeight;
|
|
10160
|
+
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
10161
|
+
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
10162
|
+
const padding = 10;
|
|
10163
|
+
let placement = "top";
|
|
10164
|
+
let x2 = mouseX;
|
|
10165
|
+
let y2 = mouseY - tooltipHeight - offset;
|
|
10166
|
+
const viewportY = mouseY - scrollY;
|
|
10167
|
+
if (viewportY - tooltipHeight - offset < padding) {
|
|
10168
|
+
placement = "bottom";
|
|
10169
|
+
y2 = mouseY + offset;
|
|
10170
|
+
if (viewportY + offset + tooltipHeight > viewportHeight - padding) {
|
|
10171
|
+
placement = "top";
|
|
10172
|
+
y2 = scrollY + padding;
|
|
10173
|
+
}
|
|
10174
|
+
}
|
|
10175
|
+
const viewportX = mouseX - scrollX;
|
|
10176
|
+
if (viewportX + tooltipWidth > viewportWidth - padding) {
|
|
10177
|
+
x2 = scrollX + viewportWidth - tooltipWidth - padding;
|
|
10178
|
+
}
|
|
10179
|
+
if (viewportX < padding) {
|
|
10180
|
+
x2 = scrollX + padding;
|
|
10181
|
+
}
|
|
10182
|
+
if (placement === "top" || placement === "bottom") {
|
|
10183
|
+
const centeredX = mouseX - tooltipWidth / 2;
|
|
10184
|
+
const centeredViewportX = centeredX - scrollX;
|
|
10185
|
+
if (centeredViewportX >= padding && centeredViewportX + tooltipWidth <= viewportWidth - padding) {
|
|
10186
|
+
x2 = centeredX;
|
|
10187
|
+
}
|
|
10188
|
+
}
|
|
10189
|
+
return { placement, x: x2, y: y2 };
|
|
10190
|
+
}
|
|
10191
|
+
function showTooltip(chartContext, config, content, mouseX, mouseY, containerElement) {
|
|
10192
|
+
const { bgColor, borderColor, fontColor, fontSize, fontFamily, maxWidth, minWidth, offset, padding, tooltipId } = config;
|
|
10193
|
+
const tempDiv = document.createElement("div");
|
|
10194
|
+
tempDiv.style.position = "absolute";
|
|
10195
|
+
tempDiv.style.visibility = "hidden";
|
|
10196
|
+
tempDiv.style.width = `${maxWidth}px`;
|
|
10197
|
+
tempDiv.style.minWidth = `${minWidth}px`;
|
|
10198
|
+
tempDiv.style.padding = `${padding}px`;
|
|
10199
|
+
tempDiv.style.fontSize = fontSize;
|
|
10200
|
+
tempDiv.style.fontFamily = fontFamily;
|
|
10201
|
+
tempDiv.style.wordWrap = "break-word";
|
|
10202
|
+
tempDiv.style.whiteSpace = "normal";
|
|
10203
|
+
tempDiv.innerHTML = content;
|
|
10204
|
+
document.body.appendChild(tempDiv);
|
|
10205
|
+
const tooltipHeight = tempDiv.offsetHeight;
|
|
10206
|
+
const tooltipWidth = tempDiv.offsetWidth;
|
|
10207
|
+
document.body.removeChild(tempDiv);
|
|
10208
|
+
const position2 = calculateTooltipPosition(mouseX, mouseY, tooltipWidth, tooltipHeight, offset);
|
|
10209
|
+
const styles = getTooltipStyles({
|
|
10210
|
+
bgColor,
|
|
10211
|
+
borderColor,
|
|
10212
|
+
fontColor,
|
|
10213
|
+
fontFamily,
|
|
10214
|
+
fontSize,
|
|
10215
|
+
fontWeight: "400",
|
|
10216
|
+
maxWidth,
|
|
10217
|
+
padding,
|
|
10218
|
+
placement: position2.placement,
|
|
10219
|
+
x: position2.x,
|
|
10220
|
+
y: position2.y
|
|
10221
|
+
});
|
|
10222
|
+
const enhancedStyles = `${styles} min-width: ${minWidth}px; word-wrap: break-word; white-space: normal; overflow-wrap: break-word; line-height: 1.4;`;
|
|
10223
|
+
updateTooltip(chartContext, tooltipId, enhancedStyles, content);
|
|
10224
|
+
}
|
|
10225
|
+
function hideTooltip(chartContext, tooltipId) {
|
|
10226
|
+
updateTooltip(chartContext, tooltipId);
|
|
10227
|
+
}
|
|
10150
10228
|
const methods$1 = {};
|
|
10151
10229
|
const names = [];
|
|
10152
10230
|
function registerMethods(name, m) {
|
|
@@ -15916,6 +15994,7 @@ class Paper {
|
|
|
15916
15994
|
this.chartContext = chartContext;
|
|
15917
15995
|
this.width = width2;
|
|
15918
15996
|
this.height = height2;
|
|
15997
|
+
this.containerElement = element;
|
|
15919
15998
|
element.innerHTML = "";
|
|
15920
15999
|
this.canvas = SVG().addTo(element).size("100%", "100%").viewbox(`0 0 ${width2} ${height2}`).panZoom({ zoomFactor: 0.2, zoomMin: 0.1 }).attr({ style: canvasStyle });
|
|
15921
16000
|
}
|
|
@@ -16002,6 +16081,9 @@ class Paper {
|
|
|
16002
16081
|
this.canvas.zoom(newZoomVal);
|
|
16003
16082
|
}
|
|
16004
16083
|
}
|
|
16084
|
+
getContainerElement() {
|
|
16085
|
+
return this.containerElement;
|
|
16086
|
+
}
|
|
16005
16087
|
}
|
|
16006
16088
|
const graphOptions = {
|
|
16007
16089
|
marginx: 100,
|
|
@@ -16216,7 +16298,7 @@ class Graph2 extends Paper {
|
|
|
16216
16298
|
const node = this.nodeMap[nodeId];
|
|
16217
16299
|
const { options } = this;
|
|
16218
16300
|
const {
|
|
16219
|
-
|
|
16301
|
+
containerClassName,
|
|
16220
16302
|
contentKey,
|
|
16221
16303
|
direction,
|
|
16222
16304
|
enableTooltip,
|
|
@@ -16228,6 +16310,7 @@ class Graph2 extends Paper {
|
|
|
16228
16310
|
const {
|
|
16229
16311
|
borderColor,
|
|
16230
16312
|
borderStyle,
|
|
16313
|
+
borderRadius,
|
|
16231
16314
|
borderWidth,
|
|
16232
16315
|
fontColor,
|
|
16233
16316
|
fontFamily,
|
|
@@ -16240,8 +16323,13 @@ class Graph2 extends Paper {
|
|
|
16240
16323
|
nodeWidth,
|
|
16241
16324
|
tooltipBGColor,
|
|
16242
16325
|
tooltipBorderColor,
|
|
16326
|
+
tooltipFontColor,
|
|
16327
|
+
tooltipFontSize,
|
|
16243
16328
|
tooltipId,
|
|
16244
|
-
tooltipMaxWidth
|
|
16329
|
+
tooltipMaxWidth,
|
|
16330
|
+
tooltipMinWidth,
|
|
16331
|
+
tooltipOffset,
|
|
16332
|
+
tooltipPadding
|
|
16245
16333
|
} = { ...options, ...node.options };
|
|
16246
16334
|
const x2 = DirectionConfig[direction].leafX({
|
|
16247
16335
|
childrenSpacing: groupLeafNodesSpacing,
|
|
@@ -16279,33 +16367,58 @@ class Graph2 extends Paper {
|
|
|
16279
16367
|
const { self: self2 } = this.node.dataset;
|
|
16280
16368
|
const selfNode = graphInstance.nodeMap[self2];
|
|
16281
16369
|
if (selfNode) {
|
|
16282
|
-
highlightToPath(
|
|
16370
|
+
highlightToPath(
|
|
16371
|
+
selfNode,
|
|
16372
|
+
graphInstance.nodeMap,
|
|
16373
|
+
true,
|
|
16374
|
+
options,
|
|
16375
|
+
graphInstance.chartContext,
|
|
16376
|
+
containerClassName
|
|
16377
|
+
);
|
|
16283
16378
|
}
|
|
16284
16379
|
});
|
|
16285
16380
|
group.on("mouseout", function() {
|
|
16286
16381
|
const { self: self2 } = this.node.dataset;
|
|
16287
16382
|
const selfNode = graphInstance.nodeMap[self2];
|
|
16288
16383
|
if (selfNode) {
|
|
16289
|
-
highlightToPath(
|
|
16384
|
+
highlightToPath(
|
|
16385
|
+
selfNode,
|
|
16386
|
+
graphInstance.nodeMap,
|
|
16387
|
+
false,
|
|
16388
|
+
options,
|
|
16389
|
+
graphInstance.chartContext,
|
|
16390
|
+
containerClassName
|
|
16391
|
+
);
|
|
16290
16392
|
}
|
|
16291
16393
|
});
|
|
16292
16394
|
}
|
|
16293
16395
|
if (enableTooltip) {
|
|
16294
16396
|
const tooltipContent = tooltipTemplate ? tooltipTemplate(node[contentKey]) : nodeContent;
|
|
16295
16397
|
group.on("mousemove", (e) => {
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
|
|
16398
|
+
showTooltip(
|
|
16399
|
+
graphInstance.chartContext,
|
|
16400
|
+
{
|
|
16401
|
+
bgColor: tooltipBGColor,
|
|
16402
|
+
borderColor: tooltipBorderColor,
|
|
16403
|
+
fontColor: tooltipFontColor,
|
|
16404
|
+
fontSize: tooltipFontSize,
|
|
16405
|
+
fontFamily,
|
|
16406
|
+
maxWidth: tooltipMaxWidth,
|
|
16407
|
+
minWidth: tooltipMinWidth,
|
|
16408
|
+
offset: tooltipOffset,
|
|
16409
|
+
padding: tooltipTemplate ? 0 : tooltipPadding,
|
|
16410
|
+
tooltipId
|
|
16411
|
+
},
|
|
16412
|
+
tooltipContent,
|
|
16413
|
+
e.pageX,
|
|
16414
|
+
e.pageY,
|
|
16415
|
+
graphInstance.getContainerElement()
|
|
16416
|
+
);
|
|
16305
16417
|
});
|
|
16306
16418
|
group.on("mouseout", (e) => {
|
|
16307
|
-
|
|
16308
|
-
|
|
16419
|
+
var _a;
|
|
16420
|
+
if (((_a = e.relatedTarget) == null ? void 0 : _a.tagName) === "svg") {
|
|
16421
|
+
hideTooltip(graphInstance.chartContext, tooltipId);
|
|
16309
16422
|
}
|
|
16310
16423
|
});
|
|
16311
16424
|
}
|
|
@@ -16322,6 +16435,7 @@ class Graph2 extends Paper {
|
|
|
16322
16435
|
const { options } = this;
|
|
16323
16436
|
const {
|
|
16324
16437
|
borderRadius,
|
|
16438
|
+
containerClassName,
|
|
16325
16439
|
contentKey,
|
|
16326
16440
|
direction,
|
|
16327
16441
|
enableExpandCollapse,
|
|
@@ -16346,7 +16460,12 @@ class Graph2 extends Paper {
|
|
|
16346
16460
|
tooltipBGColor,
|
|
16347
16461
|
tooltipBorderColor,
|
|
16348
16462
|
tooltipId,
|
|
16349
|
-
|
|
16463
|
+
tooltipFontColor,
|
|
16464
|
+
tooltipFontSize,
|
|
16465
|
+
tooltipMaxWidth,
|
|
16466
|
+
tooltipMinWidth,
|
|
16467
|
+
tooltipOffset,
|
|
16468
|
+
tooltipPadding
|
|
16350
16469
|
} = { ...options, ...node.options };
|
|
16351
16470
|
const { height: height2, width: width2, x: x2, y: y2 } = node;
|
|
16352
16471
|
const graphInstance = this;
|
|
@@ -16378,33 +16497,58 @@ class Graph2 extends Paper {
|
|
|
16378
16497
|
const { self: self2 } = this.node.dataset;
|
|
16379
16498
|
const selfNode = graphInstance.nodeMap[self2];
|
|
16380
16499
|
if (selfNode) {
|
|
16381
|
-
highlightToPath(
|
|
16500
|
+
highlightToPath(
|
|
16501
|
+
selfNode,
|
|
16502
|
+
graphInstance.nodeMap,
|
|
16503
|
+
true,
|
|
16504
|
+
options,
|
|
16505
|
+
graphInstance.chartContext,
|
|
16506
|
+
containerClassName
|
|
16507
|
+
);
|
|
16382
16508
|
}
|
|
16383
16509
|
});
|
|
16384
16510
|
group.on("mouseout", function() {
|
|
16385
16511
|
const { self: self2 } = this.node.dataset;
|
|
16386
16512
|
const selfNode = graphInstance.nodeMap[self2];
|
|
16387
16513
|
if (selfNode) {
|
|
16388
|
-
highlightToPath(
|
|
16514
|
+
highlightToPath(
|
|
16515
|
+
selfNode,
|
|
16516
|
+
graphInstance.nodeMap,
|
|
16517
|
+
false,
|
|
16518
|
+
options,
|
|
16519
|
+
graphInstance.chartContext,
|
|
16520
|
+
containerClassName
|
|
16521
|
+
);
|
|
16389
16522
|
}
|
|
16390
16523
|
});
|
|
16391
16524
|
}
|
|
16392
16525
|
if (enableTooltip) {
|
|
16393
16526
|
const tooltipContent = tooltipTemplate ? tooltipTemplate(node[contentKey]) : nodeContent;
|
|
16394
16527
|
group.on("mousemove", (e) => {
|
|
16395
|
-
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16528
|
+
showTooltip(
|
|
16529
|
+
graphInstance.chartContext,
|
|
16530
|
+
{
|
|
16531
|
+
bgColor: tooltipBGColor,
|
|
16532
|
+
borderColor: tooltipBorderColor,
|
|
16533
|
+
fontColor: tooltipFontColor,
|
|
16534
|
+
fontSize: tooltipFontSize,
|
|
16535
|
+
fontFamily,
|
|
16536
|
+
maxWidth: tooltipMaxWidth,
|
|
16537
|
+
minWidth: tooltipMinWidth,
|
|
16538
|
+
offset: tooltipOffset,
|
|
16539
|
+
padding: tooltipTemplate ? 0 : tooltipPadding,
|
|
16540
|
+
tooltipId
|
|
16541
|
+
},
|
|
16542
|
+
tooltipContent,
|
|
16543
|
+
e.pageX,
|
|
16544
|
+
e.pageY,
|
|
16545
|
+
graphInstance.getContainerElement()
|
|
16546
|
+
);
|
|
16404
16547
|
});
|
|
16405
16548
|
group.on("mouseout", (e) => {
|
|
16406
|
-
|
|
16407
|
-
|
|
16549
|
+
var _a2;
|
|
16550
|
+
if (((_a2 = e.relatedTarget) == null ? void 0 : _a2.tagName) === "svg") {
|
|
16551
|
+
hideTooltip(graphInstance.chartContext, tooltipId);
|
|
16408
16552
|
}
|
|
16409
16553
|
});
|
|
16410
16554
|
}
|
|
@@ -16458,7 +16602,12 @@ class ApexTree extends BaseChart {
|
|
|
16458
16602
|
constructor(element, options = {}) {
|
|
16459
16603
|
const instanceId = "tree_" + Math.random().toString(36).substr(2, 9);
|
|
16460
16604
|
super(element, instanceId);
|
|
16461
|
-
|
|
16605
|
+
const uniqueContainerClassName = options.containerClassName ? `${options.containerClassName}-${instanceId}` : `root-${instanceId}`;
|
|
16606
|
+
this.options = {
|
|
16607
|
+
...DefaultOptions,
|
|
16608
|
+
...options,
|
|
16609
|
+
containerClassName: uniqueContainerClassName
|
|
16610
|
+
};
|
|
16462
16611
|
const { height: height2, width: width2 } = this.options;
|
|
16463
16612
|
this.graph = new Graph2(this.element, this.options, this.chartContext);
|
|
16464
16613
|
this.setupElementDimensions(width2, height2);
|