balkan-orgchart-js-community 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 +9 -9
- package/orgchart.mjs +167 -91
- 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.prototype.canUpdateLink = function(e, t) {
|
|
@@ -457,6 +459,16 @@ e.prototype.init = function(t, n) {
|
|
|
457
459
|
}, function() {
|
|
458
460
|
i.ripple(t.id), n && n();
|
|
459
461
|
});
|
|
462
|
+
}, e.prototype.addNodes = function(t, n, r) {
|
|
463
|
+
if (Array.isArray(n)) {
|
|
464
|
+
var i = this, a = [];
|
|
465
|
+
for (var o of n) this.add(o), a.push(o.id);
|
|
466
|
+
this._ai.setContext(), e.events.publish("updated", [this]), this.filterUI.update();
|
|
467
|
+
var s = { id: t };
|
|
468
|
+
i._draw(!1, e.action.update, s, function() {
|
|
469
|
+
r && r();
|
|
470
|
+
});
|
|
471
|
+
}
|
|
460
472
|
}, e.prototype.add = function(t) {
|
|
461
473
|
if (t.id ?? console.error("Call addNode without id"), this._putInUndoStack(), this.clearRedo(), this.config.movable && !e.isNEU(t.pid)) {
|
|
462
474
|
var n = this._get(t.pid);
|
|
@@ -694,7 +706,7 @@ e.prototype.init = function(t, n) {
|
|
|
694
706
|
n._menuClickHandler.apply(n, [this, e]);
|
|
695
707
|
});
|
|
696
708
|
}
|
|
697
|
-
}, e === void 0 && (e = {}), e.VERSION = "9.
|
|
709
|
+
}, 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 = {
|
|
698
710
|
top_right: "top_right",
|
|
699
711
|
right_top: "right_top",
|
|
700
712
|
bottom_right: "bottom_right",
|
|
@@ -1259,12 +1271,13 @@ e.prototype.init = function(t, n) {
|
|
|
1259
1271
|
}
|
|
1260
1272
|
};
|
|
1261
1273
|
})(), e.prototype.expand = function(t, n, r) {
|
|
1262
|
-
this._treeListExpandCollapseHandler(t), this._resetMovableNodes()
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1274
|
+
if (this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n), n.length) {
|
|
1275
|
+
var i = {
|
|
1276
|
+
id: t,
|
|
1277
|
+
ids: n
|
|
1278
|
+
};
|
|
1279
|
+
this._draw(!1, e.action.expand, i, r);
|
|
1280
|
+
}
|
|
1268
1281
|
}, e.prototype.collapse = function(t, n, r) {
|
|
1269
1282
|
this._treeListExpandCollapseHandler(t), this._resetMovableNodes();
|
|
1270
1283
|
var i = {
|
|
@@ -1273,7 +1286,7 @@ e.prototype.init = function(t, n) {
|
|
|
1273
1286
|
};
|
|
1274
1287
|
this._draw(!1, e.action.collapse, i, r);
|
|
1275
1288
|
}, e.prototype.expandCollapse = function(t, n, r, i) {
|
|
1276
|
-
this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []);
|
|
1289
|
+
this._treeListExpandCollapseHandler(t), this._resetMovableNodes(), Array.isArray(n) || (n = []), Array.isArray(r) || (r = []), n = this._filterOnlyExistingAndCallOnDemandForOthers(t, n);
|
|
1277
1290
|
var a = {
|
|
1278
1291
|
id: t,
|
|
1279
1292
|
expandIds: n,
|
|
@@ -1288,6 +1301,13 @@ e.prototype.init = function(t, n) {
|
|
|
1288
1301
|
changeRoots: n
|
|
1289
1302
|
};
|
|
1290
1303
|
this._draw(!1, e.action.update, i, r);
|
|
1304
|
+
}, e.prototype._filterOnlyExistingAndCallOnDemandForOthers = function(t, n) {
|
|
1305
|
+
var r = [], i = [];
|
|
1306
|
+
for (var a of n) this.getNode(a) ? i.push(a) : r.push(a);
|
|
1307
|
+
return r.length && e.events.publish("on-demand", [this, {
|
|
1308
|
+
ids: r,
|
|
1309
|
+
id: t
|
|
1310
|
+
}]), i;
|
|
1291
1311
|
}, e.prototype._resetMovableNodes = function() {
|
|
1292
1312
|
if (e.RESET_MOVABLE_ONEXPANDCOLLAPSE && this.config.movable != null) {
|
|
1293
1313
|
for (var t = !1, n = 0; n < this.config.nodes.length; n++) {
|
|
@@ -1311,43 +1331,46 @@ e.prototype.init = function(t, n) {
|
|
|
1311
1331
|
});
|
|
1312
1332
|
}, e.prototype._expCollHandler = function(t) {
|
|
1313
1333
|
this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
|
|
1314
|
-
var n = this.getNode(t)
|
|
1315
|
-
if (
|
|
1316
|
-
var
|
|
1334
|
+
var n = this.getNode(t);
|
|
1335
|
+
if (n.collapsedChildrenIds.length) {
|
|
1336
|
+
var r = e.events.publish("expcollclick", [
|
|
1317
1337
|
this,
|
|
1318
1338
|
!1,
|
|
1319
1339
|
t,
|
|
1320
|
-
|
|
1340
|
+
n.collapsedChildrenIds
|
|
1321
1341
|
]);
|
|
1322
|
-
if (
|
|
1323
|
-
this.expand(t,
|
|
1342
|
+
if (r === !1) return !1;
|
|
1343
|
+
this.expand(t, n.collapsedChildrenIds, !1);
|
|
1324
1344
|
} else {
|
|
1325
|
-
var
|
|
1345
|
+
var r = e.events.publish("expcollclick", [
|
|
1326
1346
|
this,
|
|
1327
1347
|
!0,
|
|
1328
1348
|
t,
|
|
1329
1349
|
n.childrenIds
|
|
1330
1350
|
]);
|
|
1331
|
-
if (
|
|
1351
|
+
if (r === !1) return !1;
|
|
1332
1352
|
this.collapse(t, n.childrenIds, !1);
|
|
1333
1353
|
}
|
|
1334
1354
|
}, e.prototype._upHandler = function(t) {
|
|
1335
1355
|
this.nodeMenuUI.hide(), this.nodeContextMenuUI.hide(), this.menuUI.hide(), this.nodeCircleMenuUI.hide();
|
|
1336
1356
|
var n = this._upHandlerCreateArgs(t);
|
|
1337
1357
|
if (e.events.publish("up-click", [this, n]) === !1) return !1;
|
|
1338
|
-
this.changeRoots(n.id, n.roots, !1);
|
|
1339
|
-
}, e.prototype._upHandlerCreateArgs = function(
|
|
1340
|
-
var
|
|
1341
|
-
if (
|
|
1342
|
-
if (Array.isArray(
|
|
1343
|
-
var
|
|
1344
|
-
|
|
1345
|
-
} else
|
|
1346
|
-
|
|
1347
|
-
}
|
|
1358
|
+
n.roots.length != 0 && this.changeRoots(n.id, n.roots, !1);
|
|
1359
|
+
}, e.prototype._upHandlerCreateArgs = function(t) {
|
|
1360
|
+
var n = this.getNode(t), r = Object.assign([], this.config.roots), i = this.getNode(n.pid), a;
|
|
1361
|
+
if (i && (a = i), a) {
|
|
1362
|
+
if (Array.isArray(r)) {
|
|
1363
|
+
var o = r.indexOf(n.id);
|
|
1364
|
+
o != -1 && r.splice(o, 1);
|
|
1365
|
+
} else r = [];
|
|
1366
|
+
r.push(a.id);
|
|
1367
|
+
} else e.events.publish("on-demand", [this, {
|
|
1368
|
+
ids: [n.pid],
|
|
1369
|
+
id: n.id
|
|
1370
|
+
}]);
|
|
1348
1371
|
return {
|
|
1349
|
-
id:
|
|
1350
|
-
roots:
|
|
1372
|
+
id: n.id,
|
|
1373
|
+
roots: r
|
|
1351
1374
|
};
|
|
1352
1375
|
}, String.prototype.replaceAll || (String.prototype.replaceAll = function(e, t) {
|
|
1353
1376
|
return this.replace(new RegExp(e, "g"), t);
|
|
@@ -1674,24 +1697,24 @@ e.prototype.init = function(t, n) {
|
|
|
1674
1697
|
var e = { id: this.generateId() };
|
|
1675
1698
|
this.addNode(e, null, !0) !== !1 && this.center(e.id);
|
|
1676
1699
|
}, e.prototype.toggleExpandCollapse = function(t, n) {
|
|
1677
|
-
var r = this.getNode(t)
|
|
1678
|
-
if (
|
|
1679
|
-
var
|
|
1700
|
+
var r = this.getNode(t);
|
|
1701
|
+
if (r.collapsedChildrenIds.length) {
|
|
1702
|
+
var i = e.events.publish("expcollclick", [
|
|
1680
1703
|
this,
|
|
1681
1704
|
!1,
|
|
1682
1705
|
t,
|
|
1683
|
-
|
|
1706
|
+
r.collapsedChildrenIds
|
|
1684
1707
|
]);
|
|
1685
|
-
if (
|
|
1686
|
-
this.expand(t,
|
|
1708
|
+
if (i === !1) return !1;
|
|
1709
|
+
this.expand(t, r.collapsedChildrenIds, !1);
|
|
1687
1710
|
} else {
|
|
1688
|
-
var
|
|
1711
|
+
var i = e.events.publish("expcollclick", [
|
|
1689
1712
|
this,
|
|
1690
1713
|
!0,
|
|
1691
1714
|
t,
|
|
1692
1715
|
r.childrenIds
|
|
1693
1716
|
]);
|
|
1694
|
-
if (
|
|
1717
|
+
if (i === !1) return !1;
|
|
1695
1718
|
this.collapse(t, r.childrenIds, !1);
|
|
1696
1719
|
}
|
|
1697
1720
|
n && this.ripple(r.id, n.clientX, n.clientY);
|
|
@@ -1879,7 +1902,7 @@ e.prototype.init = function(t, n) {
|
|
|
1879
1902
|
}, e.prototype.moveEnd = function() {
|
|
1880
1903
|
this._moveInterval &&= (clearInterval(this._moveInterval), null);
|
|
1881
1904
|
}, 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.
|
|
1905
|
+
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
1906
|
}, e === void 0 && (e = {}), e.idb = {
|
|
1884
1907
|
version: 1,
|
|
1885
1908
|
dbName: "BALKAN",
|
|
@@ -2040,43 +2063,44 @@ e.prototype.init = function(t, n) {
|
|
|
2040
2063
|
} else a == e.action.exporting && r.expandChildren && (t.collapsed = !1);
|
|
2041
2064
|
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
2065
|
}, 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,
|
|
2045
|
-
for (var
|
|
2046
|
-
var
|
|
2047
|
-
if (e.manager._setCollpasedProperty(
|
|
2066
|
+
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"];
|
|
2067
|
+
t.parent ?? e.manager._setCollpasedProperty(t, m, d, a, u, i - 1, f, n);
|
|
2068
|
+
for (var h = 0; h < t.childrenIds.length; h++) {
|
|
2069
|
+
var g = n[t.childrenIds[h]];
|
|
2070
|
+
if (g) if (e.manager._setCollpasedProperty(g, m, d, a, u, i, f, n), g.collapsed) t.collapsedChildrenIds.push(g.id);
|
|
2048
2071
|
else {
|
|
2049
|
-
if (
|
|
2050
|
-
var
|
|
2051
|
-
|
|
2072
|
+
if (g.parent = t, g.ppid != null) {
|
|
2073
|
+
var _ = n[g.ppid];
|
|
2074
|
+
_ && (g.parentPartner = _);
|
|
2052
2075
|
}
|
|
2053
|
-
(
|
|
2076
|
+
(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
2077
|
}
|
|
2078
|
+
else p && t.collapsedChildrenIds.push(t.childrenIds[h]);
|
|
2055
2079
|
}
|
|
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
|
|
2057
|
-
var
|
|
2058
|
-
|
|
2080
|
+
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++) {
|
|
2081
|
+
var g = n[t.stChildrenIds[h]];
|
|
2082
|
+
g.stParent = t, t.stChildren.push(g);
|
|
2059
2083
|
}
|
|
2060
2084
|
i != null && (t.level = i), r && (t.lcn = r);
|
|
2061
|
-
var
|
|
2062
|
-
|
|
2063
|
-
var
|
|
2064
|
-
if (t.w =
|
|
2085
|
+
var v = e._getSubLevels(t.tags, c.tags);
|
|
2086
|
+
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);
|
|
2087
|
+
var y = e.t(t.templateName, t.min);
|
|
2088
|
+
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
2089
|
0,
|
|
2066
2090
|
0,
|
|
2067
2091
|
0,
|
|
2068
2092
|
0
|
|
2069
2093
|
], t.isTreeListItem && t.stParent && t.stParent.treeList == null) {
|
|
2070
|
-
var
|
|
2094
|
+
var b = e.t(t.stParent.templateName, t.stParent.min);
|
|
2071
2095
|
t.stParent.treeList = {
|
|
2072
2096
|
pinnedIds: [],
|
|
2073
2097
|
scrollTop: 0,
|
|
2074
2098
|
scrollTopMax: 0,
|
|
2075
|
-
maxHeight:
|
|
2099
|
+
maxHeight: b.treeListMaxHeight
|
|
2076
2100
|
};
|
|
2077
2101
|
}
|
|
2078
|
-
var
|
|
2079
|
-
e.events.publish("node-initialized", [s,
|
|
2102
|
+
var x = { node: t };
|
|
2103
|
+
e.events.publish("node-initialized", [s, x]);
|
|
2080
2104
|
}, e.manager._iterate = function(t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
2081
2105
|
var p = f.manager.layoutConfigs;
|
|
2082
2106
|
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 +2129,54 @@ e.prototype.init = function(t, n) {
|
|
|
2105
2129
|
i++;
|
|
2106
2130
|
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
2131
|
}, e.manager.__createNodes = function(t, n, r, i, a, o, s, c) {
|
|
2108
|
-
for (var l = [], u = e._addDottedLines(r), d = 0;
|
|
2109
|
-
var
|
|
2110
|
-
c.filterUI.addFilterTag(
|
|
2111
|
-
var
|
|
2112
|
-
|
|
2113
|
-
var
|
|
2114
|
-
|
|
2115
|
-
var
|
|
2116
|
-
e.isNEU(
|
|
2132
|
+
for (var l = [], u = e._addDottedLines(r), d = [], f = e._hasOnDemandHandler(c), p = 0; p < u.length; p++) {
|
|
2133
|
+
var m = u[p], h = e.STRING_TAGS ? m.tags ? m.tags.split(",") : [] : Array.isArray(m.tags) ? m.tags.slice(0) : [];
|
|
2134
|
+
c.filterUI.addFilterTag(m) && h.unshift("filter");
|
|
2135
|
+
var g = c.searchUI.addMatchTag(m.id);
|
|
2136
|
+
g === !0 ? h.unshift("match") : g === !1 && h.unshift("no-match");
|
|
2137
|
+
var _ = e._getTemplate(h, r.tags, r.template);
|
|
2138
|
+
m && m.template && (_ = m.template);
|
|
2139
|
+
var v = new e.node(m.id, m.pid, h, _);
|
|
2140
|
+
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);
|
|
2141
|
+
}
|
|
2142
|
+
for (var m of d) {
|
|
2143
|
+
var y = t[m.id];
|
|
2144
|
+
for (var b of m.cids) {
|
|
2145
|
+
var x = t[b];
|
|
2146
|
+
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);
|
|
2147
|
+
}
|
|
2117
2148
|
}
|
|
2118
2149
|
if (r.orderBy != null) {
|
|
2119
|
-
var
|
|
2150
|
+
var S = e.manager._getOrderSortArray(r.orderBy);
|
|
2120
2151
|
l.sort(function(e, t) {
|
|
2121
2152
|
var n, r;
|
|
2122
2153
|
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 <
|
|
2124
|
-
var o = n[
|
|
2154
|
+
for (var a = 0; a < S.length; a++) {
|
|
2155
|
+
var o = n[S[a].field], s = r[S[a].field], c = o, l = s;
|
|
2125
2156
|
if (c ??= "", l ??= "", typeof c == "string" && typeof l == "string") {
|
|
2126
2157
|
var d = c.localeCompare(l);
|
|
2127
|
-
if (
|
|
2158
|
+
if (S[a].desc && (d *= -1), d !== 0) return d;
|
|
2128
2159
|
} else {
|
|
2129
2160
|
var d = o < s ? -1 : o > s ? 1 : 0;
|
|
2130
|
-
if (
|
|
2161
|
+
if (S[a].desc && (d *= -1), d !== 0) return d;
|
|
2131
2162
|
}
|
|
2132
2163
|
}
|
|
2133
2164
|
});
|
|
2134
2165
|
}
|
|
2135
|
-
for (var
|
|
2136
|
-
var
|
|
2137
|
-
if (
|
|
2138
|
-
var
|
|
2139
|
-
|
|
2140
|
-
} else
|
|
2141
|
-
i == e.action.init && (
|
|
2166
|
+
for (var p = 0; p < l.length; p++) {
|
|
2167
|
+
var C = l[p], v = t[C], w = o ? o[C] : null, T = t[v.stpid], y = t[v.pid];
|
|
2168
|
+
if (T || (v.stpid = null), !y && !f && (v.pid = null), T) {
|
|
2169
|
+
var E = o ? o[T.id] : null;
|
|
2170
|
+
E && (T.min = E.min), T.stChildrenIds.push(v.id);
|
|
2171
|
+
} 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));
|
|
2172
|
+
i == e.action.init && (v.min = e._getMin(v, r));
|
|
2142
2173
|
}
|
|
2174
|
+
for (var m of d) {
|
|
2175
|
+
var y = t[m.id];
|
|
2176
|
+
for (var b of m.cids) y.childrenIds.includes(b) || y.childrenIds.push(b);
|
|
2177
|
+
}
|
|
2178
|
+
}, e._hasOnDemandHandler = function(t) {
|
|
2179
|
+
return e.events.has("on-demand", t._event_id);
|
|
2143
2180
|
}, e.manager._createNodes = function(t) {
|
|
2144
2181
|
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
2182
|
if (e.manager.__createNodes(c, l, n, i, a, o, u, t), n.roots != null) {
|
|
@@ -2158,8 +2195,11 @@ e.prototype.init = function(t, n) {
|
|
|
2158
2195
|
}
|
|
2159
2196
|
if (!h) {
|
|
2160
2197
|
if (!e.isNEU(f.pid)) {
|
|
2161
|
-
var _ = c[f.pid]
|
|
2162
|
-
|
|
2198
|
+
var _ = c[f.pid];
|
|
2199
|
+
if (_) {
|
|
2200
|
+
var v = _.childrenIds.indexOf(f.id);
|
|
2201
|
+
v > -1 && _.childrenIds.splice(v, 1);
|
|
2202
|
+
}
|
|
2163
2203
|
}
|
|
2164
2204
|
l.push(f);
|
|
2165
2205
|
}
|
|
@@ -2762,10 +2802,12 @@ e.prototype.init = function(t, n) {
|
|
|
2762
2802
|
}, e.manager._addExpandedNodeIdsIterate = function(t, n, r) {
|
|
2763
2803
|
for (var i = 0; i < t.childrenIds.length; i++) r.push(t.childrenIds[i]), e.manager._addExpandedNodeIdsIterate(n[t.childrenIds[i]], n, r);
|
|
2764
2804
|
}, e.manager._setChildCountPropsIterate = function(t, n) {
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2805
|
+
if (t) {
|
|
2806
|
+
t.w === void 0 && (t.collapsedChildrenIds = t.childrenIds.slice()), t.deepChildCount = t.childrenIds.length, t.deepCollapsedChildCount = t.collapsedChildrenIds.length;
|
|
2807
|
+
for (var r = n[t.pid]; r;) r.deepCollapsedChildCount += t.collapsedChildrenIds.length, r.deepChildCount += t.childrenIds.length, r = n[r.pid];
|
|
2808
|
+
for (var i of t.stChildrenIds) e.manager._setChildCountPropsIterate(n[i], n);
|
|
2809
|
+
for (var i of t.childrenIds) e.manager._setChildCountPropsIterate(n[i], n);
|
|
2810
|
+
}
|
|
2769
2811
|
}, e.manager._setMinMaxXYAdjustifyIterate = function(t, n, r, i, a, o, s, c) {
|
|
2770
2812
|
t.x += o.x, t.y += o.y;
|
|
2771
2813
|
for (var l of t.stChildren) e.manager._setMinMaxXYAdjustifyIterate(l, l, r, 0, a, o, s, c);
|
|
@@ -2886,7 +2928,7 @@ e.prototype.init = function(t, n) {
|
|
|
2886
2928
|
plus: function(e, t, n, r, i) {
|
|
2887
2929
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
2888
2930
|
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>
|
|
2889
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
2931
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
2890
2932
|
},
|
|
2891
2933
|
minus: function(e, t, n, r, i) {
|
|
2892
2934
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
@@ -2922,7 +2964,7 @@ e.prototype.init = function(t, n) {
|
|
|
2922
2964
|
plus: function(e, t, n, r, i) {
|
|
2923
2965
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
2924
2966
|
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>
|
|
2925
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
2967
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
2926
2968
|
},
|
|
2927
2969
|
minus: function(e, t, n, r, i) {
|
|
2928
2970
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
@@ -2961,7 +3003,7 @@ e.prototype.init = function(t, n) {
|
|
|
2961
3003
|
], 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) {
|
|
2962
3004
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
2963
3005
|
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>
|
|
2964
|
-
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.
|
|
3006
|
+
<text text-anchor="middle" style="font-size: 14px;cursor:pointer;" fill="#aeaeae" x="15" y="21">${e.childrenIds.length}</text></g>`;
|
|
2965
3007
|
}, e.templates.emily.minus = function(e, t, n, r, i) {
|
|
2966
3008
|
var a = r.mode == "dark" ? "#1E1E1E" : "#ffffff";
|
|
2967
3009
|
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>
|
|
@@ -3253,7 +3295,7 @@ e.prototype.init = function(t, n) {
|
|
|
3253
3295
|
var i = n.expandCollapseSize / 2 + e.level * n.expandCollapseSize, a = e.h / 2;
|
|
3254
3296
|
a -= n.expandCollapseSize / 2;
|
|
3255
3297
|
var o = r.mode == "dark" ? "#ccc" : "#757575";
|
|
3256
|
-
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.
|
|
3298
|
+
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>`;
|
|
3257
3299
|
}, e.templates.treeListItem.minus = function(e, t, n, r) {
|
|
3258
3300
|
var i = n.expandCollapseSize / 2 + e.level * n.expandCollapseSize, a = e.h / 2;
|
|
3259
3301
|
a -= n.expandCollapseSize / 2;
|
|
@@ -3335,7 +3377,7 @@ e.prototype.init = function(t, n) {
|
|
|
3335
3377
|
var c = "";
|
|
3336
3378
|
if (o !== e.action.exporting && !n.isSplit) {
|
|
3337
3379
|
var l = a[n.lcn ? n.lcn : "base"], u = e.t(n.templateName, n.min, s);
|
|
3338
|
-
if (n.
|
|
3380
|
+
if (n.childrenIds.length) {
|
|
3339
3381
|
if (n.hasPartners) {
|
|
3340
3382
|
for (var d = !1, f = 0; f < n.childrenIds.length; f++) {
|
|
3341
3383
|
var p = t.getNode(n.childrenIds[f]);
|
|
@@ -3347,7 +3389,7 @@ e.prototype.init = function(t, n) {
|
|
|
3347
3389
|
x: m.x + n.x - u.expandCollapseSize / 2,
|
|
3348
3390
|
y: m.y + n.y - u.expandCollapseSize / 2
|
|
3349
3391
|
};
|
|
3350
|
-
n.
|
|
3392
|
+
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
3393
|
}
|
|
3352
3394
|
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
3395
|
}
|
|
@@ -5054,6 +5096,36 @@ e.prototype.init = function(t, n) {
|
|
|
5054
5096
|
}), Object.keys(e.nodeBinding).filter((e) => e.startsWith("img")).forEach((n) => {
|
|
5055
5097
|
t[n] = e.nodeBinding[n];
|
|
5056
5098
|
}), e.nodeBinding = t;
|
|
5099
|
+
}, e._moveNodesToVisibleAreaAfterExpand = function(t, n, r, i) {
|
|
5100
|
+
if (t.config.orientation != e.orientation.top) {
|
|
5101
|
+
console.error("_moveNodesToVisibleAreaAfterExpand works only for OrgChart.orientation.top, not implemented for others!");
|
|
5102
|
+
return;
|
|
5103
|
+
}
|
|
5104
|
+
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);
|
|
5105
|
+
if (t.getNode(r[0]).y > p.y) {
|
|
5106
|
+
for (var m of r) {
|
|
5107
|
+
var h = t.getNode(m), g = h.y - u + h.h + t.config.padding;
|
|
5108
|
+
g > f && (f = g);
|
|
5109
|
+
}
|
|
5110
|
+
f > p.y - t.config.padding && (f = p.y - t.config.padding);
|
|
5111
|
+
} else {
|
|
5112
|
+
for (var m of r) {
|
|
5113
|
+
var h = t.getNode(m), g = h.y - t.config.padding;
|
|
5114
|
+
g < f && (f = g);
|
|
5115
|
+
}
|
|
5116
|
+
f < p.y + p.h - u + t.config.padding && (f = p.y + p.h - u + t.config.padding);
|
|
5117
|
+
}
|
|
5118
|
+
if (f != c || d != s) {
|
|
5119
|
+
var _ = [
|
|
5120
|
+
d,
|
|
5121
|
+
f,
|
|
5122
|
+
l,
|
|
5123
|
+
u
|
|
5124
|
+
];
|
|
5125
|
+
e.animate(a, { viewBox: o }, { viewBox: _ }, t.config.anim.duration, t.config.anim.func, function() {
|
|
5126
|
+
t.draw(e.action.update, void 0, i);
|
|
5127
|
+
});
|
|
5128
|
+
}
|
|
5057
5129
|
}, e.prototype.zoom = function(t, n, r, i) {
|
|
5058
5130
|
var a = this.getViewBox().slice(0), o = a, s = a[2], c = a[3];
|
|
5059
5131
|
t === !0 ? (a[2] /= e.SCALE_FACTOR, a[3] /= e.SCALE_FACTOR) : t === !1 ? (a[2] *= e.SCALE_FACTOR, a[3] *= e.SCALE_FACTOR) : (a[2] /= t, a[3] /= t), n ||= [50, 50], a[0] = o[0] - (a[2] - s) / (100 / n[0]), a[1] = o[1] - (a[3] - c) / (100 / n[1]);
|
|
@@ -5504,6 +5576,10 @@ e.prototype.init = function(t, n) {
|
|
|
5504
5576
|
return this.on("node-mouseleave", function(t, n) {
|
|
5505
5577
|
return e.call(t, n);
|
|
5506
5578
|
});
|
|
5579
|
+
}, e.prototype.onDemand = function(e) {
|
|
5580
|
+
return this.on("on-demand", function(t, n) {
|
|
5581
|
+
return e.call(t, n);
|
|
5582
|
+
});
|
|
5507
5583
|
}, e.prototype.onCanvasClick = function(e) {
|
|
5508
5584
|
return this.on("canvas-click", function(t, n) {
|
|
5509
5585
|
return e.call(t, n);
|
package/package.json
CHANGED