@hestia-earth/ui-components 0.43.8 → 0.43.9
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.
|
@@ -14668,6 +14668,17 @@ const restoreChildren = (node) => {
|
|
|
14668
14668
|
node._children = null;
|
|
14669
14669
|
return node;
|
|
14670
14670
|
};
|
|
14671
|
+
// children currently laid out, falling back to the collapsed ones while a node is closing
|
|
14672
|
+
const childrenOf = (node) => (node?.children || node?._children || []);
|
|
14673
|
+
// Stagger the children so they animate one after the other: in order when they appear, in reverse
|
|
14674
|
+
// when they disappear. A child that is not in the list anymore has no known position: it is not
|
|
14675
|
+
// delayed, which also keeps the delay finite (a `NaN` delay would never run, nor ever be removed).
|
|
14676
|
+
const enterStagger = (parent, child) => Math.max(childrenOf(parent).indexOf(child), 0) * 10;
|
|
14677
|
+
const exitStagger = (parent, child) => {
|
|
14678
|
+
const children = childrenOf(parent);
|
|
14679
|
+
const index = children.indexOf(child);
|
|
14680
|
+
return index < 0 ? 0 : (children.length - index - 1) * 10;
|
|
14681
|
+
};
|
|
14671
14682
|
const wrap = (selection, maxWidth = nodeContentWidth) => {
|
|
14672
14683
|
selection.each(function (d) {
|
|
14673
14684
|
const t = select(this);
|
|
@@ -14955,10 +14966,8 @@ const mergedLinks = (selection, { togglingGroup, switchingSelection }) => select
|
|
|
14955
14966
|
.transition()
|
|
14956
14967
|
.duration(linkDuration)
|
|
14957
14968
|
.delay(d => {
|
|
14958
|
-
const groupClosing = togglingGroup && !d.target.parent
|
|
14959
|
-
return groupClosing
|
|
14960
|
-
? groupDelay
|
|
14961
|
-
: (switchingSelection ? nodeDuration : 0) + d.source.children?.indexOf(d.target) * 10;
|
|
14969
|
+
const groupClosing = togglingGroup && !childrenOf(d.target.parent).find(n => n.data.group)?._groupOpen;
|
|
14970
|
+
return groupClosing ? groupDelay : (switchingSelection ? nodeDuration : 0) + enterStagger(d.source, d.target);
|
|
14962
14971
|
})
|
|
14963
14972
|
.attr('opacity', 1)
|
|
14964
14973
|
.attr('d', d => {
|
|
@@ -15203,7 +15212,8 @@ class HierarchyChartComponent {
|
|
|
15203
15212
|
});
|
|
15204
15213
|
this.svg.transition().duration(300).attr('viewBox', [-margin.left, this.yMin, totalWidth, newHeight].join(' '));
|
|
15205
15214
|
this.node = this.node
|
|
15206
|
-
|
|
15215
|
+
// the root is a dummy node: it is never rendered, and has no parent to animate against
|
|
15216
|
+
.data(nodes.filter(d => d.data.type !== ChartNodeType.root), d => `${d.parent?.parent?.parent?.data.id}-${d.parent?.parent?.data.id}-${d.parent?.data.id}-${d.data.id}`)
|
|
15207
15217
|
.join(enter => enter
|
|
15208
15218
|
.append('g')
|
|
15209
15219
|
.call(enterNodes)
|
|
@@ -15214,10 +15224,7 @@ class HierarchyChartComponent {
|
|
|
15214
15224
|
.style('pointer-events', 'none')
|
|
15215
15225
|
.transition()
|
|
15216
15226
|
.duration(nodeDuration / 2)
|
|
15217
|
-
.delay(d =>
|
|
15218
|
-
const children = d.parent?.children || d.parent?._children;
|
|
15219
|
-
return (children?.length - children?.indexOf(d) - 1) * 10;
|
|
15220
|
-
})
|
|
15227
|
+
.delay(d => exitStagger(d.parent, d))
|
|
15221
15228
|
.ease(easeElasticIn.amplitude(0.5).period(1))
|
|
15222
15229
|
.attr('transform', d => 'translate(' + (togglingGroup ? d.y : d.y - nodeWidth / 2) + ',' + d.x + ')')
|
|
15223
15230
|
.attr('opacity', 0)
|
|
@@ -15229,8 +15236,8 @@ class HierarchyChartComponent {
|
|
|
15229
15236
|
.call(mergedNodes, { tooltipOperator: this.tooltipOperator() })
|
|
15230
15237
|
.transition()
|
|
15231
15238
|
.delay(d => {
|
|
15232
|
-
const groupClosing = togglingGroup && !d.parent
|
|
15233
|
-
return groupClosing ? groupDelay : (switchingSelection ? nodeDuration : 0) + d.parent
|
|
15239
|
+
const groupClosing = togglingGroup && !childrenOf(d.parent).find(n => n.data.group)?._groupOpen;
|
|
15240
|
+
return groupClosing ? groupDelay : (switchingSelection ? nodeDuration : 0) + enterStagger(d.parent, d);
|
|
15234
15241
|
})
|
|
15235
15242
|
.duration(nodeDuration)
|
|
15236
15243
|
.ease(easeElasticOut.amplitude(0.5).period(1))
|
|
@@ -15248,10 +15255,7 @@ class HierarchyChartComponent {
|
|
|
15248
15255
|
.attr('stroke', '#b5b5b5'), update => update, exit => exit
|
|
15249
15256
|
.transition()
|
|
15250
15257
|
.duration(linkDuration / 2)
|
|
15251
|
-
.delay(d =>
|
|
15252
|
-
const children = d.source.parent?.children || d.source.parent?._children;
|
|
15253
|
-
return (children?.length - children?.indexOf(d.target) - 1) * 10;
|
|
15254
|
-
})
|
|
15258
|
+
.delay(d => exitStagger(d.source, d.target))
|
|
15255
15259
|
.attr('opacity', 0)
|
|
15256
15260
|
.remove())
|
|
15257
15261
|
.call(mergedLinks, { togglingGroup, switchingSelection });
|