balkan-orgchart-js 9.2.49 → 9.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.
package/orgchart.mjs CHANGED
@@ -397,7 +397,7 @@ e.prototype.init = function(t, n) {
397
397
  }) : n && n();
398
398
  }
399
399
  }, e.prototype._nodeHasHiddenParent = function(t) {
400
- return !t.parent && !e.isNEU(t.pid) && this.getNode(t.pid);
400
+ return !t.parent && !e.isNEU(t.pid);
401
401
  }, e.prototype.destroy = function() {
402
402
  this._initCalled = !1, this._resizeObserver.unobserve(this.element), e.events.removeForEventId(this._event_id), this.element.innerHTML = null;
403
403
  }, e._defaultConfig = function(t) {
@@ -602,6 +602,14 @@ e.prototype.init = function(t, n) {
602
602
  }, function() {
603
603
  i.ripple(t.id), n && n();
604
604
  });
605
+ }, e.prototype.addNodes = function(t, n, r) {
606
+ if (Array.isArray(n)) {
607
+ var i = this, a = [];
608
+ for (var o of n) this.add(o), a.push(o.id);
609
+ this._ai.setContext(), e.events.publish("updated", [this]), this.filterUI.update(), i._draw(!1, e.action.insert, { id: t }, function() {
610
+ r && r();
611
+ });
612
+ }
605
613
  }, e.prototype.add = function(t) {
606
614
  if (t.id ?? console.error("Call addNode without id"), this._putInUndoStack(), this.clearRedo(), this.config.movable && !e.isNEU(t.pid)) {
607
615
  var n = this._get(t.pid);
@@ -848,7 +856,7 @@ e.prototype.init = function(t, n) {
848
856
  n._menuClickHandler.apply(n, [this, e]);
849
857
  });
850
858
  }
851
- }, e === void 0 && (e = {}), e.VERSION = "9.2.49", 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 = {
859
+ }, e === void 0 && (e = {}), e.VERSION = "9.3.0", 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
860
  top_right: "top_right",
853
861
  right_top: "right_top",
854
862
  bottom_right: "bottom_right",
@@ -2511,12 +2519,13 @@ e.prototype.init = function(t, n) {
2511
2519
  }, i.readAsText(r.files[0]);
2512
2520
  }, n.click();
2513
2521
  }, e.prototype.expand = function(t, n, r) {
2514
- this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
2515
- var i = {
2516
- id: t,
2517
- ids: n
2518
- };
2519
- this._draw(!1, e.action.expand, i, r);
2522
+ if (this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n), n.length) {
2523
+ var i = {
2524
+ id: t,
2525
+ ids: n
2526
+ };
2527
+ this._draw(!1, e.action.expand, i, r);
2528
+ }
2520
2529
  }, e.prototype.collapse = function(t, n, r) {
2521
2530
  this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
2522
2531
  var i = {
@@ -2525,7 +2534,7 @@ e.prototype.init = function(t, n) {
2525
2534
  };
2526
2535
  this._draw(!1, e.action.collapse, i, r);
2527
2536
  }, e.prototype.expandCollapse = function(t, n, r, i) {
2528
- this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []);
2537
+ this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n);
2529
2538
  var a = {
2530
2539
  id: t,
2531
2540
  expandIds: n,
@@ -2540,6 +2549,13 @@ e.prototype.init = function(t, n) {
2540
2549
  changeRoots: n
2541
2550
  };
2542
2551
  this._draw(!1, e.action.update, i, r);
2552
+ }, e.prototype._filterOnlyExistingAndCallOnDemandForOthers = function(t, n) {
2553
+ var r = [], i = [];
2554
+ for (var a of n) this.getNode(a) ? i.push(a) : r.push(a);
2555
+ return r.length && e.events.publish("on-demand", [this, {
2556
+ ids: r,
2557
+ id: t
2558
+ }]), i;
2543
2559
  }, e.prototype._resetMovableNodes = function() {
2544
2560
  if (e.RESET_MOVABLE_ONEXPANDCOLLAPSE && this.config.movable != null) {
2545
2561
  for (var t = !1, n = 0; n < this.config.nodes.length; n++) {
@@ -2563,43 +2579,46 @@ e.prototype.init = function(t, n) {
2563
2579
  });
2564
2580
  }, e.prototype._expCollHandler = function(t) {
2565
2581
  this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
2566
- var n = this.getNode(t), r = this.getCollapsedIds(n);
2567
- if (r.length) {
2568
- var i = e.events.publish("expcollclick", [
2582
+ var n = this.getNode(t);
2583
+ if (n.collapsedChildrenIds.length) {
2584
+ var r = e.events.publish("expcollclick", [
2569
2585
  this,
2570
2586
  !1,
2571
2587
  t,
2572
- r
2588
+ n.collapsedChildrenIds
2573
2589
  ]);
2574
- if (i === !1) return !1;
2575
- this.expand(t, r, !1);
2590
+ if (r === !1) return !1;
2591
+ this.expand(t, n.collapsedChildrenIds, !1);
2576
2592
  } else {
2577
- var i = e.events.publish("expcollclick", [
2593
+ var r = e.events.publish("expcollclick", [
2578
2594
  this,
2579
2595
  !0,
2580
2596
  t,
2581
2597
  n.childrenIds
2582
2598
  ]);
2583
- if (i === !1) return !1;
2599
+ if (r === !1) return !1;
2584
2600
  this.collapse(t, n.childrenIds, !1);
2585
2601
  }
2586
2602
  }, e.prototype._upHandler = function(t) {
2587
2603
  this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
2588
2604
  var n = this._upHandlerCreateArgs(t);
2589
2605
  if (e.events.publish("up-click", [this, n]) === !1) return !1;
2590
- this.changeRoots(n.id, n.roots, !1);
2591
- }, e.prototype._upHandlerCreateArgs = function(e) {
2592
- var t = this.getNode(e), n = Object.assign([], this.config.roots), r = this.getNode(t.pid), i;
2593
- if (r && (i = r), i) {
2594
- if (Array.isArray(n)) {
2595
- var a = n.indexOf(t.id);
2596
- a != -1 && n.splice(a, 1);
2597
- } else n = [];
2598
- n.push(i.id);
2599
- }
2606
+ n.roots.length != 0 && this.changeRoots(n.id, n.roots, !1);
2607
+ }, e.prototype._upHandlerCreateArgs = function(t) {
2608
+ var n = this.getNode(t), r = Object.assign([], this.config.roots), i = this.getNode(n.pid), a;
2609
+ if (i && (a = i), a) {
2610
+ if (Array.isArray(r)) {
2611
+ var o = r.indexOf(n.id);
2612
+ o != -1 && r.splice(o, 1);
2613
+ } else r = [];
2614
+ r.push(a.id);
2615
+ } else e.events.publish("on-demand", [this, {
2616
+ ids: [n.pid],
2617
+ id: n.id
2618
+ }]);
2600
2619
  return {
2601
- id: t.id,
2602
- roots: n
2620
+ id: n.id,
2621
+ roots: r
2603
2622
  };
2604
2623
  }, String.prototype.replaceAll || (String.prototype.replaceAll = function(e, t) {
2605
2624
  return this.replace(new RegExp(e, "g"), t);
@@ -3080,24 +3099,24 @@ e.prototype.init = function(t, n) {
3080
3099
  var e = { id: this.generateId() };
3081
3100
  this.addNode(e, null, !0) !== !1 && this.center(e.id);
3082
3101
  }, e.prototype.toggleExpandCollapse = function(t, n) {
3083
- var r = this.getNode(t), i = this.getCollapsedIds(r);
3084
- if (i.length) {
3085
- var a = e.events.publish("expcollclick", [
3102
+ var r = this.getNode(t);
3103
+ if (r.collapsedChildrenIds.length) {
3104
+ var i = e.events.publish("expcollclick", [
3086
3105
  this,
3087
3106
  !1,
3088
3107
  t,
3089
- i
3108
+ r.collapsedChildrenIds
3090
3109
  ]);
3091
- if (a === !1) return !1;
3092
- this.expand(t, i, !1);
3110
+ if (i === !1) return !1;
3111
+ this.expand(t, r.collapsedChildrenIds, !1);
3093
3112
  } else {
3094
- var a = e.events.publish("expcollclick", [
3113
+ var i = e.events.publish("expcollclick", [
3095
3114
  this,
3096
3115
  !0,
3097
3116
  t,
3098
3117
  r.childrenIds
3099
3118
  ]);
3100
- if (a === !1) return !1;
3119
+ if (i === !1) return !1;
3101
3120
  this.collapse(t, r.childrenIds, !1);
3102
3121
  }
3103
3122
  n && this.ripple(r.id, n.clientX, n.clientY);
@@ -3408,7 +3427,7 @@ e.prototype.init = function(t, n) {
3408
3427
  }, e.prototype.moveEnd = function() {
3409
3428
  this._moveInterval &&= (clearInterval(this._moveInterval), null);
3410
3429
  }, 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.childCount = 0, this.collapsedChildCount = 0, this.deepCollapsedChildCount = 0, this.deepChildCount = 0, this.tags ||= [];
3430
+ 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
3431
  }, e.searchUI = function() {
3413
3432
  this.lastSearch = [], this._searchAfterEnterPress = !1, this._event_id = e._guid(), this.instance = null;
3414
3433
  }, e.searchUI.prototype.init = function(t) {
@@ -3700,43 +3719,44 @@ e.prototype.init = function(t, n) {
3700
3719
  } else a == e.action.exporting && r.expandChildren && (t.collapsed = !1);
3701
3720
  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
3721
  }, 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, p, d, a, u, i - 1, f, n);
3705
- for (var m = 0; m < t.childrenIds.length; m++) {
3706
- var h = n[t.childrenIds[m]];
3707
- if (e.manager._setCollpasedProperty(h, p, d, a, u, i, f, n), h.collapsed) t.collapsedChildCount++;
3722
+ 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"];
3723
+ t.parent ?? e.manager._setCollpasedProperty(t, m, d, a, u, i - 1, f, n);
3724
+ for (var h = 0; h < t.childrenIds.length; h++) {
3725
+ var g = n[t.childrenIds[h]];
3726
+ if (g) if (e.manager._setCollpasedProperty(g, m, d, a, u, i, f, n), g.collapsed) t.collapsedChildrenIds.push(g.id);
3708
3727
  else {
3709
- if (h.parent = t, h.ppid != null) {
3710
- var g = n[h.ppid];
3711
- g && (h.parentPartner = g);
3728
+ if (g.parent = t, g.ppid != null) {
3729
+ var _ = n[g.ppid];
3730
+ _ && (g.parentPartner = _);
3712
3731
  }
3713
- (h.tags.indexOf("left-partner") != -1 || h.tags.indexOf("right-partner") != -1 || h.tags.indexOf("partner") != -1 || h.parentPartner) && o.indexOf(t.id) == -1 && o.push(t.id), t.children.push(h);
3732
+ (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
3733
  }
3734
+ else p && t.collapsedChildrenIds.push(t.childrenIds[h]);
3715
3735
  }
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 m = 0; m < t.stChildrenIds.length; m++) {
3717
- var h = n[t.stChildrenIds[m]];
3718
- h.stParent = t, t.stChildren.push(h);
3736
+ 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++) {
3737
+ var g = n[t.stChildrenIds[h]];
3738
+ g.stParent = t, t.stChildren.push(g);
3719
3739
  }
3720
3740
  i != null && (t.level = i), r && (t.lcn = r);
3721
- var _ = e._getSubLevels(t.tags, c.tags);
3722
- _ > 0 && (t.subLevels = _), t.tags.indexOf("assistant") != -1 && t.parent != null && (t.isAssistant = !0), p.layout == e.layout.treeList && (t.isTreeListItem = !0), p.template && c.template == t.templateName && (t.templateName = p.template);
3723
- var v = e.t(t.templateName, t.min);
3724
- if (t.w = v && v.size ? v.size[0] : 0, t.h = v && v.size ? v.size[1] : 0, t.padding = v && v.padding ? v.padding : [
3741
+ var v = e._getSubLevels(t.tags, c.tags);
3742
+ 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);
3743
+ var y = e.t(t.templateName, t.min);
3744
+ 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
3745
  0,
3726
3746
  0,
3727
3747
  0,
3728
3748
  0
3729
3749
  ], t.isTreeListItem && t.stParent && t.stParent.treeList == null) {
3730
- var y = e.t(t.stParent.templateName, t.stParent.min);
3750
+ var b = e.t(t.stParent.templateName, t.stParent.min);
3731
3751
  t.stParent.treeList = {
3732
3752
  pinnedIds: [],
3733
3753
  scrollTop: 0,
3734
3754
  scrollTopMax: 0,
3735
- maxHeight: y.treeListMaxHeight
3755
+ maxHeight: b.treeListMaxHeight
3736
3756
  };
3737
3757
  }
3738
- var b = { node: t };
3739
- e.events.publish("node-initialized", [s, b]);
3758
+ var x = { node: t };
3759
+ e.events.publish("node-initialized", [s, x]);
3740
3760
  }, e.manager._iterate = function(t, n, r, i, a, o, s, c, l, u, d, f) {
3741
3761
  var p = f.manager.layoutConfigs;
3742
3762
  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 +3785,54 @@ e.prototype.init = function(t, n) {
3765
3785
  i++;
3766
3786
  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
3787
  }, e.manager.__createNodes = function(t, n, r, i, a, o, s, c) {
3768
- for (var l = [], u = e._addDottedLines(r), d = 0; d < u.length; d++) {
3769
- var f = u[d], p = e.STRING_TAGS ? f.tags ? f.tags.split(",") : [] : Array.isArray(f.tags) ? f.tags.slice(0) : [];
3770
- c.filterUI.addFilterTag(f) && p.unshift("filter");
3771
- var m = c.searchUI.addMatchTag(f.id);
3772
- m === !0 ? p.unshift("match") : m === !1 && p.unshift("no-match");
3773
- var h = e._getTemplate(p, r.tags, r.template);
3774
- f && f.template && (h = f.template);
3775
- var g = new e.node(f.id, f.pid, p, h);
3776
- e.isNEU(f.ppid) || (g.ppid = f.ppid), e.isNEU(f.stpid) || (g.stpid = f.stpid), f.movex != null && (g.movex = f.movex), f.movey != null && (g.movey = f.movey), t[f.id] = g, l.push(f.id);
3788
+ for (var l = [], u = e._addDottedLines(r), d = [], f = e._hasOnDemandHandler(c), p = 0; p < u.length; p++) {
3789
+ var m = u[p], h = e.STRING_TAGS ? m.tags ? m.tags.split(",") : [] : Array.isArray(m.tags) ? m.tags.slice(0) : [];
3790
+ c.filterUI.addFilterTag(m) && h.unshift("filter");
3791
+ var g = c.searchUI.addMatchTag(m.id);
3792
+ g === !0 ? h.unshift("match") : g === !1 && h.unshift("no-match");
3793
+ var _ = e._getTemplate(h, r.tags, r.template);
3794
+ m && m.template && (_ = m.template);
3795
+ var v = new e.node(m.id, m.pid, h, _);
3796
+ 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);
3797
+ }
3798
+ for (var m of d) {
3799
+ var y = t[m.id];
3800
+ for (var b of m.cids) {
3801
+ var x = t[b];
3802
+ 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);
3803
+ }
3777
3804
  }
3778
3805
  if (r.orderBy != null) {
3779
- var _ = e.manager._getOrderSortArray(r.orderBy);
3806
+ var S = e.manager._getOrderSortArray(r.orderBy);
3780
3807
  l.sort(function(e, t) {
3781
3808
  var n, r;
3782
3809
  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 < _.length; a++) {
3784
- var o = n[_[a].field], s = r[_[a].field], c = o, l = s;
3810
+ for (var a = 0; a < S.length; a++) {
3811
+ var o = n[S[a].field], s = r[S[a].field], c = o, l = s;
3785
3812
  if (c ??= "", l ??= "", typeof c == "string" && typeof l == "string") {
3786
3813
  var d = c.localeCompare(l);
3787
- if (_[a].desc && (d *= -1), d !== 0) return d;
3814
+ if (S[a].desc && (d *= -1), d !== 0) return d;
3788
3815
  } else {
3789
3816
  var d = o < s ? -1 : o > s ? 1 : 0;
3790
- if (_[a].desc && (d *= -1), d !== 0) return d;
3817
+ if (S[a].desc && (d *= -1), d !== 0) return d;
3791
3818
  }
3792
3819
  }
3793
3820
  });
3794
3821
  }
3795
- for (var d = 0; d < l.length; d++) {
3796
- var v = l[d], g = t[v], y = o ? o[v] : null, b = t[g.stpid], x = t[g.pid];
3797
- if (b || (g.stpid = null), x || (g.pid = null), b) {
3798
- var S = o ? o[b.id] : null;
3799
- S && (b.min = S.min), b.stChildrenIds.push(g.id);
3800
- } else x ? (y && (g.collapsed = y.collapsed, g.min = y.min, g.treeList = y.treeList), x.childrenIds.push(g.id)) : (y && (g.collapsed = y.collapsed, g.min = y.min, g.treeList = y.treeList), n.push(g), s.push(g.id));
3801
- i == e.action.init && (g.min = e._getMin(g, r));
3822
+ for (var p = 0; p < l.length; p++) {
3823
+ var C = l[p], v = t[C], w = o ? o[C] : null, T = t[v.stpid], y = t[v.pid];
3824
+ if (T || (v.stpid = null), !y && !f && (v.pid = null), T) {
3825
+ var E = o ? o[T.id] : null;
3826
+ E && (T.min = E.min), T.stChildrenIds.push(v.id);
3827
+ } 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));
3828
+ i == e.action.init && (v.min = e._getMin(v, r));
3802
3829
  }
3830
+ for (var m of d) {
3831
+ var y = t[m.id];
3832
+ for (var b of m.cids) y.childrenIds.includes(b) || y.childrenIds.push(b);
3833
+ }
3834
+ }, e._hasOnDemandHandler = function(t) {
3835
+ return e.events.has("on-demand", t._event_id);
3803
3836
  }, e.manager._createNodes = function(t) {
3804
3837
  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
3838
  if (e.manager.__createNodes(c, l, n, i, a, o, u, t), n.roots != null) {
@@ -3818,8 +3851,11 @@ e.prototype.init = function(t, n) {
3818
3851
  }
3819
3852
  if (!h) {
3820
3853
  if (!e.isNEU(f.pid)) {
3821
- var _ = c[f.pid], v = _.childrenIds.indexOf(f.id);
3822
- v > -1 && _.childrenIds.splice(v, 1);
3854
+ var _ = c[f.pid];
3855
+ if (_) {
3856
+ var v = _.childrenIds.indexOf(f.id);
3857
+ v > -1 && _.childrenIds.splice(v, 1);
3858
+ }
3823
3859
  }
3824
3860
  l.push(f);
3825
3861
  }
@@ -4422,10 +4458,12 @@ e.prototype.init = function(t, n) {
4422
4458
  }, e.manager._addExpandedNodeIdsIterate = function(t, n, r) {
4423
4459
  for (var i = 0; i < t.childrenIds.length; i++) r.push(t.childrenIds[i]), e.manager._addExpandedNodeIdsIterate(n[t.childrenIds[i]], n, r);
4424
4460
  }, e.manager._setChildCountPropsIterate = function(t, n) {
4425
- t.w === void 0 && (t.collapsedChildCount = t.childrenIds.length), t.deepChildCount = t.childCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildCount;
4426
- for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildCount, r.deepChildCount += t.childCount, r = n[r.pid];
4427
- for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
4428
- for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
4461
+ if (t) {
4462
+ t.w === void 0 && (t.collapsedChildrenIds = t.childrenIds.slice()), t.deepChildCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildrenIds.length;
4463
+ for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildrenIds.length, r.deepChildCount += t.childrenIds.length, r = n[r.pid];
4464
+ for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
4465
+ for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
4466
+ }
4429
4467
  }, e.manager._setMinMaxXYAdjustifyIterate = function(t, n, r, i, a, o, s, c) {
4430
4468
  t.x += o.x, t.y += o.y;
4431
4469
  for (var l of t.stChildren) e.manager._setMinMaxXYAdjustifyIterate(l, l, r, 0, a, o, s, c);
@@ -4995,7 +5033,7 @@ e.prototype.init = function(t, n) {
4995
5033
  var c = "";
4996
5034
  if (o !== e.action.exporting && !n.isSplit) {
4997
5035
  var l = a[n.lcn ? n.lcn : "base"], u = e.t(n.templateName, n.min, s);
4998
- if (n.childCount) {
5036
+ if (n.childrenIds.length) {
4999
5037
  if (n.hasPartners) {
5000
5038
  for (var d = !1, f = 0; f < n.childrenIds.length; f++) {
5001
5039
  var p = t.getNode(n.childrenIds[f]);
@@ -5007,7 +5045,7 @@ e.prototype.init = function(t, n) {
5007
5045
  x: m.x + n.x - u.expandCollapseSize / 2,
5008
5046
  y: m.y + n.y - u.expandCollapseSize / 2
5009
5047
  };
5010
- n.collapsedChildCount ? (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.collapsedChildCount && typeof u.plus != "function" || !n.collapsedChildCount && typeof u.minus != "function") && (c.indexOf("{collapsed-children-count}") != -1 && (c = c.replace("{collapsed-children-count}", n.collapsedChildCount)), 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.childCount)), c.indexOf("{children-total-count}") != -1 && (c = c.replace("{children-total-count}", n.deepChildCount)));
5048
+ 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
5049
  }
5012
5050
  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
5051
  }
@@ -8915,7 +8953,7 @@ e.prototype.init = function(t, n) {
8915
8953
  var r = t.getScale(), i = e.t(n.node.templateName, n.node.min, r), a = "";
8916
8954
  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
8955
  var o = t.getNode(n.node.stChildrenIds[0]);
8918
- a.indexOf("{collapsed-children-count}") != -1 && (a = a.replace("{collapsed-children-count}", o.collapsedChildCount)), 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.childCount)), a.indexOf("{children-total-count}") != -1 && (a = a.replace("{children-total-count}", o.deepChildCount)), n.html += a;
8956
+ 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
8957
  }
8920
8958
  }), e.events.on("redraw", function(t, n) {
8921
8959
  var r = null;
@@ -9757,6 +9795,10 @@ e.prototype.init = function(t, n) {
9757
9795
  return this.on("node-mouseleave", function(t, n) {
9758
9796
  return e.call(t, n);
9759
9797
  });
9798
+ }, e.prototype.onDemand = function(e) {
9799
+ return this.on("on-demand", function(t, n) {
9800
+ return e.call(t, n);
9801
+ });
9760
9802
  }, e.prototype.onCanvasClick = function(e) {
9761
9803
  return this.on("canvas-click", function(t, n) {
9762
9804
  return e.call(t, n);
package/package.json CHANGED
@@ -58,5 +58,5 @@
58
58
  "url": "git+https://github.com/BALKANGraph/OrgChartJS.git"
59
59
  },
60
60
  "dependencies": {},
61
- "version": "9.2.49"
61
+ "version": "9.3.0"
62
62
  }