balkan-orgchart-js 9.2.49 → 9.3.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/orgchart.d.mts +56 -21
- package/orgchart.d.ts +56 -21
- package/orgchart.js +11 -11
- package/orgchart.mjs +168 -92
- package/package.json +1 -1
package/orgchart.mjs
CHANGED
|
@@ -355,6 +355,8 @@ e.prototype.init = function(t, n) {
|
|
|
355
355
|
var e = "_" + ("0000" + (Math.random() * 36 ** 4 | 0).toString(36)).slice(-4);
|
|
356
356
|
if (this.nodes == null || !this.nodes.hasOwnProperty(e)) return e;
|
|
357
357
|
}
|
|
358
|
+
}, e.prototype.moveNodesToVisibleAreaAfterExpand = function(t, n, r) {
|
|
359
|
+
e._moveNodesToVisibleAreaAfterExpand(this, t, n, r);
|
|
358
360
|
}, e.prototype.moveNodesToVisibleArea = function(t, n) {
|
|
359
361
|
for (var r = this, i = this.roots[0], a = this.getSvg(), o = this.getViewBox(), s = null, c = null, l = null, u = null, d = 0; d < t.length; d++) {
|
|
360
362
|
var f = this.nodes[t[d]];
|
|
@@ -397,7 +399,7 @@ e.prototype.init = function(t, n) {
|
|
|
397
399
|
}) : n && n();
|
|
398
400
|
}
|
|
399
401
|
}, e.prototype._nodeHasHiddenParent = function(t) {
|
|
400
|
-
return !t.parent && !e.isNEU(t.pid)
|
|
402
|
+
return !t.parent && !e.isNEU(t.pid);
|
|
401
403
|
}, e.prototype.destroy = function() {
|
|
402
404
|
this._initCalled = !1, this._resizeObserver.unobserve(this.element), e.events.removeForEventId(this._event_id), this.element.innerHTML = null;
|
|
403
405
|
}, e._defaultConfig = function(t) {
|
|
@@ -602,6 +604,16 @@ e.prototype.init = function(t, n) {
|
|
|
602
604
|
}, function() {
|
|
603
605
|
i.ripple(t.id), n && n();
|
|
604
606
|
});
|
|
607
|
+
}, e.prototype.addNodes = function(t, n, r) {
|
|
608
|
+
if (Array.isArray(n)) {
|
|
609
|
+
var i = this, a = [];
|
|
610
|
+
for (var o of n) this.add(o), a.push(o.id);
|
|
611
|
+
this._ai.setContext(), e.events.publish("updated", [this]), this.filterUI.update();
|
|
612
|
+
var s = { id: t };
|
|
613
|
+
i._draw(!1, e.action.update, s, function() {
|
|
614
|
+
r && r();
|
|
615
|
+
});
|
|
616
|
+
}
|
|
605
617
|
}, e.prototype.add = function(t) {
|
|
606
618
|
if (t.id ?? console.error("Call addNode without id"), this._putInUndoStack(), this.clearRedo(), this.config.movable && !e.isNEU(t.pid)) {
|
|
607
619
|
var n = this._get(t.pid);
|
|
@@ -848,7 +860,7 @@ e.prototype.init = function(t, n) {
|
|
|
848
860
|
n._menuClickHandler.apply(n, [this, e]);
|
|
849
861
|
});
|
|
850
862
|
}
|
|
851
|
-
}, e === void 0 && (e = {}), e.VERSION = "9.
|
|
863
|
+
}, e === void 0 && (e = {}), e.VERSION = "9.3.1", e.orientation = {}, e.orientation.top = 0, e.orientation.bottom = 1, e.orientation.right = 2, e.orientation.left = 3, e.orientation.top_left = 4, e.orientation.bottom_left = 5, e.orientation.right_top = 6, e.orientation.left_top = 7, e.anchor = {
|
|
852
864
|
top_right: "top_right",
|
|
853
865
|
right_top: "right_top",
|
|
854
866
|
bottom_right: "bottom_right",
|
|
@@ -2511,12 +2523,13 @@ e.prototype.init = function(t, n) {
|
|
|
2511
2523
|
}, i.readAsText(r.files[0]);
|
|
2512
2524
|
}, n.click();
|
|
2513
2525
|
}, e.prototype.expand = function(t, n, r) {
|
|
2514
|
-
this._treeListExpandCollapseHandler(t), this._resetMovableNodes()
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2526
|
+
if (this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n), n.length) {
|
|
2527
|
+
var i = {
|
|
2528
|
+
id: t,
|
|
2529
|
+
ids: n
|
|
2530
|
+
};
|
|
2531
|
+
this._draw(!1, e.action.expand, i, r);
|
|
2532
|
+
}
|
|
2520
2533
|
}, e.prototype.collapse = function(t, n, r) {
|
|
2521
2534
|
this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
|
|
2522
2535
|
var i = {
|
|
@@ -2525,7 +2538,7 @@ e.prototype.init = function(t, n) {
|
|
|
2525
2538
|
};
|
|
2526
2539
|
this._draw(!1, e.action.collapse, i, r);
|
|
2527
2540
|
}, e.prototype.expandCollapse = function(t, n, r, i) {
|
|
2528
|
-
this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []);
|
|
2541
|
+
this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n);
|
|
2529
2542
|
var a = {
|
|
2530
2543
|
id: t,
|
|
2531
2544
|
expandIds: n,
|
|
@@ -2540,6 +2553,13 @@ e.prototype.init = function(t, n) {
|
|
|
2540
2553
|
changeRoots: n
|
|
2541
2554
|
};
|
|
2542
2555
|
this._draw(!1, e.action.update, i, r);
|
|
2556
|
+
}, e.prototype._filterOnlyExistingAndCallOnDemandForOthers = function(t, n) {
|
|
2557
|
+
var r = [], i = [];
|
|
2558
|
+
for (var a of n) this.getNode(a) ? i.push(a) : r.push(a);
|
|
2559
|
+
return r.length && e.events.publish("on-demand", [this, {
|
|
2560
|
+
ids: r,
|
|
2561
|
+
id: t
|
|
2562
|
+
}]), i;
|
|
2543
2563
|
}, e.prototype._resetMovableNodes = function() {
|
|
2544
2564
|
if (e.RESET_MOVABLE_ONEXPANDCOLLAPSE && this.config.movable != null) {
|
|
2545
2565
|
for (var t = !1, n = 0; n < this.config.nodes.length; n++) {
|
|
@@ -2563,43 +2583,46 @@ e.prototype.init = function(t, n) {
|
|
|
2563
2583
|
});
|
|
2564
2584
|
}, e.prototype._expCollHandler = function(t) {
|
|
2565
2585
|
this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
|
|
2566
|
-
var n = this.getNode(t)
|
|
2567
|
-
if (
|
|
2568
|
-
var
|
|
2586
|
+
var n = this.getNode(t);
|
|
2587
|
+
if (n.collapsedChildrenIds.length) {
|
|
2588
|
+
var r = e.events.publish("expcollclick", [
|
|
2569
2589
|
this,
|
|
2570
2590
|
!1,
|
|
2571
2591
|
t,
|
|
2572
|
-
|
|
2592
|
+
n.collapsedChildrenIds
|
|
2573
2593
|
]);
|
|
2574
|
-
if (
|
|
2575
|
-
this.expand(t,
|
|
2594
|
+
if (r === !1) return !1;
|
|
2595
|
+
this.expand(t, n.collapsedChildrenIds, !1);
|
|
2576
2596
|
} else {
|
|
2577
|
-
var
|
|
2597
|
+
var r = e.events.publish("expcollclick", [
|
|
2578
2598
|
this,
|
|
2579
2599
|
!0,
|
|
2580
2600
|
t,
|
|
2581
2601
|
n.childrenIds
|
|
2582
2602
|
]);
|
|
2583
|
-
if (
|
|
2603
|
+
if (r === !1) return !1;
|
|
2584
2604
|
this.collapse(t, n.childrenIds, !1);
|
|
2585
2605
|
}
|
|
2586
2606
|
}, e.prototype._upHandler = function(t) {
|
|
2587
2607
|
this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
|
|
2588
2608
|
var n = this._upHandlerCreateArgs(t);
|
|
2589
2609
|
if (e.events.publish("up-click", [this, n]) === !1) return !1;
|
|
2590
|
-
this.changeRoots(n.id, n.roots, !1);
|
|
2591
|
-
}, e.prototype._upHandlerCreateArgs = function(
|
|
2592
|
-
var
|
|
2593
|
-
if (
|
|
2594
|
-
if (Array.isArray(
|
|
2595
|
-
var
|
|
2596
|
-
|
|
2597
|
-
} else
|
|
2598
|
-
|
|
2599
|
-
}
|
|
2610
|
+
n.roots.length != 0 && this.changeRoots(n.id, n.roots, !1);
|
|
2611
|
+
}, e.prototype._upHandlerCreateArgs = function(t) {
|
|
2612
|
+
var n = this.getNode(t), r = Object.assign([], this.config.roots), i = this.getNode(n.pid), a;
|
|
2613
|
+
if (i && (a = i), a) {
|
|
2614
|
+
if (Array.isArray(r)) {
|
|
2615
|
+
var o = r.indexOf(n.id);
|
|
2616
|
+
o != -1 && r.splice(o, 1);
|
|
2617
|
+
} else r = [];
|
|
2618
|
+
r.push(a.id);
|
|
2619
|
+
} else e.events.publish("on-demand", [this, {
|
|
2620
|
+
ids: [n.pid],
|
|
2621
|
+
id: n.id
|
|
2622
|
+
}]);
|
|
2600
2623
|
return {
|
|
2601
|
-
id:
|
|
2602
|
-
roots:
|
|
2624
|
+
id: n.id,
|
|
2625
|
+
roots: r
|
|
2603
2626
|
};
|
|
2604
2627
|
}, String.prototype.replaceAll || (String.prototype.replaceAll = function(e, t) {
|
|
2605
2628
|
return this.replace(new RegExp(e, "g"), t);
|
|
@@ -3080,24 +3103,24 @@ e.prototype.init = function(t, n) {
|
|
|
3080
3103
|
var e = { id: this.generateId() };
|
|
3081
3104
|
this.addNode(e, null, !0) !== !1 && this.center(e.id);
|
|
3082
3105
|
}, e.prototype.toggleExpandCollapse = function(t, n) {
|
|
3083
|
-
var r = this.getNode(t)
|
|
3084
|
-
if (
|
|
3085
|
-
var
|
|
3106
|
+
var r = this.getNode(t);
|
|
3107
|
+
if (r.collapsedChildrenIds.length) {
|
|
3108
|
+
var i = e.events.publish("expcollclick", [
|
|
3086
3109
|
this,
|
|
3087
3110
|
!1,
|
|
3088
3111
|
t,
|
|
3089
|
-
|
|
3112
|
+
r.collapsedChildrenIds
|
|
3090
3113
|
]);
|
|
3091
|
-
if (
|
|
3092
|
-
this.expand(t,
|
|
3114
|
+
if (i === !1) return !1;
|
|
3115
|
+
this.expand(t, r.collapsedChildrenIds, !1);
|
|
3093
3116
|
} else {
|
|
3094
|
-
var
|
|
3117
|
+
var i = e.events.publish("expcollclick", [
|
|
3095
3118
|
this,
|
|
3096
3119
|
!0,
|
|
3097
3120
|
t,
|
|
3098
3121
|
r.childrenIds
|
|
3099
3122
|
]);
|
|
3100
|
-
if (
|
|
3123
|
+
if (i === !1) return !1;
|
|
3101
3124
|
this.collapse(t, r.childrenIds, !1);
|
|
3102
3125
|
}
|
|
3103
3126
|
n && this.ripple(r.id, n.clientX, n.clientY);
|
|
@@ -3408,7 +3431,7 @@ e.prototype.init = function(t, n) {
|
|
|
3408
3431
|
}, e.prototype.moveEnd = function() {
|
|
3409
3432
|
this._moveInterval &&= (clearInterval(this._moveInterval), null);
|
|
3410
3433
|
}, e === void 0 && (e = {}), e.node = function(e, t, n, r) {
|
|
3411
|
-
this.templateName = r, this.id = e, this.pid = t, this.children = [], this.childrenIds = [], this.parent = null, this.stpid = null, this.stParent = null, this.stChildren = [], this.stChildrenIds = [], this.tags = n, this.
|
|
3434
|
+
this.templateName = r, this.id = e, this.pid = t, this.children = [], this.childrenIds = [], this.collapsedChildrenIds = [], this.parent = null, this.stpid = null, this.stParent = null, this.stChildren = [], this.stChildrenIds = [], this.tags = n, this.deepCollapsedChildCount = 0, this.deepChildCount = 0, this.tags ||= [];
|
|
3412
3435
|
}, e.searchUI = function() {
|
|
3413
3436
|
this.lastSearch = [], this._searchAfterEnterPress = !1, this._event_id = e._guid(), this.instance = null;
|
|
3414
3437
|
}, e.searchUI.prototype.init = function(t) {
|
|
@@ -3700,43 +3723,44 @@ e.prototype.init = function(t, n) {
|
|
|
3700
3723
|
} else a == e.action.exporting && r.expandChildren && (t.collapsed = !1);
|
|
3701
3724
|
a == e.action.init && s != null ? t.collapsed = !s.exp.has(t.id) : a == e.action.init ? t.tags.indexOf("left-partner") != -1 || t.tags.indexOf("right-partner") != -1 || t.tags.indexOf("partner") != -1 || t.parentPartner ? t.collapsed = n.collapse && o >= n.collapse.level && i.indexOf(t.id) == -1 : t.collapsed = n.collapse && o >= n.collapse.level - 1 && i.indexOf(t.id) == -1 : a == e.action.centerNode || a == e.action.insert || a == e.action.expand || a == e.action.collapse ? i.has(t.id) && (t.collapsed = !1) : a == e.action.update && r && r.changeRoots && r.changeRoots.has(t.id) && (t.collapsed = !1);
|
|
3702
3725
|
}, e.manager._initNode = function(t, n, r, i, a, o, s) {
|
|
3703
|
-
var c = s.manager.config, l = s.manager.layoutConfigs, u = s.manager.action, d = s.manager.actionParams, f = s.manager.state, p = l[r || "base"];
|
|
3704
|
-
t.parent ?? e.manager._setCollpasedProperty(t,
|
|
3705
|
-
for (var
|
|
3706
|
-
var
|
|
3707
|
-
if (e.manager._setCollpasedProperty(
|
|
3726
|
+
var c = s.manager.config, l = s.manager.layoutConfigs, u = s.manager.action, d = s.manager.actionParams, f = s.manager.state, p = e._hasOnDemandHandler(s), m = l[r || "base"];
|
|
3727
|
+
t.parent ?? e.manager._setCollpasedProperty(t, m, d, a, u, i - 1, f, n);
|
|
3728
|
+
for (var h = 0; h < t.childrenIds.length; h++) {
|
|
3729
|
+
var g = n[t.childrenIds[h]];
|
|
3730
|
+
if (g) if (e.manager._setCollpasedProperty(g, m, d, a, u, i, f, n), g.collapsed) t.collapsedChildrenIds.push(g.id);
|
|
3708
3731
|
else {
|
|
3709
|
-
if (
|
|
3710
|
-
var
|
|
3711
|
-
|
|
3732
|
+
if (g.parent = t, g.ppid != null) {
|
|
3733
|
+
var _ = n[g.ppid];
|
|
3734
|
+
_ && (g.parentPartner = _);
|
|
3712
3735
|
}
|
|
3713
|
-
(
|
|
3736
|
+
(g.tags.indexOf("left-partner") != -1 || g.tags.indexOf("right-partner") != -1 || g.tags.indexOf("partner") != -1 || g.parentPartner) && o.indexOf(t.id) == -1 && o.push(t.id), t.children.push(g);
|
|
3714
3737
|
}
|
|
3738
|
+
else p && t.collapsedChildrenIds.push(t.childrenIds[h]);
|
|
3715
3739
|
}
|
|
3716
|
-
if (u == e.action.minimize && !t.min ? (d.all || d.id == t.id) && (t.min = !0) : u == e.action.maximize && t.min === !0 ? (d.all || d.id == t.id) && (t.min = !1) : u == e.action.exporting && d.min === !1 ? t.min = !1 : u == e.action.init && f != null && (t.min = f.min.has(t.id)), !t.min && (!t.tags || !t.tags.has("filter"))) for (var
|
|
3717
|
-
var
|
|
3718
|
-
|
|
3740
|
+
if (u == e.action.minimize && !t.min ? (d.all || d.id == t.id) && (t.min = !0) : u == e.action.maximize && t.min === !0 ? (d.all || d.id == t.id) && (t.min = !1) : u == e.action.exporting && d.min === !1 ? t.min = !1 : u == e.action.init && f != null && (t.min = f.min.has(t.id)), !t.min && (!t.tags || !t.tags.has("filter"))) for (var h = 0; h < t.stChildrenIds.length; h++) {
|
|
3741
|
+
var g = n[t.stChildrenIds[h]];
|
|
3742
|
+
g.stParent = t, t.stChildren.push(g);
|
|
3719
3743
|
}
|
|
3720
3744
|
i != null && (t.level = i), r && (t.lcn = r);
|
|
3721
|
-
var
|
|
3722
|
-
|
|
3723
|
-
var
|
|
3724
|
-
if (t.w =
|
|
3745
|
+
var v = e._getSubLevels(t.tags, c.tags);
|
|
3746
|
+
v > 0 && (t.subLevels = v), t.tags.indexOf("assistant") != -1 && t.parent != null && (t.isAssistant = !0), m.layout == e.layout.treeList && (t.isTreeListItem = !0), m.template && c.template == t.templateName && (t.templateName = m.template);
|
|
3747
|
+
var y = e.t(t.templateName, t.min);
|
|
3748
|
+
if (t.w = y && y.size ? y.size[0] : 0, t.h = y && y.size ? y.size[1] : 0, t.padding = y && y.padding ? y.padding : [
|
|
3725
3749
|
0,
|
|
3726
3750
|
0,
|
|
3727
3751
|
0,
|
|
3728
3752
|
0
|
|
3729
3753
|
], t.isTreeListItem && t.stParent && t.stParent.treeList == null) {
|
|
3730
|
-
var
|
|
3754
|
+
var b = e.t(t.stParent.templateName, t.stParent.min);
|
|
3731
3755
|
t.stParent.treeList = {
|
|
3732
3756
|
pinnedIds: [],
|
|
3733
3757
|
scrollTop: 0,
|
|
3734
3758
|
scrollTopMax: 0,
|
|
3735
|
-
maxHeight:
|
|
3759
|
+
maxHeight: b.treeListMaxHeight
|
|
3736
3760
|
};
|
|
3737
3761
|
}
|
|
3738
|
-
var
|
|
3739
|
-
e.events.publish("node-initialized", [s,
|
|
3762
|
+
var x = { node: t };
|
|
3763
|
+
e.events.publish("node-initialized", [s, x]);
|
|
3740
3764
|
}, e.manager._iterate = function(t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
3741
3765
|
var p = f.manager.layoutConfigs;
|
|
3742
3766
|
if (e.manager._initNode(n, r, l, i, u, d, f), n.isAssistant && (o[n.pid] || (o[n.pid] = []), o[n.pid].push(n.id)), n.subLevels > 0 && s.push(n.id), e.MIXED_LAYOUT_FOR_NODES_WITH_COLLAPSED_CHILDREN && !n.isAssistant && n.parent) {
|
|
@@ -3765,41 +3789,54 @@ e.prototype.init = function(t, n) {
|
|
|
3765
3789
|
i++;
|
|
3766
3790
|
for (var y = 0; y < n.children.length; y++) n.isTreeListItem && (n.children[y].isTreeListItem = n.isTreeListItem), e.manager._iterate(t, n.children[y], r, i, a, o, s, c, l, u, d, f);
|
|
3767
3791
|
}, e.manager.__createNodes = function(t, n, r, i, a, o, s, c) {
|
|
3768
|
-
for (var l = [], u = e._addDottedLines(r), d = 0;
|
|
3769
|
-
var
|
|
3770
|
-
c.filterUI.addFilterTag(
|
|
3771
|
-
var
|
|
3772
|
-
|
|
3773
|
-
var
|
|
3774
|
-
|
|
3775
|
-
var
|
|
3776
|
-
e.isNEU(
|
|
3792
|
+
for (var l = [], u = e._addDottedLines(r), d = [], f = e._hasOnDemandHandler(c), p = 0; p < u.length; p++) {
|
|
3793
|
+
var m = u[p], h = e.STRING_TAGS ? m.tags ? m.tags.split(",") : [] : Array.isArray(m.tags) ? m.tags.slice(0) : [];
|
|
3794
|
+
c.filterUI.addFilterTag(m) && h.unshift("filter");
|
|
3795
|
+
var g = c.searchUI.addMatchTag(m.id);
|
|
3796
|
+
g === !0 ? h.unshift("match") : g === !1 && h.unshift("no-match");
|
|
3797
|
+
var _ = e._getTemplate(h, r.tags, r.template);
|
|
3798
|
+
m && m.template && (_ = m.template);
|
|
3799
|
+
var v = new e.node(m.id, m.pid, h, _);
|
|
3800
|
+
e.isNEU(m.ppid) || (v.ppid = m.ppid), e.isNEU(m.stpid) || (v.stpid = m.stpid), m.movex != null && (v.movex = m.movex), m.movey != null && (v.movey = m.movey), t[m.id] = v, l.push(m.id), m.cids && d.push(m);
|
|
3801
|
+
}
|
|
3802
|
+
for (var m of d) {
|
|
3803
|
+
var y = t[m.id];
|
|
3804
|
+
for (var b of m.cids) {
|
|
3805
|
+
var x = t[b];
|
|
3806
|
+
x && (!e.isNEU(x.pid) && x.pid != y.id && console.error(`node: ${x.id} has pid: ${x.pid} fifferent from ${y.id}`), x.pid = y.id);
|
|
3807
|
+
}
|
|
3777
3808
|
}
|
|
3778
3809
|
if (r.orderBy != null) {
|
|
3779
|
-
var
|
|
3810
|
+
var S = e.manager._getOrderSortArray(r.orderBy);
|
|
3780
3811
|
l.sort(function(e, t) {
|
|
3781
3812
|
var n, r;
|
|
3782
3813
|
for (var i of u) if (i.id == e && (n = i), i.id == t && (r = i), n && r) break;
|
|
3783
|
-
for (var a = 0; a <
|
|
3784
|
-
var o = n[
|
|
3814
|
+
for (var a = 0; a < S.length; a++) {
|
|
3815
|
+
var o = n[S[a].field], s = r[S[a].field], c = o, l = s;
|
|
3785
3816
|
if (c ??= "", l ??= "", typeof c == "string" && typeof l == "string") {
|
|
3786
3817
|
var d = c.localeCompare(l);
|
|
3787
|
-
if (
|
|
3818
|
+
if (S[a].desc && (d *= -1), d !== 0) return d;
|
|
3788
3819
|
} else {
|
|
3789
3820
|
var d = o < s ? -1 : o > s ? 1 : 0;
|
|
3790
|
-
if (
|
|
3821
|
+
if (S[a].desc && (d *= -1), d !== 0) return d;
|
|
3791
3822
|
}
|
|
3792
3823
|
}
|
|
3793
3824
|
});
|
|
3794
3825
|
}
|
|
3795
|
-
for (var
|
|
3796
|
-
var
|
|
3797
|
-
if (
|
|
3798
|
-
var
|
|
3799
|
-
|
|
3800
|
-
} else
|
|
3801
|
-
i == e.action.init && (
|
|
3826
|
+
for (var p = 0; p < l.length; p++) {
|
|
3827
|
+
var C = l[p], v = t[C], w = o ? o[C] : null, T = t[v.stpid], y = t[v.pid];
|
|
3828
|
+
if (T || (v.stpid = null), !y && !f && (v.pid = null), T) {
|
|
3829
|
+
var E = o ? o[T.id] : null;
|
|
3830
|
+
E && (T.min = E.min), T.stChildrenIds.push(v.id);
|
|
3831
|
+
} else y ? (w && (v.collapsed = w.collapsed, v.min = w.min, v.treeList = w.treeList), y.childrenIds.push(v.id)) : (w && (v.collapsed = w.collapsed, v.min = w.min, v.treeList = w.treeList), n.push(v), s.push(v.id));
|
|
3832
|
+
i == e.action.init && (v.min = e._getMin(v, r));
|
|
3833
|
+
}
|
|
3834
|
+
for (var m of d) {
|
|
3835
|
+
var y = t[m.id];
|
|
3836
|
+
for (var b of m.cids) y.childrenIds.includes(b) || y.childrenIds.push(b);
|
|
3802
3837
|
}
|
|
3838
|
+
}, e._hasOnDemandHandler = function(t) {
|
|
3839
|
+
return e.events.has("on-demand", t._event_id);
|
|
3803
3840
|
}, e.manager._createNodes = function(t) {
|
|
3804
3841
|
var n = t.manager.config, r = t.manager.layoutConfigs, i = t.manager.action, a = t.manager.actionParams, o = t.manager.oldNodes, s = t.manager.state, c = {}, l = [], u = [];
|
|
3805
3842
|
if (e.manager.__createNodes(c, l, n, i, a, o, u, t), n.roots != null) {
|
|
@@ -3818,8 +3855,11 @@ e.prototype.init = function(t, n) {
|
|
|
3818
3855
|
}
|
|
3819
3856
|
if (!h) {
|
|
3820
3857
|
if (!e.isNEU(f.pid)) {
|
|
3821
|
-
var _ = c[f.pid]
|
|
3822
|
-
|
|
3858
|
+
var _ = c[f.pid];
|
|
3859
|
+
if (_) {
|
|
3860
|
+
var v = _.childrenIds.indexOf(f.id);
|
|
3861
|
+
v > -1 && _.childrenIds.splice(v, 1);
|
|
3862
|
+
}
|
|
3823
3863
|
}
|
|
3824
3864
|
l.push(f);
|
|
3825
3865
|
}
|
|
@@ -4422,10 +4462,12 @@ e.prototype.init = function(t, n) {
|
|
|
4422
4462
|
}, e.manager._addExpandedNodeIdsIterate = function(t, n, r) {
|
|
4423
4463
|
for (var i = 0; i < t.childrenIds.length; i++) r.push(t.childrenIds[i]), e.manager._addExpandedNodeIdsIterate(n[t.childrenIds[i]], n, r);
|
|
4424
4464
|
}, e.manager._setChildCountPropsIterate = function(t, n) {
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4465
|
+
if (t) {
|
|
4466
|
+
t.w === void 0 && (t.collapsedChildrenIds = t.childrenIds.slice()), t.deepChildCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildrenIds.length;
|
|
4467
|
+
for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildrenIds.length, r.deepChildCount += t.childrenIds.length, r = n[r.pid];
|
|
4468
|
+
for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
|
|
4469
|
+
for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
|
|
4470
|
+
}
|
|
4429
4471
|
}, e.manager._setMinMaxXYAdjustifyIterate = function(t, n, r, i, a, o, s, c) {
|
|
4430
4472
|
t.x += o.x, t.y += o.y;
|
|
4431
4473
|
for (var l of t.stChildren) e.manager._setMinMaxXYAdjustifyIterate(l, l, r, 0, a, o, s, c);
|
|
@@ -4546,7 +4588,7 @@ e.prototype.init = function(t, n) {
|
|
|
4546
4588
|
plus: function(e, t, n, r, i) {
|
|
4547
4589
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
4548
4590
|
return `<g transform="matrix(1,0,0,1,${i.x - 15},${i.y - 15})"><circle cx="15" cy="15" r="15" fill="${a}" stroke="#aeaeae" stroke-width="1"></circle>
|
|
4549
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
4591
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
4550
4592
|
},
|
|
4551
4593
|
minus: function(e, t, n, r, i) {
|
|
4552
4594
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
@@ -4582,7 +4624,7 @@ e.prototype.init = function(t, n) {
|
|
|
4582
4624
|
plus: function(e, t, n, r, i) {
|
|
4583
4625
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
4584
4626
|
return `<g transform="matrix(1,0,0,1,${i.x - 15},${i.y - 15})"><circle class="boc-hoverable" cx="15" cy="15" r="15" fill="${a}" stroke="#aeaeae" stroke-width="1"></circle>
|
|
4585
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
4627
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
4586
4628
|
},
|
|
4587
4629
|
minus: function(e, t, n, r, i) {
|
|
4588
4630
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
@@ -4621,7 +4663,7 @@ e.prototype.init = function(t, n) {
|
|
|
4621
4663
|
], e.templates.emily.link = "<path class=\"boc-emily-stroke\" stroke-linejoin=\"round\" stroke=\"#aeaeae\" stroke-width=\"1px\" fill=\"none\" d=\"{rounded}\" />", e.templates.emily.plus = function(e, t, n, r, i) {
|
|
4622
4664
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
4623
4665
|
return `<g transform="matrix(1,0,0,1,${i.x - 15},${i.y - 15})"><circle class="boc-emily-stroke" cx="15" cy="15" r="15" fill="${a}" stroke="#aeaeae" stroke-width="1"></circle>
|
|
4624
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
4666
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
4625
4667
|
}, e.templates.emily.minus = function(e, t, n, r, i) {
|
|
4626
4668
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
4627
4669
|
return `<g transform="matrix(1,0,0,1,${i.x - 15},${i.y - 15})"><circle class="boc-emily-stroke" cx="15" cy="15" r="15" fill="${a}" stroke="#aeaeae" stroke-width="1"></circle>
|
|
@@ -4913,7 +4955,7 @@ e.prototype.init = function(t, n) {
|
|
|
4913
4955
|
var i = n.expandCollapseSize / 2 + e.level * n.expandCollapseSize, a = e.h / 2;
|
|
4914
4956
|
a -= n.expandCollapseSize / 2;
|
|
4915
4957
|
var o = r.mode == "dark" ? "#ccc" : "#757575";
|
|
4916
|
-
return `<g transform="matrix(1,0,0,1,${i},${a})"><text x="6" style="font-size: 10px;" fill="${o}" y="15.5" text-anchor="end">${e.
|
|
4958
|
+
return `<g transform="matrix(1,0,0,1,${i},${a})"><text x="6" style="font-size: 10px;" fill="${o}" y="15.5" text-anchor="end">${e.childrenIds.length}</text><path fill="${o}" d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" /><rect style="opacity: 0" x="-3" y="-3" width="30" height="30"></rect></g>`;
|
|
4917
4959
|
}, e.templates.treeListItem.minus = function(e, t, n, r) {
|
|
4918
4960
|
var i = n.expandCollapseSize / 2 + e.level * n.expandCollapseSize, a = e.h / 2;
|
|
4919
4961
|
a -= n.expandCollapseSize / 2;
|
|
@@ -4995,7 +5037,7 @@ e.prototype.init = function(t, n) {
|
|
|
4995
5037
|
var c = "";
|
|
4996
5038
|
if (o !== e.action.exporting && !n.isSplit) {
|
|
4997
5039
|
var l = a[n.lcn ? n.lcn : "base"], u = e.t(n.templateName, n.min, s);
|
|
4998
|
-
if (n.
|
|
5040
|
+
if (n.childrenIds.length) {
|
|
4999
5041
|
if (n.hasPartners) {
|
|
5000
5042
|
for (var d = !1, f = 0; f < n.childrenIds.length; f++) {
|
|
5001
5043
|
var p = t.getNode(n.childrenIds[f]);
|
|
@@ -5007,7 +5049,7 @@ e.prototype.init = function(t, n) {
|
|
|
5007
5049
|
x: m.x + n.x - u.expandCollapseSize / 2,
|
|
5008
5050
|
y: m.y + n.y - u.expandCollapseSize / 2
|
|
5009
5051
|
};
|
|
5010
|
-
n.
|
|
5052
|
+
n.collapsedChildrenIds.length ? (typeof u.plus == "function" ? (c += e.expcollOpenTag.replace("{id}", n.id).replace("{x}", n.x).replace("{y}", n.y), c += u.plus(n, r, u, i, m)) : (c += e.expcollOpenTag.replace("{id}", n.id).replace("{x}", h.x).replace("{y}", h.y), c += u.plus), c += e.grCloseTag) : (typeof u.minus == "function" ? (c += e.expcollOpenTag.replace("{id}", n.id).replace("{x}", n.x).replace("{y}", n.y), c += u.minus(n, r, u, i, m)) : (c += e.expcollOpenTag.replace("{id}", n.id).replace("{x}", h.x).replace("{y}", h.y), c += u.minus), c += e.grCloseTag), (n.collapsedChildrenIds.length && typeof u.plus != "function" || !n.collapsedChildrenIds.length && typeof u.minus != "function") && (c.indexOf("{collapsed-children-count}") != -1 && (c = c.replace("{collapsed-children-count}", n.collapsedChildrenIds.length)), c.indexOf("{collapsed-children-total-count}") != -1 && (c = c.replace("{collapsed-children-total-count}", n.deepCollapsedChildCount)), c.indexOf("{children-count}") != -1 && (c = c.replace("{children-count}", n.childrenIds.length)), c.indexOf("{children-total-count}") != -1 && (c = c.replace("{children-total-count}", n.deepChildCount)));
|
|
5011
5053
|
}
|
|
5012
5054
|
t._nodeHasHiddenParent(n) && (c += e.upOpenTag.replace("{id}", n.id).replace("{x}", n.x).replace("{y}", n.y), c += u.up, c += e.grCloseTag);
|
|
5013
5055
|
}
|
|
@@ -6714,6 +6756,36 @@ e.prototype.init = function(t, n) {
|
|
|
6714
6756
|
}), Object.keys(e.nodeBinding).filter((e) => e.startsWith("img")).forEach((n) => {
|
|
6715
6757
|
t[n] = e.nodeBinding[n];
|
|
6716
6758
|
}), e.nodeBinding = t;
|
|
6759
|
+
}, e._moveNodesToVisibleAreaAfterExpand = function(t, n, r, i) {
|
|
6760
|
+
if (t.config.orientation != e.orientation.top) {
|
|
6761
|
+
console.error("_moveNodesToVisibleAreaAfterExpand works only for OrgChart.orientation.top, not implemented for others!");
|
|
6762
|
+
return;
|
|
6763
|
+
}
|
|
6764
|
+
var a = t.getSvg(), o = t.getViewBox(), s = o[0], c = o[1], l = o[2], u = o[3], d = s, f = c, p = t.getNode(n);
|
|
6765
|
+
if (t.getNode(r[0]).y > p.y) {
|
|
6766
|
+
for (var m of r) {
|
|
6767
|
+
var h = t.getNode(m), g = h.y - u + h.h + t.config.padding;
|
|
6768
|
+
g > f && (f = g);
|
|
6769
|
+
}
|
|
6770
|
+
f > p.y - t.config.padding && (f = p.y - t.config.padding);
|
|
6771
|
+
} else {
|
|
6772
|
+
for (var m of r) {
|
|
6773
|
+
var h = t.getNode(m), g = h.y - t.config.padding;
|
|
6774
|
+
g < f && (f = g);
|
|
6775
|
+
}
|
|
6776
|
+
f < p.y + p.h - u + t.config.padding && (f = p.y + p.h - u + t.config.padding);
|
|
6777
|
+
}
|
|
6778
|
+
if (f != c || d != s) {
|
|
6779
|
+
var _ = [
|
|
6780
|
+
d,
|
|
6781
|
+
f,
|
|
6782
|
+
l,
|
|
6783
|
+
u
|
|
6784
|
+
];
|
|
6785
|
+
e.animate(a, { viewBox: o }, { viewBox: _ }, t.config.anim.duration, t.config.anim.func, function() {
|
|
6786
|
+
t.draw(e.action.update, void 0, i);
|
|
6787
|
+
});
|
|
6788
|
+
}
|
|
6717
6789
|
}, e.xScrollUI = function(t, n, r, i, a) {
|
|
6718
6790
|
this.element = t, this.requestParams = r, this.config = n, this.onSetViewBoxCallback = i, this.onDrawCallback = a, this.position = 0, this.bar = null, this._event_id = e._guid();
|
|
6719
6791
|
}, e.xScrollUI.prototype.addListener = function(t) {
|
|
@@ -8915,7 +8987,7 @@ e.prototype.init = function(t, n) {
|
|
|
8915
8987
|
var r = t.getScale(), i = e.t(n.node.templateName, n.node.min, r), a = "";
|
|
8916
8988
|
n.node.min ? (i.nodeGroupDottedOpenButton || console.error(`[${n.node.templateName}].nodeGroupDottedOpenButton is not defined`), a += `<g style="cursor:pointer;" data-ctrl-n-dotted-open="${n.node.id}" transform="matrix(1,0,0,1,${n.node.x},${n.node.y})">`, a += i.nodeGroupDottedOpenButton) : (i.nodeGroupDottedCloseButton || console.error(`[${n.node.templateName}].nodeGroupDottedCloseButton is not defined`), a += `<g style="cursor:pointer;" transform="matrix(1,0,0,1,${n.node.x},${n.node.y})" data-ctrl-n-dotted-close="${n.node.id}">`, a += i.nodeGroupDottedCloseButton), a += "</g>", a = a.replaceAll("{cw}", n.node.w / 2).replaceAll("{ch}", n.node.h / 2).replaceAll("{ew}", n.node.w - (n.node.padding ? n.node.padding[1] : 0)).replaceAll("{eh}", n.node.h - (n.node.padding ? n.node.padding[2] : 0));
|
|
8917
8989
|
var o = t.getNode(n.node.stChildrenIds[0]);
|
|
8918
|
-
a.indexOf("{collapsed-children-count}") != -1 && (a = a.replace("{collapsed-children-count}", o.
|
|
8990
|
+
a.indexOf("{collapsed-children-count}") != -1 && (a = a.replace("{collapsed-children-count}", o.collapsedChildrenIds.length)), a.indexOf("{collapsed-children-total-count}") != -1 && (a = a.replace("{collapsed-children-total-count}", o.deepCollapsedChildCount)), a.indexOf("{children-count}") != -1 && (a = a.replace("{children-count}", o.childrenIds.length)), a.indexOf("{children-total-count}") != -1 && (a = a.replace("{children-total-count}", o.deepChildCount)), n.html += a;
|
|
8919
8991
|
}
|
|
8920
8992
|
}), e.events.on("redraw", function(t, n) {
|
|
8921
8993
|
var r = null;
|
|
@@ -9757,6 +9829,10 @@ e.prototype.init = function(t, n) {
|
|
|
9757
9829
|
return this.on("node-mouseleave", function(t, n) {
|
|
9758
9830
|
return e.call(t, n);
|
|
9759
9831
|
});
|
|
9832
|
+
}, e.prototype.onDemand = function(e) {
|
|
9833
|
+
return this.on("on-demand", function(t, n) {
|
|
9834
|
+
return e.call(t, n);
|
|
9835
|
+
});
|
|
9760
9836
|
}, e.prototype.onCanvasClick = function(e) {
|
|
9761
9837
|
return this.on("canvas-click", function(t, n) {
|
|
9762
9838
|
return e.call(t, n);
|
package/package.json
CHANGED