@yuneta/gobj-ui 7.5.0 → 7.5.2
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/dist/gobj-ui.cjs.js +11 -4
- package/dist/gobj-ui.es.js +11 -4
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +32 -4
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -52922,7 +52922,8 @@ var PRIVATE_DATA$1 = {
|
|
|
52922
52922
|
_focus_topic: null,
|
|
52923
52923
|
_focus_ids: [],
|
|
52924
52924
|
_pending_focus_topic: null,
|
|
52925
|
-
_pending_find: null
|
|
52925
|
+
_pending_find: null,
|
|
52926
|
+
_layout_asked: ""
|
|
52926
52927
|
};
|
|
52927
52928
|
var __gclass__$1 = null;
|
|
52928
52929
|
/******************************
|
|
@@ -52933,6 +52934,7 @@ var __gclass__$1 = null;
|
|
|
52933
52934
|
***************************************************************/
|
|
52934
52935
|
function mt_create$1(gobj) {
|
|
52935
52936
|
let priv = gobj.priv;
|
|
52937
|
+
priv._layout_asked = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "layout") || "";
|
|
52936
52938
|
let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
|
|
52937
52939
|
if (!subscriber) subscriber = (0, _yuneta_gobj_js.gobj_parent)(gobj);
|
|
52938
52940
|
(0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
|
|
@@ -55704,16 +55706,21 @@ function show_node_detail_popover(gobj, node_id) {
|
|
|
55704
55706
|
* Saved positions live in `__graphs__` (per topic, per node) and, on
|
|
55705
55707
|
* older data, in a `_geometry` on the record itself. Both are read.
|
|
55706
55708
|
************************************************************/
|
|
55709
|
+
function geometry_has_position(g) {
|
|
55710
|
+
if (!(0, _yuneta_gobj_js.is_object)(g)) return false;
|
|
55711
|
+
return (0, _yuneta_gobj_js.is_number)(g.x) || (0, _yuneta_gobj_js.is_number)(g.y);
|
|
55712
|
+
}
|
|
55707
55713
|
function has_saved_geometry(gobj) {
|
|
55708
55714
|
let priv = gobj.priv;
|
|
55709
55715
|
for (let topic of Object.keys(priv._graph_properties || {})) {
|
|
55710
55716
|
let props = priv._graph_properties[topic];
|
|
55711
|
-
if (props
|
|
55717
|
+
if (!props || !(0, _yuneta_gobj_js.is_object)(props.nodes)) continue;
|
|
55718
|
+
for (let node_id of Object.keys(props.nodes)) if (geometry_has_position(props.nodes[node_id])) return true;
|
|
55712
55719
|
}
|
|
55713
55720
|
for (let topic of Object.keys(priv.records || {})) {
|
|
55714
55721
|
let records = priv.records[topic];
|
|
55715
55722
|
if (!(0, _yuneta_gobj_js.is_array)(records)) continue;
|
|
55716
|
-
for (let record of records) if (record && (
|
|
55723
|
+
for (let record of records) if (record && geometry_has_position(record._geometry)) return true;
|
|
55717
55724
|
}
|
|
55718
55725
|
return false;
|
|
55719
55726
|
}
|
|
@@ -55734,7 +55741,7 @@ function has_saved_geometry(gobj) {
|
|
|
55734
55741
|
************************************************************/
|
|
55735
55742
|
function auto_layout(gobj) {
|
|
55736
55743
|
let priv = gobj.priv;
|
|
55737
|
-
if (priv.
|
|
55744
|
+
if (priv._layout_asked) return;
|
|
55738
55745
|
if (has_saved_geometry(gobj)) return;
|
|
55739
55746
|
if (!priv.graph) return;
|
|
55740
55747
|
let name = "dagre";
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -52909,7 +52909,8 @@ var PRIVATE_DATA$1 = {
|
|
|
52909
52909
|
_focus_topic: null,
|
|
52910
52910
|
_focus_ids: [],
|
|
52911
52911
|
_pending_focus_topic: null,
|
|
52912
|
-
_pending_find: null
|
|
52912
|
+
_pending_find: null,
|
|
52913
|
+
_layout_asked: ""
|
|
52913
52914
|
};
|
|
52914
52915
|
var __gclass__$1 = null;
|
|
52915
52916
|
/******************************
|
|
@@ -52920,6 +52921,7 @@ var __gclass__$1 = null;
|
|
|
52920
52921
|
***************************************************************/
|
|
52921
52922
|
function mt_create$1(gobj) {
|
|
52922
52923
|
let priv = gobj.priv;
|
|
52924
|
+
priv._layout_asked = gobj_read_str_attr(gobj, "layout") || "";
|
|
52923
52925
|
let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
|
|
52924
52926
|
if (!subscriber) subscriber = gobj_parent(gobj);
|
|
52925
52927
|
gobj_subscribe_event(gobj, null, {}, subscriber);
|
|
@@ -55691,16 +55693,21 @@ function show_node_detail_popover(gobj, node_id) {
|
|
|
55691
55693
|
* Saved positions live in `__graphs__` (per topic, per node) and, on
|
|
55692
55694
|
* older data, in a `_geometry` on the record itself. Both are read.
|
|
55693
55695
|
************************************************************/
|
|
55696
|
+
function geometry_has_position(g) {
|
|
55697
|
+
if (!is_object(g)) return false;
|
|
55698
|
+
return is_number(g.x) || is_number(g.y);
|
|
55699
|
+
}
|
|
55694
55700
|
function has_saved_geometry(gobj) {
|
|
55695
55701
|
let priv = gobj.priv;
|
|
55696
55702
|
for (let topic of Object.keys(priv._graph_properties || {})) {
|
|
55697
55703
|
let props = priv._graph_properties[topic];
|
|
55698
|
-
if (props
|
|
55704
|
+
if (!props || !is_object(props.nodes)) continue;
|
|
55705
|
+
for (let node_id of Object.keys(props.nodes)) if (geometry_has_position(props.nodes[node_id])) return true;
|
|
55699
55706
|
}
|
|
55700
55707
|
for (let topic of Object.keys(priv.records || {})) {
|
|
55701
55708
|
let records = priv.records[topic];
|
|
55702
55709
|
if (!is_array(records)) continue;
|
|
55703
|
-
for (let record of records) if (record &&
|
|
55710
|
+
for (let record of records) if (record && geometry_has_position(record._geometry)) return true;
|
|
55704
55711
|
}
|
|
55705
55712
|
return false;
|
|
55706
55713
|
}
|
|
@@ -55721,7 +55728,7 @@ function has_saved_geometry(gobj) {
|
|
|
55721
55728
|
************************************************************/
|
|
55722
55729
|
function auto_layout(gobj) {
|
|
55723
55730
|
let priv = gobj.priv;
|
|
55724
|
-
if (priv.
|
|
55731
|
+
if (priv._layout_asked) return;
|
|
55725
55732
|
if (has_saved_geometry(gobj)) return;
|
|
55726
55733
|
if (!priv.graph) return;
|
|
55727
55734
|
let name = "dagre";
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
is_array,
|
|
48
48
|
empty_string,
|
|
49
49
|
is_object,
|
|
50
|
+
is_number,
|
|
50
51
|
kw_get_int,
|
|
51
52
|
kw_get_str,
|
|
52
53
|
kw_get_dict_value,
|
|
@@ -291,6 +292,7 @@ let PRIVATE_DATA = {
|
|
|
291
292
|
_focus_ids: [], // node ids carrying the focus 'active' state
|
|
292
293
|
_pending_focus_topic: null, // focus requested before data was loaded
|
|
293
294
|
_pending_find: null, // find requested before data was loaded
|
|
295
|
+
_layout_asked: "", // layout the host asked for at create (see mt_create)
|
|
294
296
|
};
|
|
295
297
|
|
|
296
298
|
let __gclass__ = null;
|
|
@@ -312,6 +314,15 @@ function mt_create(gobj)
|
|
|
312
314
|
{
|
|
313
315
|
let priv = gobj.priv;
|
|
314
316
|
|
|
317
|
+
/* What the HOST asked for, captured before anything overwrites it.
|
|
318
|
+
*
|
|
319
|
+
* `gobj_write_attr()` also writes the private field of the same name,
|
|
320
|
+
* so the moment select_layout() resolves the empty preference to
|
|
321
|
+
* `manual` and stores it, `priv.layout` reads "manual" and no longer
|
|
322
|
+
* says whether anybody ever chose it. auto_layout() needs exactly that
|
|
323
|
+
* distinction. */
|
|
324
|
+
priv._layout_asked = gobj_read_str_attr(gobj, "layout") || "";
|
|
325
|
+
|
|
315
326
|
/*
|
|
316
327
|
* CHILD subscription model
|
|
317
328
|
*/
|
|
@@ -4489,14 +4500,31 @@ function show_node_detail_popover(gobj, node_id)
|
|
|
4489
4500
|
* Saved positions live in `__graphs__` (per topic, per node) and, on
|
|
4490
4501
|
* older data, in a `_geometry` on the record itself. Both are read.
|
|
4491
4502
|
************************************************************/
|
|
4503
|
+
function geometry_has_position(g)
|
|
4504
|
+
{
|
|
4505
|
+
/* An EMPTY object is not a position. A treedb hands back `_geometry: {}`
|
|
4506
|
+
* for a record nobody ever moved, and a node entry can hold a port size
|
|
4507
|
+
* with no coordinates — both are objects, and taking either for "this
|
|
4508
|
+
* was arranged" is what kept the cascade in place. Only x or y counts. */
|
|
4509
|
+
if(!is_object(g)) {
|
|
4510
|
+
return false;
|
|
4511
|
+
}
|
|
4512
|
+
return is_number(g.x) || is_number(g.y);
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4492
4515
|
function has_saved_geometry(gobj)
|
|
4493
4516
|
{
|
|
4494
4517
|
let priv = gobj.priv;
|
|
4495
4518
|
|
|
4496
4519
|
for(let topic of Object.keys(priv._graph_properties || {})) {
|
|
4497
4520
|
let props = priv._graph_properties[topic];
|
|
4498
|
-
if(props
|
|
4499
|
-
|
|
4521
|
+
if(!props || !is_object(props.nodes)) {
|
|
4522
|
+
continue;
|
|
4523
|
+
}
|
|
4524
|
+
for(let node_id of Object.keys(props.nodes)) {
|
|
4525
|
+
if(geometry_has_position(props.nodes[node_id])) {
|
|
4526
|
+
return true;
|
|
4527
|
+
}
|
|
4500
4528
|
}
|
|
4501
4529
|
}
|
|
4502
4530
|
|
|
@@ -4506,7 +4534,7 @@ function has_saved_geometry(gobj)
|
|
|
4506
4534
|
continue;
|
|
4507
4535
|
}
|
|
4508
4536
|
for(let record of records) {
|
|
4509
|
-
if(record &&
|
|
4537
|
+
if(record && geometry_has_position(record._geometry)) {
|
|
4510
4538
|
return true;
|
|
4511
4539
|
}
|
|
4512
4540
|
}
|
|
@@ -4534,7 +4562,7 @@ function auto_layout(gobj)
|
|
|
4534
4562
|
{
|
|
4535
4563
|
let priv = gobj.priv;
|
|
4536
4564
|
|
|
4537
|
-
if(priv.
|
|
4565
|
+
if(priv._layout_asked) {
|
|
4538
4566
|
return; /* the user picked one for this treedb */
|
|
4539
4567
|
}
|
|
4540
4568
|
if(has_saved_geometry(gobj)) {
|