@yuneta/gobj-ui 7.23.147 → 7.23.149
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/README.md +28 -3
- package/dist/gobj-ui.cjs.js +380 -52
- package/dist/gobj-ui.es.js +381 -53
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +96 -2
- package/src/c_yui_treedb_graph.js +50 -0
- package/src/treedb_layout.js +258 -0
- package/src/treedb_layout.test.js +102 -1
- package/src/yui_icons.css +6 -0
package/dist/gobj-ui.es.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createJSONEditor } from "vanilla-jsoneditor";
|
|
|
6
6
|
import { TabulatorFull } from "tabulator-tables";
|
|
7
7
|
import * as maplibregl from "maplibre-gl";
|
|
8
8
|
import uPlot from "uplot";
|
|
9
|
-
import { BaseLayout, BrushSelect, CanvasEvent, Circle, CommonEvent, DragCanvas, EdgeEvent, ExtensionCategory, Graph, HTML, HistoryEvent, NodeEvent, Toolbar, ZoomCanvas, register } from "@antv/g6";
|
|
9
|
+
import { BaseLayout, BrushSelect, CanvasEvent, Circle, CommonEvent, DragCanvas, EdgeEvent, ExtensionCategory, Graph, HTML, HistoryEvent, NodeEvent, Polyline, Toolbar, ZoomCanvas, register } from "@antv/g6";
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var __create = Object.create;
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
@@ -29309,6 +29309,203 @@ function tidy_tree_lr(nodes, edges, o) {
|
|
|
29309
29309
|
}
|
|
29310
29310
|
return pos;
|
|
29311
29311
|
}
|
|
29312
|
+
/************************************************************
|
|
29313
|
+
* The compact tree.
|
|
29314
|
+
*
|
|
29315
|
+
* The tidy tree above gives every subtree its whole BLOCK: open a
|
|
29316
|
+
* hall with twenty-four devices and its block widens, and with it
|
|
29317
|
+
* every block above it, so the siblings of its ancestors move apart
|
|
29318
|
+
* at depths where nothing of theirs touches. This one keeps the
|
|
29319
|
+
* CONTOUR of each subtree instead -- its outline on each side, depth
|
|
29320
|
+
* by depth -- and slides every sibling against the outline of the
|
|
29321
|
+
* ones before it. A folded region then sits as close to an open one
|
|
29322
|
+
* as their cards allow at each depth, which is what a folded treedb
|
|
29323
|
+
* is: one branch open among closed ones.
|
|
29324
|
+
*
|
|
29325
|
+
* Same spanning tree, same order, same rows as the tidy tree: only
|
|
29326
|
+
* the packing across the depths differs, so switching between the
|
|
29327
|
+
* two moves cards sideways and never reorders them.
|
|
29328
|
+
*
|
|
29329
|
+
* The contour arithmetic is Moen's ("Drawing dynamic trees", IEEE
|
|
29330
|
+
* Software, 1990) in the form mxGraph gave it in mxCompactTreeLayout
|
|
29331
|
+
* -- Copyright (c) 2006-2015 JGraph Ltd, Apache License 2.0 -- read in
|
|
29332
|
+
* maxGraph's CompactTreeLayout.ts: leaf, join, merge, offset and
|
|
29333
|
+
* bridge below follow that form. What is ours: it runs on the
|
|
29334
|
+
* spanning tree of a FOREST, every depth is a row as wide as its
|
|
29335
|
+
* widest card (mxGraph's `alignRanks`), several roots sit side by
|
|
29336
|
+
* side, and there is no recursion.
|
|
29337
|
+
************************************************************/
|
|
29338
|
+
function layout_compact(nodes, edges, opts) {
|
|
29339
|
+
let o = Object.assign({}, DEFAULTS, opts || {});
|
|
29340
|
+
if (o.direction === "LR") return compact_tree_lr(nodes, edges, o);
|
|
29341
|
+
let lr = compact_tree_lr(nodes.map((n) => Object.assign({}, n, {
|
|
29342
|
+
w: n.h,
|
|
29343
|
+
h: n.w
|
|
29344
|
+
})), edges, o);
|
|
29345
|
+
let pos = /* @__PURE__ */ new Map();
|
|
29346
|
+
for (let [id, p] of lr) pos.set(id, {
|
|
29347
|
+
x: p.y,
|
|
29348
|
+
y: p.x
|
|
29349
|
+
});
|
|
29350
|
+
return pos;
|
|
29351
|
+
}
|
|
29352
|
+
function contour_line(dx, dy, next) {
|
|
29353
|
+
return {
|
|
29354
|
+
dx,
|
|
29355
|
+
dy,
|
|
29356
|
+
next: next || null
|
|
29357
|
+
};
|
|
29358
|
+
}
|
|
29359
|
+
function contour_offset(p1, p2, a1, a2, b1, b2) {
|
|
29360
|
+
if (b1 <= p1 || p1 + a1 <= 0) return 0;
|
|
29361
|
+
let d;
|
|
29362
|
+
if (b1 * a2 - a1 * b2 > 0) {
|
|
29363
|
+
if (p1 < 0) d = p1 * a2 / a1 - p2;
|
|
29364
|
+
else if (p1 > 0) d = p1 * b2 / b1 - p2;
|
|
29365
|
+
else d = -p2;
|
|
29366
|
+
} else if (b1 < p1 + a1) d = b2 - (p2 + (b1 - p1) * a2 / a1);
|
|
29367
|
+
else if (b1 > p1 + a1) d = (a1 + p1) * b2 / b1 - (p2 + a2);
|
|
29368
|
+
else d = b2 - (p2 + a2);
|
|
29369
|
+
return d > 0 ? d : 0;
|
|
29370
|
+
}
|
|
29371
|
+
function contour_bridge(line1, x1, y1, line2, x2, y2) {
|
|
29372
|
+
let dx = x2 + line2.dx - x1;
|
|
29373
|
+
let dy = line2.dx === 0 ? line2.dy : dx * line2.dy / line2.dx;
|
|
29374
|
+
let r = contour_line(dx, dy, line2.next);
|
|
29375
|
+
line1.next = contour_line(0, y2 + line2.dy - dy - y1, r);
|
|
29376
|
+
return r;
|
|
29377
|
+
}
|
|
29378
|
+
function contour_merge(p1, p2) {
|
|
29379
|
+
let x = 0;
|
|
29380
|
+
let y = 0;
|
|
29381
|
+
let total = 0;
|
|
29382
|
+
let upper = p1.lower_head;
|
|
29383
|
+
let lower = p2.upper_head;
|
|
29384
|
+
while (lower && upper) {
|
|
29385
|
+
let d = contour_offset(x, y, lower.dx, lower.dy, upper.dx, upper.dy);
|
|
29386
|
+
y += d;
|
|
29387
|
+
total += d;
|
|
29388
|
+
if (x + lower.dx <= upper.dx) {
|
|
29389
|
+
x += lower.dx;
|
|
29390
|
+
y += lower.dy;
|
|
29391
|
+
lower = lower.next;
|
|
29392
|
+
} else {
|
|
29393
|
+
x -= upper.dx;
|
|
29394
|
+
y -= upper.dy;
|
|
29395
|
+
upper = upper.next;
|
|
29396
|
+
}
|
|
29397
|
+
}
|
|
29398
|
+
if (lower) {
|
|
29399
|
+
let b = contour_bridge(p1.upper_tail, 0, 0, lower, x, y);
|
|
29400
|
+
p1.upper_tail = b.next ? p2.upper_tail : b;
|
|
29401
|
+
p1.lower_tail = p2.lower_tail;
|
|
29402
|
+
} else {
|
|
29403
|
+
let b = contour_bridge(p2.lower_tail, x, y, upper, 0, 0);
|
|
29404
|
+
if (!b.next) p1.lower_tail = b;
|
|
29405
|
+
}
|
|
29406
|
+
p1.lower_head = p2.lower_head;
|
|
29407
|
+
return total;
|
|
29408
|
+
}
|
|
29409
|
+
function compact_tree_lr(nodes, edges, o) {
|
|
29410
|
+
let t = spanning_tree(nodes, edges);
|
|
29411
|
+
let order = walk_order(t);
|
|
29412
|
+
let pos = /* @__PURE__ */ new Map();
|
|
29413
|
+
let col_w = [];
|
|
29414
|
+
for (let [id, d] of t.depth) col_w[d] = Math.max(col_w[d] || 0, t.by_id.get(id).w);
|
|
29415
|
+
let col_x = [];
|
|
29416
|
+
let x = 0;
|
|
29417
|
+
for (let d = 0; d < col_w.length; d++) {
|
|
29418
|
+
col_x[d] = x;
|
|
29419
|
+
x += (col_w[d] || 0) + o.ranksep;
|
|
29420
|
+
}
|
|
29421
|
+
let pad = o.nodesep / 2;
|
|
29422
|
+
let dist = o.nodesep;
|
|
29423
|
+
let level_distance = o.ranksep - pad;
|
|
29424
|
+
let tn = /* @__PURE__ */ new Map();
|
|
29425
|
+
for (let id of order) tn.set(id, {
|
|
29426
|
+
len: col_w[t.depth.get(id)],
|
|
29427
|
+
ext: t.by_id.get(id).h,
|
|
29428
|
+
off_x: 0,
|
|
29429
|
+
off_y: 0,
|
|
29430
|
+
y: 0,
|
|
29431
|
+
contour: null
|
|
29432
|
+
});
|
|
29433
|
+
for (let i = order.length - 1; i >= 0; i--) {
|
|
29434
|
+
let id = order[i];
|
|
29435
|
+
let n = tn.get(id);
|
|
29436
|
+
let kids = t.children.get(id) || [];
|
|
29437
|
+
if (!kids.length) {
|
|
29438
|
+
let upper = contour_line(n.len + dist, 0);
|
|
29439
|
+
let lower_tail = contour_line(0, -n.ext - dist);
|
|
29440
|
+
n.contour = {
|
|
29441
|
+
upper_head: upper,
|
|
29442
|
+
upper_tail: upper,
|
|
29443
|
+
lower_tail,
|
|
29444
|
+
lower_head: contour_line(n.len + dist, 0, lower_tail)
|
|
29445
|
+
};
|
|
29446
|
+
continue;
|
|
29447
|
+
}
|
|
29448
|
+
let first = tn.get(kids[0]);
|
|
29449
|
+
n.contour = first.contour;
|
|
29450
|
+
let h = first.ext + dist;
|
|
29451
|
+
let span = h;
|
|
29452
|
+
for (let k = 1; k < kids.length; k++) {
|
|
29453
|
+
let kid = tn.get(kids[k]);
|
|
29454
|
+
let d = contour_merge(n.contour, kid.contour);
|
|
29455
|
+
kid.off_y = d + h;
|
|
29456
|
+
kid.off_x = 0;
|
|
29457
|
+
h = kid.ext + dist;
|
|
29458
|
+
span += d + h;
|
|
29459
|
+
}
|
|
29460
|
+
let gap = pad + level_distance;
|
|
29461
|
+
let y2 = (span - n.ext) / 2 - pad;
|
|
29462
|
+
let y1 = y2 + n.ext + 2 * pad - span;
|
|
29463
|
+
first.off_x = gap + n.len;
|
|
29464
|
+
first.off_y = y1;
|
|
29465
|
+
n.contour.upper_head = contour_line(n.len, 0, contour_line(gap, y1, n.contour.upper_head));
|
|
29466
|
+
n.contour.lower_head = contour_line(n.len, 0, contour_line(gap, y2, n.contour.lower_head));
|
|
29467
|
+
}
|
|
29468
|
+
let root_of = /* @__PURE__ */ new Map();
|
|
29469
|
+
for (let id of order) {
|
|
29470
|
+
let n = tn.get(id);
|
|
29471
|
+
if (!root_of.has(id)) root_of.set(id, id);
|
|
29472
|
+
let kids = t.children.get(id) || [];
|
|
29473
|
+
if (!kids.length) continue;
|
|
29474
|
+
let running = n.y + tn.get(kids[0]).off_y;
|
|
29475
|
+
tn.get(kids[0]).y = running;
|
|
29476
|
+
root_of.set(kids[0], root_of.get(id));
|
|
29477
|
+
for (let k = 1; k < kids.length; k++) {
|
|
29478
|
+
let kid = tn.get(kids[k]);
|
|
29479
|
+
kid.y = running + kid.off_y;
|
|
29480
|
+
running = kid.y;
|
|
29481
|
+
root_of.set(kids[k], root_of.get(id));
|
|
29482
|
+
}
|
|
29483
|
+
}
|
|
29484
|
+
let lo = /* @__PURE__ */ new Map();
|
|
29485
|
+
let hi = /* @__PURE__ */ new Map();
|
|
29486
|
+
for (let id of order) {
|
|
29487
|
+
let r = root_of.get(id);
|
|
29488
|
+
let n = tn.get(id);
|
|
29489
|
+
lo.set(r, Math.min(lo.has(r) ? lo.get(r) : Infinity, n.y));
|
|
29490
|
+
hi.set(r, Math.max(hi.has(r) ? hi.get(r) : -Infinity, n.y + n.ext));
|
|
29491
|
+
}
|
|
29492
|
+
let shift = /* @__PURE__ */ new Map();
|
|
29493
|
+
let top = 0;
|
|
29494
|
+
for (let r of t.roots) {
|
|
29495
|
+
shift.set(r, top - lo.get(r));
|
|
29496
|
+
top += hi.get(r) - lo.get(r) + o.nodesep * 2;
|
|
29497
|
+
}
|
|
29498
|
+
for (let id of order) {
|
|
29499
|
+
let d = t.depth.get(id);
|
|
29500
|
+
let n = tn.get(id);
|
|
29501
|
+
let y = n.y + shift.get(root_of.get(id));
|
|
29502
|
+
pos.set(id, {
|
|
29503
|
+
x: col_x[d] + col_w[d] / 2,
|
|
29504
|
+
y: y + n.ext / 2
|
|
29505
|
+
});
|
|
29506
|
+
}
|
|
29507
|
+
return pos;
|
|
29508
|
+
}
|
|
29312
29509
|
function extent_at(n, a) {
|
|
29313
29510
|
if (!n) return 0;
|
|
29314
29511
|
return Math.abs(n.w * Math.cos(a)) + Math.abs(n.h * Math.sin(a));
|
|
@@ -45442,7 +45639,7 @@ var _excluded$1 = ["style"];
|
|
|
45442
45639
|
/**
|
|
45443
45640
|
* Polyline inherits the marker-related capabilities of Polygon.
|
|
45444
45641
|
*/
|
|
45445
|
-
var Polyline = /*#__PURE__*/ function(_Polygon) {
|
|
45642
|
+
var Polyline$1 = /*#__PURE__*/ function(_Polygon) {
|
|
45446
45643
|
function Polyline() {
|
|
45447
45644
|
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, style = _ref.style, rest = _objectWithoutProperties(_ref, _excluded$1);
|
|
45448
45645
|
_classCallCheck(this, Polyline);
|
|
@@ -45534,7 +45731,7 @@ var Polyline = /*#__PURE__*/ function(_Polygon) {
|
|
|
45534
45731
|
}
|
|
45535
45732
|
]);
|
|
45536
45733
|
}(Polygon);
|
|
45537
|
-
Polyline.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(Polygon.PARSED_STYLE_LIST), [
|
|
45734
|
+
Polyline$1.PARSED_STYLE_LIST = new Set([].concat(_toConsumableArray(Polygon.PARSED_STYLE_LIST), [
|
|
45538
45735
|
"points",
|
|
45539
45736
|
"markerStart",
|
|
45540
45737
|
"markerMid",
|
|
@@ -56292,6 +56489,12 @@ var _layouts = {
|
|
|
56292
56489
|
nodesep: 18,
|
|
56293
56490
|
ranksep: 90
|
|
56294
56491
|
},
|
|
56492
|
+
"compact-tree": {
|
|
56493
|
+
type: "treedb-compact",
|
|
56494
|
+
direction: "TB",
|
|
56495
|
+
nodesep: 18,
|
|
56496
|
+
ranksep: 90
|
|
56497
|
+
},
|
|
56295
56498
|
"dagre": {
|
|
56296
56499
|
type: "dagre",
|
|
56297
56500
|
rankdir: "LR",
|
|
@@ -56363,6 +56566,12 @@ var attrs_table$4 = [
|
|
|
56363
56566
|
SDATA(data_type_t.DTP_STRING, "main_topic", 0, "", "The topic the tree hangs from; empty = deduced (the one whose hooks reach the most others). Its parentless records are the roots; a parentless record of a topic linked to it is LOOSE and shown only on request"),
|
|
56364
56567
|
SDATA(data_type_t.DTP_LIST, "loose_topics", 0, "[]", "Topics whose loose records (no parent, in a topic the schema hangs from the main one) are shown as roots"),
|
|
56365
56568
|
SDATA(data_type_t.DTP_STRING, "node_mode", 0, "expanded", "How a record is drawn: `expanded` = the card with its pills and ports; `compact` = a one-line pill with the name and small ports; `shape` = a figure of the topic's colour (square, circle, diamond... per node or topic, from the node properties), no ports, no text -- the topology alone. One node can be toggled against it (EV_TOGGLE_NODE_MODE)"),
|
|
56569
|
+
SDATA(data_type_t.DTP_STRING, "edge_shape", 0, "curved", "How an edge is drawn: `curved` (the default) or `elbow` -- straight out of its port to the channel between the two rows, along it, and straight into the other port: the bus of an org chart, as mxGraph drew its trees. Layouts with no rows (`rowless_layouts`) keep the curve"),
|
|
56570
|
+
SDATA(data_type_t.DTP_LIST, "rowless_layouts", sdata_flag_t.SDF_RD, JSON.stringify([
|
|
56571
|
+
"radial",
|
|
56572
|
+
"d3-force",
|
|
56573
|
+
"force-atlas2"
|
|
56574
|
+
]), "Layouts with no rows for an elbow to run between: their edges stay curved whatever `edge_shape` says (read-only, for the parent to query)"),
|
|
56366
56575
|
SDATA(data_type_t.DTP_BOOLEAN, "node_labels", 0, true, "A `shape` node says its name under the figure. Off, it is a coloured figure and nothing else"),
|
|
56367
56576
|
SDATA(data_type_t.DTP_BOOLEAN, "confirm_delete_node", 0, true, "Ask confirmation before deleting a node"),
|
|
56368
56577
|
SDATA(data_type_t.DTP_BOOLEAN, "confirm_unlink_edge", 0, true, "Ask confirmation before unlinking an edge"),
|
|
@@ -56613,6 +56822,9 @@ function register_layouts(gobj) {
|
|
|
56613
56822
|
_g6_extensions_registered = true;
|
|
56614
56823
|
register(ExtensionCategory.LAYOUT, "manual", ManualLayout);
|
|
56615
56824
|
register(ExtensionCategory.LAYOUT, "treedb-tree", TreedbTreeLayout);
|
|
56825
|
+
register(ExtensionCategory.LAYOUT, "treedb-compact", TreedbCompactLayout);
|
|
56826
|
+
register(ExtensionCategory.EDGE, "treedb-elbow-v", TreedbElbowV);
|
|
56827
|
+
register(ExtensionCategory.EDGE, "treedb-elbow-h", TreedbElbowH);
|
|
56616
56828
|
register(ExtensionCategory.LAYOUT, "treedb-radial", TreedbRadialLayout);
|
|
56617
56829
|
register(ExtensionCategory.NODE, "light", LightNode);
|
|
56618
56830
|
register(ExtensionCategory.NODE, "treedb-card", TreedbCard);
|
|
@@ -57305,7 +57517,10 @@ function layout_direction(gobj) {
|
|
|
57305
57517
|
return str_in_list(LR_LAYOUTS, gobj.priv.layout) ? "LR" : "TB";
|
|
57306
57518
|
}
|
|
57307
57519
|
function edge_type_for(gobj) {
|
|
57308
|
-
|
|
57520
|
+
let lr = layout_direction(gobj) === "LR";
|
|
57521
|
+
let rowless = gobj_read_attr(gobj, "rowless_layouts") || [];
|
|
57522
|
+
if (gobj_read_str_attr(gobj, "edge_shape") === "elbow" && !str_in_list(rowless, gobj.priv.layout)) return lr ? "treedb-elbow-h" : "treedb-elbow-v";
|
|
57523
|
+
return lr ? "cubic-horizontal" : "cubic";
|
|
57309
57524
|
}
|
|
57310
57525
|
/************************************************************
|
|
57311
57526
|
* Where the ports sit, by direction: fkeys (the way in from a
|
|
@@ -58780,6 +58995,44 @@ var TreedbTreeLayout = class extends BaseLayout {
|
|
|
58780
58995
|
return treedb_layout_output(layout_tree(input.nodes, input.edges, options));
|
|
58781
58996
|
}
|
|
58782
58997
|
};
|
|
58998
|
+
/************************************************************
|
|
58999
|
+
* An ELBOW edge, the way mxGraph drew a tree: straight out of
|
|
59000
|
+
* the parent's port to the channel half way to the child, along
|
|
59001
|
+
* it, and straight into the child's port. The children of one
|
|
59002
|
+
* hook sit on one row and leave by one port, so they share the
|
|
59003
|
+
* channel and the lines read as one bus.
|
|
59004
|
+
*
|
|
59005
|
+
* Computed on every draw from where the two ends ARE, so a
|
|
59006
|
+
* dragged card, a fold or a layout needs nothing else. `-v` runs
|
|
59007
|
+
* between rows (top to bottom), `-h` between columns.
|
|
59008
|
+
************************************************************/
|
|
59009
|
+
var ELBOW_RADIUS = 6;
|
|
59010
|
+
var TreedbElbowV = class extends Polyline {
|
|
59011
|
+
getControlPoints(attributes) {
|
|
59012
|
+
let [s, t] = this.getEndpoints(attributes, false);
|
|
59013
|
+
let mid = (s[1] + t[1]) / 2;
|
|
59014
|
+
return [[s[0], mid], [t[0], mid]];
|
|
59015
|
+
}
|
|
59016
|
+
getKeyPath(attributes) {
|
|
59017
|
+
return super.getKeyPath(Object.assign({}, attributes, { radius: attributes.radius || ELBOW_RADIUS }));
|
|
59018
|
+
}
|
|
59019
|
+
};
|
|
59020
|
+
var TreedbElbowH = class extends Polyline {
|
|
59021
|
+
getControlPoints(attributes) {
|
|
59022
|
+
let [s, t] = this.getEndpoints(attributes, false);
|
|
59023
|
+
let mid = (s[0] + t[0]) / 2;
|
|
59024
|
+
return [[mid, s[1]], [mid, t[1]]];
|
|
59025
|
+
}
|
|
59026
|
+
getKeyPath(attributes) {
|
|
59027
|
+
return super.getKeyPath(Object.assign({}, attributes, { radius: attributes.radius || ELBOW_RADIUS }));
|
|
59028
|
+
}
|
|
59029
|
+
};
|
|
59030
|
+
var TreedbCompactLayout = class extends BaseLayout {
|
|
59031
|
+
async execute(data, options) {
|
|
59032
|
+
let input = treedb_layout_input(data);
|
|
59033
|
+
return treedb_layout_output(layout_compact(input.nodes, input.edges, options));
|
|
59034
|
+
}
|
|
59035
|
+
};
|
|
58783
59036
|
var TreedbRadialLayout = class extends BaseLayout {
|
|
58784
59037
|
async execute(data, options) {
|
|
58785
59038
|
let input = treedb_layout_input(data);
|
|
@@ -63217,6 +63470,20 @@ function ac_set_node_labels(gobj, event, kw, src) {
|
|
|
63217
63470
|
return 0;
|
|
63218
63471
|
}
|
|
63219
63472
|
/************************************************************
|
|
63473
|
+
* Curved or elbow edges (the host's toggle). Nothing moves: every
|
|
63474
|
+
* edge takes the type that goes with the shape and the layout,
|
|
63475
|
+
* and draws again.
|
|
63476
|
+
************************************************************/
|
|
63477
|
+
function ac_set_edge_shape(gobj, event, kw, src) {
|
|
63478
|
+
let priv = gobj.priv;
|
|
63479
|
+
let shape = kw && kw.edge_shape === "elbow" ? "elbow" : "curved";
|
|
63480
|
+
gobj_write_str_attr(gobj, "edge_shape", shape);
|
|
63481
|
+
if (!priv.graph || !priv.graph_rendered) return 0;
|
|
63482
|
+
apply_layout_direction(gobj);
|
|
63483
|
+
graph_draw(gobj);
|
|
63484
|
+
return 0;
|
|
63485
|
+
}
|
|
63486
|
+
/************************************************************
|
|
63220
63487
|
* ONE node opened or closed against the mode (a double click,
|
|
63221
63488
|
* or the context menu). It holds still on screen while the
|
|
63222
63489
|
* rest of the graph makes room, as a fold does.
|
|
@@ -63776,6 +64043,11 @@ function create_gclass$4(gclass_name) {
|
|
|
63776
64043
|
ac_set_node_labels,
|
|
63777
64044
|
null
|
|
63778
64045
|
],
|
|
64046
|
+
[
|
|
64047
|
+
"EV_SET_EDGE_SHAPE",
|
|
64048
|
+
ac_set_edge_shape,
|
|
64049
|
+
null
|
|
64050
|
+
],
|
|
63779
64051
|
[
|
|
63780
64052
|
"EV_TOGGLE_NODE_MODE",
|
|
63781
64053
|
ac_toggle_node_mode,
|
|
@@ -63897,6 +64169,7 @@ function create_gclass$4(gclass_name) {
|
|
|
63897
64169
|
["EV_SET_LOOSE_TOPICS", 0],
|
|
63898
64170
|
["EV_SET_NODE_MODE", 0],
|
|
63899
64171
|
["EV_SET_NODE_LABELS", 0],
|
|
64172
|
+
["EV_SET_EDGE_SHAPE", 0],
|
|
63900
64173
|
["EV_TOGGLE_NODE_MODE", 0],
|
|
63901
64174
|
["EV_NODE_DBLCLICK", 0],
|
|
63902
64175
|
["EV_LEGEND_STATE", event_flag_t.EVF_OUTPUT_EVENT],
|
|
@@ -63973,6 +64246,7 @@ var attrs_table$3 = [
|
|
|
63973
64246
|
SDATA(data_type_t.DTP_STRING, "main_topic", sdata_flag_t.SDF_PERSIST, "", "The topic the tree hangs from; empty = deduced by the graph. User preference, per treedb"),
|
|
63974
64247
|
SDATA(data_type_t.DTP_LIST, "loose_topics", sdata_flag_t.SDF_PERSIST, "[]", "Topics whose LOOSE records (no parent) are shown. User preference, per treedb"),
|
|
63975
64248
|
SDATA(data_type_t.DTP_STRING, "node_mode", sdata_flag_t.SDF_PERSIST, "expanded", "How the records are drawn: `expanded` = the cards with their pills and ports, `compact` = one-line pills with the name, `shape` = coloured figures, the topology alone. User preference"),
|
|
64249
|
+
SDATA(data_type_t.DTP_STRING, "edge_shape", sdata_flag_t.SDF_PERSIST, "curved", "How the edges are drawn: `curved` or `elbow` (the bus of an org chart). User preference"),
|
|
63976
64250
|
SDATA(data_type_t.DTP_BOOLEAN, "node_labels", sdata_flag_t.SDF_PERSIST, true, "A `shape` node says its name under its figure. User preference"),
|
|
63977
64251
|
SDATA(data_type_t.DTP_DICT, "camera", sdata_flag_t.SDF_PERSIST, "{}", "Where the reader left the viewport: {zoom, x, y}. Handed to the engine on creation and written back when a move settles, so the graph opens where it was left. User preference, per treedb"),
|
|
63978
64252
|
SDATA(data_type_t.DTP_INTEGER, "fold_level", sdata_flag_t.SDF_PERSIST, 0, "The level of the MAIN tree the toolbar's stepper stands on: 1 = the main topic's roots, N = N-1 levels under them; 0 = never stepped, `expand_depth`. Handed to the engine on creation, so the graph opens at the level it was left. User preference, per treedb"),
|
|
@@ -64065,6 +64339,7 @@ function mt_create$3(gobj) {
|
|
|
64065
64339
|
loose_topics: gobj_read_attr(gobj, "loose_topics") || [],
|
|
64066
64340
|
node_mode: gobj_read_str_attr(gobj, "node_mode") || "expanded",
|
|
64067
64341
|
node_labels: gobj_read_bool_attr(gobj, "node_labels"),
|
|
64342
|
+
edge_shape: gobj_read_str_attr(gobj, "edge_shape") || "curved",
|
|
64068
64343
|
camera: gobj_read_attr(gobj, "camera") || {}
|
|
64069
64344
|
}, gobj);
|
|
64070
64345
|
populate_nodes_tree_options(gobj);
|
|
@@ -64251,6 +64526,7 @@ function option_label(name) {
|
|
|
64251
64526
|
case "edition": return t("edition");
|
|
64252
64527
|
case "manual": return t("manual");
|
|
64253
64528
|
case "treedb-tree": return t("treedb-tree");
|
|
64529
|
+
case "compact-tree": return t("compact-tree");
|
|
64254
64530
|
case "radial": return t("radial");
|
|
64255
64531
|
case "dagre": return t("dagre");
|
|
64256
64532
|
case "antv-dagre": return t("antv-dagre");
|
|
@@ -64274,58 +64550,82 @@ function option_label(name) {
|
|
|
64274
64550
|
* its context menu (the child's business).
|
|
64275
64551
|
************************************************************/
|
|
64276
64552
|
function node_shape_items(gobj, wide) {
|
|
64277
|
-
return [
|
|
64278
|
-
|
|
64279
|
-
|
|
64280
|
-
|
|
64281
|
-
|
|
64282
|
-
|
|
64283
|
-
|
|
64284
|
-
|
|
64285
|
-
|
|
64286
|
-
|
|
64287
|
-
|
|
64288
|
-
|
|
64289
|
-
|
|
64290
|
-
|
|
64291
|
-
|
|
64292
|
-
|
|
64293
|
-
|
|
64553
|
+
return [
|
|
64554
|
+
[
|
|
64555
|
+
"div",
|
|
64556
|
+
{
|
|
64557
|
+
class: "GRAPH_NODE_MODE buttons has-addons",
|
|
64558
|
+
style: "margin:0 0 0 .5rem; flex:0 0 auto; flex-wrap:nowrap;"
|
|
64559
|
+
},
|
|
64560
|
+
NODE_MODES.map((mode) => {
|
|
64561
|
+
let key = NODE_MODE_LABELS[mode];
|
|
64562
|
+
return [
|
|
64563
|
+
"button",
|
|
64564
|
+
{
|
|
64565
|
+
class: "GRAPH_NODE_MODE_BTN button",
|
|
64566
|
+
type: "button",
|
|
64567
|
+
"data-mode": mode,
|
|
64568
|
+
style: {
|
|
64569
|
+
height: wide,
|
|
64570
|
+
width: "2.5em"
|
|
64571
|
+
},
|
|
64572
|
+
title: t(key),
|
|
64573
|
+
"data-i18n-title": key,
|
|
64574
|
+
"aria-label": t(key),
|
|
64575
|
+
"data-i18n-aria-label": key,
|
|
64576
|
+
"aria-pressed": "false"
|
|
64294
64577
|
},
|
|
64295
|
-
|
|
64296
|
-
|
|
64297
|
-
|
|
64298
|
-
|
|
64299
|
-
|
|
64578
|
+
yui_toolbar_icon(NODE_MODE_ICONS[mode]),
|
|
64579
|
+
{ click: (evt) => {
|
|
64580
|
+
evt.stopPropagation();
|
|
64581
|
+
gobj_send_event(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
|
|
64582
|
+
} }
|
|
64583
|
+
];
|
|
64584
|
+
})
|
|
64585
|
+
],
|
|
64586
|
+
[
|
|
64587
|
+
"button",
|
|
64588
|
+
{
|
|
64589
|
+
class: "GRAPH_NODE_LABELS button",
|
|
64590
|
+
type: "button",
|
|
64591
|
+
style: {
|
|
64592
|
+
height: wide,
|
|
64593
|
+
width: "2.5em"
|
|
64300
64594
|
},
|
|
64301
|
-
|
|
64302
|
-
|
|
64303
|
-
|
|
64304
|
-
|
|
64305
|
-
|
|
64306
|
-
];
|
|
64307
|
-
})
|
|
64308
|
-
], [
|
|
64309
|
-
"button",
|
|
64310
|
-
{
|
|
64311
|
-
class: "GRAPH_NODE_LABELS button",
|
|
64312
|
-
type: "button",
|
|
64313
|
-
style: {
|
|
64314
|
-
height: wide,
|
|
64315
|
-
width: "2.5em"
|
|
64595
|
+
title: t("node labels"),
|
|
64596
|
+
"data-i18n-title": "node labels",
|
|
64597
|
+
"aria-label": t("node labels"),
|
|
64598
|
+
"data-i18n-aria-label": "node labels",
|
|
64599
|
+
"aria-pressed": "false"
|
|
64316
64600
|
},
|
|
64317
|
-
|
|
64318
|
-
|
|
64319
|
-
|
|
64320
|
-
|
|
64321
|
-
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
|
|
64325
|
-
|
|
64326
|
-
|
|
64327
|
-
|
|
64328
|
-
|
|
64601
|
+
yui_toolbar_icon("yi-font"),
|
|
64602
|
+
{ click: (evt) => {
|
|
64603
|
+
evt.stopPropagation();
|
|
64604
|
+
gobj_send_event(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
|
|
64605
|
+
} }
|
|
64606
|
+
],
|
|
64607
|
+
[
|
|
64608
|
+
"button",
|
|
64609
|
+
{
|
|
64610
|
+
class: "GRAPH_EDGE_ELBOW button",
|
|
64611
|
+
type: "button",
|
|
64612
|
+
style: {
|
|
64613
|
+
height: wide,
|
|
64614
|
+
width: "2.5em"
|
|
64615
|
+
},
|
|
64616
|
+
title: t("elbow edges"),
|
|
64617
|
+
"data-i18n-title": "elbow edges",
|
|
64618
|
+
"aria-label": t("elbow edges"),
|
|
64619
|
+
"data-i18n-aria-label": "elbow edges",
|
|
64620
|
+
"aria-pressed": "false"
|
|
64621
|
+
},
|
|
64622
|
+
yui_toolbar_icon("yi-diagram-project"),
|
|
64623
|
+
{ click: (evt) => {
|
|
64624
|
+
evt.stopPropagation();
|
|
64625
|
+
gobj_send_event(gobj, "EV_TOGGLE_EDGE_SHAPE", {}, gobj);
|
|
64626
|
+
} }
|
|
64627
|
+
]
|
|
64628
|
+
];
|
|
64329
64629
|
}
|
|
64330
64630
|
var NODE_MODES = [
|
|
64331
64631
|
"expanded",
|
|
@@ -64358,6 +64658,16 @@ function refresh_node_shape_buttons(gobj, $root) {
|
|
|
64358
64658
|
$labels.setAttribute("aria-pressed", labels ? "true" : "false");
|
|
64359
64659
|
$labels.disabled = mode !== "shape";
|
|
64360
64660
|
}
|
|
64661
|
+
let elbow = gobj_read_str_attr(gobj, "edge_shape") === "elbow";
|
|
64662
|
+
set_pressed_state($root, ".GRAPH_EDGE_ELBOW", elbow);
|
|
64663
|
+
let $elbow = $root.querySelector(".GRAPH_EDGE_ELBOW");
|
|
64664
|
+
if ($elbow) {
|
|
64665
|
+
$elbow.setAttribute("aria-pressed", elbow ? "true" : "false");
|
|
64666
|
+
let child = gobj.priv.gobj_nodes_tree;
|
|
64667
|
+
let rowless = child ? gobj_read_attr(child, "rowless_layouts") || [] : [];
|
|
64668
|
+
let layout = child ? gobj_read_str_attr(child, "layout") : "";
|
|
64669
|
+
$elbow.disabled = rowless.includes(layout);
|
|
64670
|
+
}
|
|
64361
64671
|
}
|
|
64362
64672
|
/************************************************************
|
|
64363
64673
|
* The fold STEPPER: one level less, where the tree stands, one
|
|
@@ -64906,6 +65216,7 @@ function populate_nodes_tree_options(gobj) {
|
|
|
64906
65216
|
let current_layout = gobj_read_str_attr(priv.gobj_nodes_tree, "layout");
|
|
64907
65217
|
if (current_layout) $layout_select.value = current_layout;
|
|
64908
65218
|
refresh_layout_stepper(gobj);
|
|
65219
|
+
refresh_node_shape_buttons(gobj, $container);
|
|
64909
65220
|
}
|
|
64910
65221
|
let $operation_mode_select = $container.querySelector(".GRAPH_MODE_SELECT");
|
|
64911
65222
|
$operation_mode_select.value = priv.operation_mode;
|
|
@@ -65599,6 +65910,7 @@ function ac_set_layout(gobj, event, kw, src) {
|
|
|
65599
65910
|
$layout_select.value = priv.layout;
|
|
65600
65911
|
gobj_send_event(priv.gobj_nodes_tree, "EV_SET_LAYOUT", { layout }, gobj);
|
|
65601
65912
|
refresh_layout_stepper(gobj);
|
|
65913
|
+
refresh_node_shape_buttons(gobj, priv.$container);
|
|
65602
65914
|
return 0;
|
|
65603
65915
|
}
|
|
65604
65916
|
/************************************************************
|
|
@@ -65950,6 +66262,7 @@ function ac_layout_autoset(gobj, event, kw, src) {
|
|
|
65950
66262
|
if (!$select || !layout) return 0;
|
|
65951
66263
|
$select.value = layout;
|
|
65952
66264
|
refresh_layout_stepper(gobj);
|
|
66265
|
+
refresh_node_shape_buttons(gobj, $container);
|
|
65953
66266
|
return 0;
|
|
65954
66267
|
}
|
|
65955
66268
|
/************************************************************
|
|
@@ -66022,6 +66335,15 @@ function ac_set_node_mode(gobj, event, kw, src) {
|
|
|
66022
66335
|
if (priv.gobj_nodes_tree) gobj_send_event(priv.gobj_nodes_tree, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
|
|
66023
66336
|
return 0;
|
|
66024
66337
|
}
|
|
66338
|
+
function ac_toggle_edge_shape(gobj, event, kw, src) {
|
|
66339
|
+
let priv = gobj.priv;
|
|
66340
|
+
let shape = gobj_read_str_attr(gobj, "edge_shape") === "elbow" ? "curved" : "elbow";
|
|
66341
|
+
gobj_write_str_attr(gobj, "edge_shape", shape);
|
|
66342
|
+
gobj_save_persistent_attrs(gobj, "edge_shape");
|
|
66343
|
+
refresh_node_shape_buttons(gobj, priv.$container);
|
|
66344
|
+
if (priv.gobj_nodes_tree) gobj_send_event(priv.gobj_nodes_tree, "EV_SET_EDGE_SHAPE", { edge_shape: shape }, gobj);
|
|
66345
|
+
return 0;
|
|
66346
|
+
}
|
|
66025
66347
|
function ac_toggle_node_labels(gobj, event, kw, src) {
|
|
66026
66348
|
let priv = gobj.priv;
|
|
66027
66349
|
let labels = !gobj_read_bool_attr(gobj, "node_labels");
|
|
@@ -66266,6 +66588,11 @@ function create_gclass$3(gclass_name) {
|
|
|
66266
66588
|
ac_toggle_node_labels,
|
|
66267
66589
|
null
|
|
66268
66590
|
],
|
|
66591
|
+
[
|
|
66592
|
+
"EV_TOGGLE_EDGE_SHAPE",
|
|
66593
|
+
ac_toggle_edge_shape,
|
|
66594
|
+
null
|
|
66595
|
+
],
|
|
66269
66596
|
[
|
|
66270
66597
|
"EV_LAYOUT_AUTOSET",
|
|
66271
66598
|
ac_layout_autoset,
|
|
@@ -66343,6 +66670,7 @@ function create_gclass$3(gclass_name) {
|
|
|
66343
66670
|
["EV_COLLAPSE_LEVEL", 0],
|
|
66344
66671
|
["EV_SET_NODE_MODE", 0],
|
|
66345
66672
|
["EV_TOGGLE_NODE_LABELS", 0],
|
|
66673
|
+
["EV_TOGGLE_EDGE_SHAPE", 0],
|
|
66346
66674
|
["EV_FIND_RESULT", 0],
|
|
66347
66675
|
["EV_LAYOUT_AUTOSET", 0],
|
|
66348
66676
|
["EV_CAMERA_CHANGED", 0],
|