balkan-orgchart-js-community 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.prototype.canUpdateLink = function(e, t) {
@@ -457,6 +457,14 @@ e.prototype.init = function(t, n) {
457
457
  }, function() {
458
458
  i.ripple(t.id), n && n();
459
459
  });
460
+ }, e.prototype.addNodes = function(t, n, r) {
461
+ if (Array.isArray(n)) {
462
+ var i = this, a = [];
463
+ for (var o of n) this.add(o), a.push(o.id);
464
+ this._ai.setContext(), e.events.publish("updated", [this]), this.filterUI.update(), i._draw(!1, e.action.insert, { id: t }, function() {
465
+ r && r();
466
+ });
467
+ }
460
468
  }, e.prototype.add = function(t) {
461
469
  if (t.id ?? console.error("Call addNode without id"), this._putInUndoStack(), this.clearRedo(), this.config.movable && !e.isNEU(t.pid)) {
462
470
  var n = this._get(t.pid);
@@ -694,7 +702,7 @@ e.prototype.init = function(t, n) {
694
702
  n._menuClickHandler.apply(n, [this, e]);
695
703
  });
696
704
  }
697
- }, 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 = {
705
+ }, 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 = {
698
706
  top_right: "top_right",
699
707
  right_top: "right_top",
700
708
  bottom_right: "bottom_right",
@@ -1259,12 +1267,13 @@ e.prototype.init = function(t, n) {
1259
1267
  }
1260
1268
  };
1261
1269
  })(), e.prototype.expand = function(t, n, r) {
1262
- this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
1263
- var i = {
1264
- id: t,
1265
- ids: n
1266
- };
1267
- this._draw(!1, e.action.expand, i, r);
1270
+ if (this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n), n.length) {
1271
+ var i = {
1272
+ id: t,
1273
+ ids: n
1274
+ };
1275
+ this._draw(!1, e.action.expand, i, r);
1276
+ }
1268
1277
  }, e.prototype.collapse = function(t, n, r) {
1269
1278
  this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
1270
1279
  var i = {
@@ -1273,7 +1282,7 @@ e.prototype.init = function(t, n) {
1273
1282
  };
1274
1283
  this._draw(!1, e.action.collapse, i, r);
1275
1284
  }, e.prototype.expandCollapse = function(t, n, r, i) {
1276
- this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []);
1285
+ this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n);
1277
1286
  var a = {
1278
1287
  id: t,
1279
1288
  expandIds: n,
@@ -1288,6 +1297,13 @@ e.prototype.init = function(t, n) {
1288
1297
  changeRoots: n
1289
1298
  };
1290
1299
  this._draw(!1, e.action.update, i, r);
1300
+ }, e.prototype._filterOnlyExistingAndCallOnDemandForOthers = function(t, n) {
1301
+ var r = [], i = [];
1302
+ for (var a of n) this.getNode(a) ? i.push(a) : r.push(a);
1303
+ return r.length && e.events.publish("on-demand", [this, {
1304
+ ids: r,
1305
+ id: t
1306
+ }]), i;
1291
1307
  }, e.prototype._resetMovableNodes = function() {
1292
1308
  if (e.RESET_MOVABLE_ONEXPANDCOLLAPSE && this.config.movable != null) {
1293
1309
  for (var t = !1, n = 0; n < this.config.nodes.length; n++) {
@@ -1311,43 +1327,46 @@ e.prototype.init = function(t, n) {
1311
1327
  });
1312
1328
  }, e.prototype._expCollHandler = function(t) {
1313
1329
  this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
1314
- var n = this.getNode(t), r = this.getCollapsedIds(n);
1315
- if (r.length) {
1316
- var i = e.events.publish("expcollclick", [
1330
+ var n = this.getNode(t);
1331
+ if (n.collapsedChildrenIds.length) {
1332
+ var r = e.events.publish("expcollclick", [
1317
1333
  this,
1318
1334
  !1,
1319
1335
  t,
1320
- r
1336
+ n.collapsedChildrenIds
1321
1337
  ]);
1322
- if (i === !1) return !1;
1323
- this.expand(t, r, !1);
1338
+ if (r === !1) return !1;
1339
+ this.expand(t, n.collapsedChildrenIds, !1);
1324
1340
  } else {
1325
- var i = e.events.publish("expcollclick", [
1341
+ var r = e.events.publish("expcollclick", [
1326
1342
  this,
1327
1343
  !0,
1328
1344
  t,
1329
1345
  n.childrenIds
1330
1346
  ]);
1331
- if (i === !1) return !1;
1347
+ if (r === !1) return !1;
1332
1348
  this.collapse(t, n.childrenIds, !1);
1333
1349
  }
1334
1350
  }, e.prototype._upHandler = function(t) {
1335
1351
  this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
1336
1352
  var n = this._upHandlerCreateArgs(t);
1337
1353
  if (e.events.publish("up-click", [this, n]) === !1) return !1;
1338
- this.changeRoots(n.id, n.roots, !1);
1339
- }, e.prototype._upHandlerCreateArgs = function(e) {
1340
- var t = this.getNode(e), n = Object.assign([], this.config.roots), r = this.getNode(t.pid), i;
1341
- if (r && (i = r), i) {
1342
- if (Array.isArray(n)) {
1343
- var a = n.indexOf(t.id);
1344
- a != -1 && n.splice(a, 1);
1345
- } else n = [];
1346
- n.push(i.id);
1347
- }
1354
+ n.roots.length != 0 && this.changeRoots(n.id, n.roots, !1);
1355
+ }, e.prototype._upHandlerCreateArgs = function(t) {
1356
+ var n = this.getNode(t), r = Object.assign([], this.config.roots), i = this.getNode(n.pid), a;
1357
+ if (i && (a = i), a) {
1358
+ if (Array.isArray(r)) {
1359
+ var o = r.indexOf(n.id);
1360
+ o != -1 && r.splice(o, 1);
1361
+ } else r = [];
1362
+ r.push(a.id);
1363
+ } else e.events.publish("on-demand", [this, {
1364
+ ids: [n.pid],
1365
+ id: n.id
1366
+ }]);
1348
1367
  return {
1349
- id: t.id,
1350
- roots: n
1368
+ id: n.id,
1369
+ roots: r
1351
1370
  };
1352
1371
  }, String.prototype.replaceAll || (String.prototype.replaceAll = function(e, t) {
1353
1372
  return this.replace(new RegExp(e, "g"), t);
@@ -1674,24 +1693,24 @@ e.prototype.init = function(t, n) {
1674
1693
  var e = { id: this.generateId() };
1675
1694
  this.addNode(e, null, !0) !== !1 && this.center(e.id);
1676
1695
  }, e.prototype.toggleExpandCollapse = function(t, n) {
1677
- var r = this.getNode(t), i = this.getCollapsedIds(r);
1678
- if (i.length) {
1679
- var a = e.events.publish("expcollclick", [
1696
+ var r = this.getNode(t);
1697
+ if (r.collapsedChildrenIds.length) {
1698
+ var i = e.events.publish("expcollclick", [
1680
1699
  this,
1681
1700
  !1,
1682
1701
  t,
1683
- i
1702
+ r.collapsedChildrenIds
1684
1703
  ]);
1685
- if (a === !1) return !1;
1686
- this.expand(t, i, !1);
1704
+ if (i === !1) return !1;
1705
+ this.expand(t, r.collapsedChildrenIds, !1);
1687
1706
  } else {
1688
- var a = e.events.publish("expcollclick", [
1707
+ var i = e.events.publish("expcollclick", [
1689
1708
  this,
1690
1709
  !0,
1691
1710
  t,
1692
1711
  r.childrenIds
1693
1712
  ]);
1694
- if (a === !1) return !1;
1713
+ if (i === !1) return !1;
1695
1714
  this.collapse(t, r.childrenIds, !1);
1696
1715
  }
1697
1716
  n && this.ripple(r.id, n.clientX, n.clientY);
@@ -1879,7 +1898,7 @@ e.prototype.init = function(t, n) {
1879
1898
  }, e.prototype.moveEnd = function() {
1880
1899
  this._moveInterval &&= (clearInterval(this._moveInterval), null);
1881
1900
  }, e === void 0 && (e = {}), e.node = function(e, t, n, r) {
1882
- 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 ||= [];
1901
+ 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 ||= [];
1883
1902
  }, e === void 0 && (e = {}), e.idb = {
1884
1903
  version: 1,
1885
1904
  dbName: "BALKAN",
@@ -2040,43 +2059,44 @@ e.prototype.init = function(t, n) {
2040
2059
  } else a == e.action.exporting && r.expandChildren && (t.collapsed = !1);
2041
2060
  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);
2042
2061
  }, e.manager._initNode = function(t, n, r, i, a, o, s) {
2043
- 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"];
2044
- t.parent ?? e.manager._setCollpasedProperty(t, p, d, a, u, i - 1, f, n);
2045
- for (var m = 0; m < t.childrenIds.length; m++) {
2046
- var h = n[t.childrenIds[m]];
2047
- if (e.manager._setCollpasedProperty(h, p, d, a, u, i, f, n), h.collapsed) t.collapsedChildCount++;
2062
+ 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"];
2063
+ t.parent ?? e.manager._setCollpasedProperty(t, m, d, a, u, i - 1, f, n);
2064
+ for (var h = 0; h < t.childrenIds.length; h++) {
2065
+ var g = n[t.childrenIds[h]];
2066
+ if (g) if (e.manager._setCollpasedProperty(g, m, d, a, u, i, f, n), g.collapsed) t.collapsedChildrenIds.push(g.id);
2048
2067
  else {
2049
- if (h.parent = t, h.ppid != null) {
2050
- var g = n[h.ppid];
2051
- g && (h.parentPartner = g);
2068
+ if (g.parent = t, g.ppid != null) {
2069
+ var _ = n[g.ppid];
2070
+ _ && (g.parentPartner = _);
2052
2071
  }
2053
- (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);
2072
+ (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);
2054
2073
  }
2074
+ else p && t.collapsedChildrenIds.push(t.childrenIds[h]);
2055
2075
  }
2056
- 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++) {
2057
- var h = n[t.stChildrenIds[m]];
2058
- h.stParent = t, t.stChildren.push(h);
2076
+ 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++) {
2077
+ var g = n[t.stChildrenIds[h]];
2078
+ g.stParent = t, t.stChildren.push(g);
2059
2079
  }
2060
2080
  i != null && (t.level = i), r && (t.lcn = r);
2061
- var _ = e._getSubLevels(t.tags, c.tags);
2062
- _ > 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);
2063
- var v = e.t(t.templateName, t.min);
2064
- 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 : [
2081
+ var v = e._getSubLevels(t.tags, c.tags);
2082
+ 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);
2083
+ var y = e.t(t.templateName, t.min);
2084
+ 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 : [
2065
2085
  0,
2066
2086
  0,
2067
2087
  0,
2068
2088
  0
2069
2089
  ], t.isTreeListItem && t.stParent && t.stParent.treeList == null) {
2070
- var y = e.t(t.stParent.templateName, t.stParent.min);
2090
+ var b = e.t(t.stParent.templateName, t.stParent.min);
2071
2091
  t.stParent.treeList = {
2072
2092
  pinnedIds: [],
2073
2093
  scrollTop: 0,
2074
2094
  scrollTopMax: 0,
2075
- maxHeight: y.treeListMaxHeight
2095
+ maxHeight: b.treeListMaxHeight
2076
2096
  };
2077
2097
  }
2078
- var b = { node: t };
2079
- e.events.publish("node-initialized", [s, b]);
2098
+ var x = { node: t };
2099
+ e.events.publish("node-initialized", [s, x]);
2080
2100
  }, e.manager._iterate = function(t, n, r, i, a, o, s, c, l, u, d, f) {
2081
2101
  var p = f.manager.layoutConfigs;
2082
2102
  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) {
@@ -2105,41 +2125,54 @@ e.prototype.init = function(t, n) {
2105
2125
  i++;
2106
2126
  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);
2107
2127
  }, e.manager.__createNodes = function(t, n, r, i, a, o, s, c) {
2108
- for (var l = [], u = e._addDottedLines(r), d = 0; d < u.length; d++) {
2109
- var f = u[d], p = e.STRING_TAGS ? f.tags ? f.tags.split(",") : [] : Array.isArray(f.tags) ? f.tags.slice(0) : [];
2110
- c.filterUI.addFilterTag(f) && p.unshift("filter");
2111
- var m = c.searchUI.addMatchTag(f.id);
2112
- m === !0 ? p.unshift("match") : m === !1 && p.unshift("no-match");
2113
- var h = e._getTemplate(p, r.tags, r.template);
2114
- f && f.template && (h = f.template);
2115
- var g = new e.node(f.id, f.pid, p, h);
2116
- 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);
2128
+ for (var l = [], u = e._addDottedLines(r), d = [], f = e._hasOnDemandHandler(c), p = 0; p < u.length; p++) {
2129
+ var m = u[p], h = e.STRING_TAGS ? m.tags ? m.tags.split(",") : [] : Array.isArray(m.tags) ? m.tags.slice(0) : [];
2130
+ c.filterUI.addFilterTag(m) && h.unshift("filter");
2131
+ var g = c.searchUI.addMatchTag(m.id);
2132
+ g === !0 ? h.unshift("match") : g === !1 && h.unshift("no-match");
2133
+ var _ = e._getTemplate(h, r.tags, r.template);
2134
+ m && m.template && (_ = m.template);
2135
+ var v = new e.node(m.id, m.pid, h, _);
2136
+ 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);
2137
+ }
2138
+ for (var m of d) {
2139
+ var y = t[m.id];
2140
+ for (var b of m.cids) {
2141
+ var x = t[b];
2142
+ 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);
2143
+ }
2117
2144
  }
2118
2145
  if (r.orderBy != null) {
2119
- var _ = e.manager._getOrderSortArray(r.orderBy);
2146
+ var S = e.manager._getOrderSortArray(r.orderBy);
2120
2147
  l.sort(function(e, t) {
2121
2148
  var n, r;
2122
2149
  for (var i of u) if (i.id == e && (n = i), i.id == t && (r = i), n && r) break;
2123
- for (var a = 0; a < _.length; a++) {
2124
- var o = n[_[a].field], s = r[_[a].field], c = o, l = s;
2150
+ for (var a = 0; a < S.length; a++) {
2151
+ var o = n[S[a].field], s = r[S[a].field], c = o, l = s;
2125
2152
  if (c ??= "", l ??= "", typeof c == "string" && typeof l == "string") {
2126
2153
  var d = c.localeCompare(l);
2127
- if (_[a].desc && (d *= -1), d !== 0) return d;
2154
+ if (S[a].desc && (d *= -1), d !== 0) return d;
2128
2155
  } else {
2129
2156
  var d = o < s ? -1 : o > s ? 1 : 0;
2130
- if (_[a].desc && (d *= -1), d !== 0) return d;
2157
+ if (S[a].desc && (d *= -1), d !== 0) return d;
2131
2158
  }
2132
2159
  }
2133
2160
  });
2134
2161
  }
2135
- for (var d = 0; d < l.length; d++) {
2136
- var v = l[d], g = t[v], y = o ? o[v] : null, b = t[g.stpid], x = t[g.pid];
2137
- if (b || (g.stpid = null), x || (g.pid = null), b) {
2138
- var S = o ? o[b.id] : null;
2139
- S && (b.min = S.min), b.stChildrenIds.push(g.id);
2140
- } 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));
2141
- i == e.action.init && (g.min = e._getMin(g, r));
2162
+ for (var p = 0; p < l.length; p++) {
2163
+ var C = l[p], v = t[C], w = o ? o[C] : null, T = t[v.stpid], y = t[v.pid];
2164
+ if (T || (v.stpid = null), !y && !f && (v.pid = null), T) {
2165
+ var E = o ? o[T.id] : null;
2166
+ E && (T.min = E.min), T.stChildrenIds.push(v.id);
2167
+ } 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));
2168
+ i == e.action.init && (v.min = e._getMin(v, r));
2142
2169
  }
2170
+ for (var m of d) {
2171
+ var y = t[m.id];
2172
+ for (var b of m.cids) y.childrenIds.includes(b) || y.childrenIds.push(b);
2173
+ }
2174
+ }, e._hasOnDemandHandler = function(t) {
2175
+ return e.events.has("on-demand", t._event_id);
2143
2176
  }, e.manager._createNodes = function(t) {
2144
2177
  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 = [];
2145
2178
  if (e.manager.__createNodes(c, l, n, i, a, o, u, t), n.roots != null) {
@@ -2158,8 +2191,11 @@ e.prototype.init = function(t, n) {
2158
2191
  }
2159
2192
  if (!h) {
2160
2193
  if (!e.isNEU(f.pid)) {
2161
- var _ = c[f.pid], v = _.childrenIds.indexOf(f.id);
2162
- v > -1 && _.childrenIds.splice(v, 1);
2194
+ var _ = c[f.pid];
2195
+ if (_) {
2196
+ var v = _.childrenIds.indexOf(f.id);
2197
+ v > -1 && _.childrenIds.splice(v, 1);
2198
+ }
2163
2199
  }
2164
2200
  l.push(f);
2165
2201
  }
@@ -2762,10 +2798,12 @@ e.prototype.init = function(t, n) {
2762
2798
  }, e.manager._addExpandedNodeIdsIterate = function(t, n, r) {
2763
2799
  for (var i = 0; i < t.childrenIds.length; i++) r.push(t.childrenIds[i]), e.manager._addExpandedNodeIdsIterate(n[t.childrenIds[i]], n, r);
2764
2800
  }, e.manager._setChildCountPropsIterate = function(t, n) {
2765
- t.w === void 0 && (t.collapsedChildCount = t.childrenIds.length), t.deepChildCount = t.childCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildCount;
2766
- for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildCount, r.deepChildCount += t.childCount, r = n[r.pid];
2767
- for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
2768
- for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
2801
+ if (t) {
2802
+ t.w === void 0 && (t.collapsedChildrenIds = t.childrenIds.slice()), t.deepChildCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildrenIds.length;
2803
+ for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildrenIds.length, r.deepChildCount += t.childrenIds.length, r = n[r.pid];
2804
+ for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
2805
+ for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
2806
+ }
2769
2807
  }, e.manager._setMinMaxXYAdjustifyIterate = function(t, n, r, i, a, o, s, c) {
2770
2808
  t.x += o.x, t.y += o.y;
2771
2809
  for (var l of t.stChildren) e.manager._setMinMaxXYAdjustifyIterate(l, l, r, 0, a, o, s, c);
@@ -3335,7 +3373,7 @@ e.prototype.init = function(t, n) {
3335
3373
  var c = "";
3336
3374
  if (o !== e.action.exporting && !n.isSplit) {
3337
3375
  var l = a[n.lcn ? n.lcn : "base"], u = e.t(n.templateName, n.min, s);
3338
- if (n.childCount) {
3376
+ if (n.childrenIds.length) {
3339
3377
  if (n.hasPartners) {
3340
3378
  for (var d = !1, f = 0; f < n.childrenIds.length; f++) {
3341
3379
  var p = t.getNode(n.childrenIds[f]);
@@ -3347,7 +3385,7 @@ e.prototype.init = function(t, n) {
3347
3385
  x: m.x + n.x - u.expandCollapseSize / 2,
3348
3386
  y: m.y + n.y - u.expandCollapseSize / 2
3349
3387
  };
3350
- 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)));
3388
+ 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)));
3351
3389
  }
3352
3390
  t._nodeHasHiddenParent(n) && (c += e.upOpenTag.replace("{id}", n.id).replace("{x}", n.x).replace("{y}", n.y), c += u.up, c += e.grCloseTag);
3353
3391
  }
@@ -5504,6 +5542,10 @@ e.prototype.init = function(t, n) {
5504
5542
  return this.on("node-mouseleave", function(t, n) {
5505
5543
  return e.call(t, n);
5506
5544
  });
5545
+ }, e.prototype.onDemand = function(e) {
5546
+ return this.on("on-demand", function(t, n) {
5547
+ return e.call(t, n);
5548
+ });
5507
5549
  }, e.prototype.onCanvasClick = function(e) {
5508
5550
  return this.on("canvas-click", function(t, n) {
5509
5551
  return e.call(t, n);
package/package.json CHANGED
@@ -58,5 +58,5 @@
58
58
  "url": "git+https://github.com/BALKANGraph/OrgChartJS-Community.git"
59
59
  },
60
60
  "dependencies": {},
61
- "version": "9.2.49"
61
+ "version": "9.3.0"
62
62
  }