@yuneta/gobj-ui 7.23.159 → 7.23.161
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 +35 -0
- package/dist/gobj-ui.cjs.js +225 -47
- package/dist/gobj-ui.es.js +225 -47
- package/package.json +1 -1
- package/src/c_yui_treedb_schema.js +134 -10
- package/src/c_yui_treedb_topic_with_form.js +10 -4
- package/src/yui_graph_camera.js +64 -0
package/dist/gobj-ui.es.js
CHANGED
|
@@ -11500,6 +11500,64 @@ function yui_graph_camera_behaviors() {
|
|
|
11500
11500
|
}];
|
|
11501
11501
|
}
|
|
11502
11502
|
/************************************************************
|
|
11503
|
+
* Make the wheel work over HTML nodes too.
|
|
11504
|
+
*
|
|
11505
|
+
* G6's HTML nodes live in a DOM layer BESIDE the canvas
|
|
11506
|
+
* element, not in it, and they forward six pointer events and
|
|
11507
|
+
* not the wheel. `scroll-canvas` listens on the canvas element
|
|
11508
|
+
* and `zoom-canvas` reads G's own wheel event, which is fed
|
|
11509
|
+
* from that same element -- so a wheel over a card reaches
|
|
11510
|
+
* neither, and on a graph drawn with big cards the wheel only
|
|
11511
|
+
* works in the gaps between them.
|
|
11512
|
+
*
|
|
11513
|
+
* The wheel is caught on `$host` (the element G6 was mounted
|
|
11514
|
+
* in) and dispatched again ON the canvas element, carrying the
|
|
11515
|
+
* deltas, the position and the modifiers: both behaviors then
|
|
11516
|
+
* take it exactly as a wheel over empty canvas. Control is
|
|
11517
|
+
* read by G6 from the real keydown, which is still held.
|
|
11518
|
+
*
|
|
11519
|
+
* A wheel whose target is the canvas passes untouched, which
|
|
11520
|
+
* is also what keeps the re-dispatched one from looping. An
|
|
11521
|
+
* element that must scroll by itself (a popover) stops the
|
|
11522
|
+
* wheel before it gets here.
|
|
11523
|
+
*
|
|
11524
|
+
* Returns the function that removes the listener.
|
|
11525
|
+
************************************************************/
|
|
11526
|
+
function yui_graph_forward_wheel(graph, $host) {
|
|
11527
|
+
if (!graph || !$host) return () => {};
|
|
11528
|
+
const on_wheel = (e) => {
|
|
11529
|
+
let dom = null;
|
|
11530
|
+
try {
|
|
11531
|
+
dom = graph.getCanvas().getContextService().getDomElement();
|
|
11532
|
+
} catch (err) {
|
|
11533
|
+
return;
|
|
11534
|
+
}
|
|
11535
|
+
if (!dom || e.target === dom) return;
|
|
11536
|
+
e.preventDefault();
|
|
11537
|
+
e.stopPropagation();
|
|
11538
|
+
dom.dispatchEvent(new WheelEvent("wheel", {
|
|
11539
|
+
deltaX: e.deltaX,
|
|
11540
|
+
deltaY: e.deltaY,
|
|
11541
|
+
deltaZ: e.deltaZ,
|
|
11542
|
+
deltaMode: e.deltaMode,
|
|
11543
|
+
clientX: e.clientX,
|
|
11544
|
+
clientY: e.clientY,
|
|
11545
|
+
screenX: e.screenX,
|
|
11546
|
+
screenY: e.screenY,
|
|
11547
|
+
ctrlKey: e.ctrlKey,
|
|
11548
|
+
shiftKey: e.shiftKey,
|
|
11549
|
+
altKey: e.altKey,
|
|
11550
|
+
metaKey: e.metaKey,
|
|
11551
|
+
bubbles: true,
|
|
11552
|
+
cancelable: true
|
|
11553
|
+
}));
|
|
11554
|
+
};
|
|
11555
|
+
$host.addEventListener("wheel", on_wheel, { passive: false });
|
|
11556
|
+
return () => {
|
|
11557
|
+
$host.removeEventListener("wheel", on_wheel);
|
|
11558
|
+
};
|
|
11559
|
+
}
|
|
11560
|
+
/************************************************************
|
|
11503
11561
|
* The camera cluster: zoom in, zoom out, readout, fit,
|
|
11504
11562
|
* actual size. Returns createElement2 specs, in order.
|
|
11505
11563
|
*
|
|
@@ -13561,7 +13619,7 @@ function ac_toggle_anchor$2(gobj, event, kw, src) {
|
|
|
13561
13619
|
/************************************************************
|
|
13562
13620
|
*
|
|
13563
13621
|
************************************************************/
|
|
13564
|
-
function ac_zoom_in$
|
|
13622
|
+
function ac_zoom_in$4(gobj, event, kw, src) {
|
|
13565
13623
|
let graph = gobj.priv.graph;
|
|
13566
13624
|
if (graph) {
|
|
13567
13625
|
let z = graph.getZoom();
|
|
@@ -13572,7 +13630,7 @@ function ac_zoom_in$3(gobj, event, kw, src) {
|
|
|
13572
13630
|
/************************************************************
|
|
13573
13631
|
*
|
|
13574
13632
|
************************************************************/
|
|
13575
|
-
function ac_zoom_out$
|
|
13633
|
+
function ac_zoom_out$4(gobj, event, kw, src) {
|
|
13576
13634
|
let graph = gobj.priv.graph;
|
|
13577
13635
|
if (graph) {
|
|
13578
13636
|
let z = graph.getZoom();
|
|
@@ -13583,7 +13641,7 @@ function ac_zoom_out$3(gobj, event, kw, src) {
|
|
|
13583
13641
|
/************************************************************
|
|
13584
13642
|
*
|
|
13585
13643
|
************************************************************/
|
|
13586
|
-
function ac_zoom_reset$
|
|
13644
|
+
function ac_zoom_reset$4(gobj, event, kw, src) {
|
|
13587
13645
|
let priv = gobj.priv;
|
|
13588
13646
|
let graph = priv.graph;
|
|
13589
13647
|
if (graph && graph.rendered) {
|
|
@@ -13598,7 +13656,7 @@ function ac_zoom_reset$3(gobj, event, kw, src) {
|
|
|
13598
13656
|
/************************************************************
|
|
13599
13657
|
*
|
|
13600
13658
|
************************************************************/
|
|
13601
|
-
function ac_center$
|
|
13659
|
+
function ac_center$4(gobj, event, kw, src) {
|
|
13602
13660
|
let graph = gobj.priv.graph;
|
|
13603
13661
|
if (graph) {
|
|
13604
13662
|
graph.fitCenter();
|
|
@@ -13734,22 +13792,22 @@ function create_gclass$14(gclass_name) {
|
|
|
13734
13792
|
],
|
|
13735
13793
|
[
|
|
13736
13794
|
"EV_ZOOM_IN",
|
|
13737
|
-
ac_zoom_in$
|
|
13795
|
+
ac_zoom_in$4,
|
|
13738
13796
|
null
|
|
13739
13797
|
],
|
|
13740
13798
|
[
|
|
13741
13799
|
"EV_ZOOM_OUT",
|
|
13742
|
-
ac_zoom_out$
|
|
13800
|
+
ac_zoom_out$4,
|
|
13743
13801
|
null
|
|
13744
13802
|
],
|
|
13745
13803
|
[
|
|
13746
13804
|
"EV_ZOOM_RESET",
|
|
13747
|
-
ac_zoom_reset$
|
|
13805
|
+
ac_zoom_reset$4,
|
|
13748
13806
|
null
|
|
13749
13807
|
],
|
|
13750
13808
|
[
|
|
13751
13809
|
"EV_CENTER",
|
|
13752
|
-
ac_center$
|
|
13810
|
+
ac_center$4,
|
|
13753
13811
|
null
|
|
13754
13812
|
],
|
|
13755
13813
|
[
|
|
@@ -16846,16 +16904,16 @@ function ac_language_changed$7(gobj, event, kw, src) {
|
|
|
16846
16904
|
/************************************************************
|
|
16847
16905
|
* The camera.
|
|
16848
16906
|
************************************************************/
|
|
16849
|
-
function ac_zoom_in$
|
|
16907
|
+
function ac_zoom_in$3(gobj, event, kw, src) {
|
|
16850
16908
|
return camera(gobj, "zoom in", (graph) => graph.zoomBy(1.2));
|
|
16851
16909
|
}
|
|
16852
|
-
function ac_zoom_out$
|
|
16910
|
+
function ac_zoom_out$3(gobj, event, kw, src) {
|
|
16853
16911
|
return camera(gobj, "zoom out", (graph) => graph.zoomBy(1 / 1.2));
|
|
16854
16912
|
}
|
|
16855
|
-
function ac_zoom_reset$
|
|
16913
|
+
function ac_zoom_reset$3(gobj, event, kw, src) {
|
|
16856
16914
|
return camera(gobj, "reset the zoom", (graph) => graph.zoomTo(1));
|
|
16857
16915
|
}
|
|
16858
|
-
function ac_center$
|
|
16916
|
+
function ac_center$3(gobj, event, kw, src) {
|
|
16859
16917
|
return camera(gobj, "fit the graph", (graph) => fit_readable(graph));
|
|
16860
16918
|
}
|
|
16861
16919
|
/************************************************************
|
|
@@ -16914,22 +16972,22 @@ function create_gclass$11(gclass_name) {
|
|
|
16914
16972
|
],
|
|
16915
16973
|
[
|
|
16916
16974
|
"EV_ZOOM_IN",
|
|
16917
|
-
ac_zoom_in$
|
|
16975
|
+
ac_zoom_in$3,
|
|
16918
16976
|
null
|
|
16919
16977
|
],
|
|
16920
16978
|
[
|
|
16921
16979
|
"EV_ZOOM_OUT",
|
|
16922
|
-
ac_zoom_out$
|
|
16980
|
+
ac_zoom_out$3,
|
|
16923
16981
|
null
|
|
16924
16982
|
],
|
|
16925
16983
|
[
|
|
16926
16984
|
"EV_ZOOM_RESET",
|
|
16927
|
-
ac_zoom_reset$
|
|
16985
|
+
ac_zoom_reset$3,
|
|
16928
16986
|
null
|
|
16929
16987
|
],
|
|
16930
16988
|
[
|
|
16931
16989
|
"EV_CENTER",
|
|
16932
|
-
ac_center$
|
|
16990
|
+
ac_center$3,
|
|
16933
16991
|
null
|
|
16934
16992
|
],
|
|
16935
16993
|
[
|
|
@@ -21037,7 +21095,7 @@ function ac_toggle_anchor$1(gobj, event, kw, src) {
|
|
|
21037
21095
|
/************************************************************
|
|
21038
21096
|
*
|
|
21039
21097
|
************************************************************/
|
|
21040
|
-
function ac_zoom_in$
|
|
21098
|
+
function ac_zoom_in$2(gobj, event, kw, src) {
|
|
21041
21099
|
let graph = gobj.priv.graph;
|
|
21042
21100
|
if (graph) {
|
|
21043
21101
|
let z = graph.getZoom();
|
|
@@ -21048,7 +21106,7 @@ function ac_zoom_in$1(gobj, event, kw, src) {
|
|
|
21048
21106
|
/************************************************************
|
|
21049
21107
|
*
|
|
21050
21108
|
************************************************************/
|
|
21051
|
-
function ac_zoom_out$
|
|
21109
|
+
function ac_zoom_out$2(gobj, event, kw, src) {
|
|
21052
21110
|
let graph = gobj.priv.graph;
|
|
21053
21111
|
if (graph) {
|
|
21054
21112
|
let z = graph.getZoom();
|
|
@@ -21059,7 +21117,7 @@ function ac_zoom_out$1(gobj, event, kw, src) {
|
|
|
21059
21117
|
/************************************************************
|
|
21060
21118
|
*
|
|
21061
21119
|
************************************************************/
|
|
21062
|
-
function ac_zoom_reset$
|
|
21120
|
+
function ac_zoom_reset$2(gobj, event, kw, src) {
|
|
21063
21121
|
let priv = gobj.priv;
|
|
21064
21122
|
let graph = priv.graph;
|
|
21065
21123
|
if (graph && graph.rendered) {
|
|
@@ -21074,7 +21132,7 @@ function ac_zoom_reset$1(gobj, event, kw, src) {
|
|
|
21074
21132
|
/************************************************************
|
|
21075
21133
|
*
|
|
21076
21134
|
************************************************************/
|
|
21077
|
-
function ac_center$
|
|
21135
|
+
function ac_center$2(gobj, event, kw, src) {
|
|
21078
21136
|
let graph = gobj.priv.graph;
|
|
21079
21137
|
if (graph) {
|
|
21080
21138
|
graph.fitCenter();
|
|
@@ -21280,22 +21338,22 @@ function create_gclass$9(gclass_name) {
|
|
|
21280
21338
|
],
|
|
21281
21339
|
[
|
|
21282
21340
|
"EV_ZOOM_IN",
|
|
21283
|
-
ac_zoom_in$
|
|
21341
|
+
ac_zoom_in$2,
|
|
21284
21342
|
null
|
|
21285
21343
|
],
|
|
21286
21344
|
[
|
|
21287
21345
|
"EV_ZOOM_OUT",
|
|
21288
|
-
ac_zoom_out$
|
|
21346
|
+
ac_zoom_out$2,
|
|
21289
21347
|
null
|
|
21290
21348
|
],
|
|
21291
21349
|
[
|
|
21292
21350
|
"EV_ZOOM_RESET",
|
|
21293
|
-
ac_zoom_reset$
|
|
21351
|
+
ac_zoom_reset$2,
|
|
21294
21352
|
null
|
|
21295
21353
|
],
|
|
21296
21354
|
[
|
|
21297
21355
|
"EV_CENTER",
|
|
21298
|
-
ac_center$
|
|
21356
|
+
ac_center$2,
|
|
21299
21357
|
null
|
|
21300
21358
|
],
|
|
21301
21359
|
[
|
|
@@ -27608,9 +27666,15 @@ function show_edit_form(gobj, row, index) {
|
|
|
27608
27666
|
* Does a click on this column already mean something else?
|
|
27609
27667
|
*
|
|
27610
27668
|
* The `_` columns are the table's own scaffolding (the selection
|
|
27611
|
-
* checkbox, the Op buttons); a hook opens its children
|
|
27612
|
-
* holding a json document opens it in a viewer
|
|
27613
|
-
*
|
|
27669
|
+
* checkbox, the Op buttons); a hook opens its children, a col
|
|
27670
|
+
* holding a json document opens it in a viewer, and a `file` col
|
|
27671
|
+
* opens its asset in a popup. Anything else is plain data, and a
|
|
27672
|
+
* click on it means "show me this record".
|
|
27673
|
+
*
|
|
27674
|
+
* `file` was missing when its popup arrived (7.23.159), so a click
|
|
27675
|
+
* on a photo opened the popup AND the record on top of it: Tabulator
|
|
27676
|
+
* fires `rowClick` from its own dispatcher, and the cell's
|
|
27677
|
+
* stopPropagation() does not reach it.
|
|
27614
27678
|
************************************************************/
|
|
27615
27679
|
var CELL_WITH_ACTION = [
|
|
27616
27680
|
"hook",
|
|
@@ -27621,7 +27685,8 @@ var CELL_WITH_ACTION = [
|
|
|
27621
27685
|
"list",
|
|
27622
27686
|
"coordinates",
|
|
27623
27687
|
"blob",
|
|
27624
|
-
"gbuffer"
|
|
27688
|
+
"gbuffer",
|
|
27689
|
+
"file"
|
|
27625
27690
|
];
|
|
27626
27691
|
function cell_has_its_own_action(gobj, field) {
|
|
27627
27692
|
if (!field || field.charAt(0) === "_") return true;
|
|
@@ -64008,15 +64073,15 @@ function ac_theme$1(gobj, event, kw, src) {
|
|
|
64008
64073
|
/************************************************************
|
|
64009
64074
|
* Zoom controls
|
|
64010
64075
|
************************************************************/
|
|
64011
|
-
function ac_zoom_in(gobj, event, kw, src) {
|
|
64076
|
+
function ac_zoom_in$1(gobj, event, kw, src) {
|
|
64012
64077
|
graph_zoom_in(gobj);
|
|
64013
64078
|
return 0;
|
|
64014
64079
|
}
|
|
64015
|
-
function ac_zoom_out(gobj, event, kw, src) {
|
|
64080
|
+
function ac_zoom_out$1(gobj, event, kw, src) {
|
|
64016
64081
|
graph_zoom_out(gobj);
|
|
64017
64082
|
return 0;
|
|
64018
64083
|
}
|
|
64019
|
-
function ac_zoom_reset(gobj, event, kw, src) {
|
|
64084
|
+
function ac_zoom_reset$1(gobj, event, kw, src) {
|
|
64020
64085
|
let priv = gobj.priv;
|
|
64021
64086
|
let graph = priv.graph;
|
|
64022
64087
|
if (priv.anchor_state === "on" && priv.anchor_id) after_camera(gobj, graph.zoomTo(1));
|
|
@@ -64404,7 +64469,7 @@ function ac_find_next$1(gobj, event, kw, src) {
|
|
|
64404
64469
|
graph_find_step(gobj, !!(kw && kw.back));
|
|
64405
64470
|
return 0;
|
|
64406
64471
|
}
|
|
64407
|
-
function ac_center(gobj, event, kw, src) {
|
|
64472
|
+
function ac_center$1(gobj, event, kw, src) {
|
|
64408
64473
|
graph_center(gobj);
|
|
64409
64474
|
return 0;
|
|
64410
64475
|
}
|
|
@@ -64814,17 +64879,17 @@ function create_gclass$4(gclass_name) {
|
|
|
64814
64879
|
],
|
|
64815
64880
|
[
|
|
64816
64881
|
"EV_ZOOM_IN",
|
|
64817
|
-
ac_zoom_in,
|
|
64882
|
+
ac_zoom_in$1,
|
|
64818
64883
|
null
|
|
64819
64884
|
],
|
|
64820
64885
|
[
|
|
64821
64886
|
"EV_ZOOM_OUT",
|
|
64822
|
-
ac_zoom_out,
|
|
64887
|
+
ac_zoom_out$1,
|
|
64823
64888
|
null
|
|
64824
64889
|
],
|
|
64825
64890
|
[
|
|
64826
64891
|
"EV_ZOOM_RESET",
|
|
64827
|
-
ac_zoom_reset,
|
|
64892
|
+
ac_zoom_reset$1,
|
|
64828
64893
|
null
|
|
64829
64894
|
],
|
|
64830
64895
|
[
|
|
@@ -64924,7 +64989,7 @@ function create_gclass$4(gclass_name) {
|
|
|
64924
64989
|
],
|
|
64925
64990
|
[
|
|
64926
64991
|
"EV_CENTER",
|
|
64927
|
-
ac_center,
|
|
64992
|
+
ac_center$1,
|
|
64928
64993
|
null
|
|
64929
64994
|
],
|
|
64930
64995
|
[
|
|
@@ -67640,6 +67705,12 @@ function register_c_yui_treedb_graph() {
|
|
|
67640
67705
|
* via the host-supplied `node_route`). An alternate landing to the
|
|
67641
67706
|
* topic cards, in the spirit of "every treedb is a graph".
|
|
67642
67707
|
*
|
|
67708
|
+
* The CAMERA is the family's (yui_graph_camera.js): the same
|
|
67709
|
+
* toolbar cluster -- zoom in/out, readout, fit, 1:1 -- and the
|
|
67710
|
+
* same wheel: it SCROLLS, and Ctrl + wheel zooms, over the cards
|
|
67711
|
+
* too (yui_graph_forward_wheel). This view zoomed on a bare wheel
|
|
67712
|
+
* and had no toolbar, beside graphs that did neither.
|
|
67713
|
+
*
|
|
67643
67714
|
* Copyright (c) 2026, ArtGins.
|
|
67644
67715
|
* All Rights Reserved.
|
|
67645
67716
|
***********************************************************************/
|
|
@@ -67677,19 +67748,23 @@ var attrs_table$2 = [
|
|
|
67677
67748
|
SDATA(data_type_t.DTP_STRING, "node_route", 0, "", "Hash-route template with a {topic} placeholder: a node click opens that topic (e.g. '#/topics/db/<sel>/{topic}')"),
|
|
67678
67749
|
SDATA(data_type_t.DTP_BOOLEAN, "with_node_click", 0, false, "With no `node_route`, PUBLISH a node click as EV_NODE_CLICK instead of dropping it. Opt-in, because a subscriber has to DECLARE the event: the hosts that route by hash, and the ones that want nothing, must not have it appear underneath them"),
|
|
67679
67750
|
SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
|
|
67751
|
+
SDATA(data_type_t.DTP_STRING, "wide", 0, "40px", "Height of the toolbar buttons: the family's (C_YUI_TREEDB_GRAPH, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS)"),
|
|
67680
67752
|
SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
|
|
67681
67753
|
SDATA_END()
|
|
67682
67754
|
];
|
|
67683
67755
|
var PRIVATE_DATA$2 = {
|
|
67684
67756
|
$container: null,
|
|
67757
|
+
$canvas: null,
|
|
67685
67758
|
graph: null,
|
|
67686
|
-
theme_observer: null
|
|
67759
|
+
theme_observer: null,
|
|
67760
|
+
unforward_wheel: null
|
|
67687
67761
|
};
|
|
67688
67762
|
var __gclass__$2 = null;
|
|
67689
67763
|
/******************************
|
|
67690
67764
|
* Framework Methods
|
|
67691
67765
|
******************************/
|
|
67692
67766
|
function mt_create$2(gobj) {
|
|
67767
|
+
ensure_pinch_zoom_patch();
|
|
67693
67768
|
build_ui$2(gobj);
|
|
67694
67769
|
let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
|
|
67695
67770
|
if (!subscriber) subscriber = gobj_parent(gobj);
|
|
@@ -67719,13 +67794,47 @@ function mt_destroy$2(gobj) {
|
|
|
67719
67794
|
* Build UI
|
|
67720
67795
|
************************************************************/
|
|
67721
67796
|
function build_ui$2(gobj) {
|
|
67797
|
+
let priv = gobj.priv;
|
|
67798
|
+
const $toolbar = yui_toolbar({}, [
|
|
67799
|
+
[
|
|
67800
|
+
"div",
|
|
67801
|
+
{ class: "yui-horizontal-toolbar-section left" },
|
|
67802
|
+
[]
|
|
67803
|
+
],
|
|
67804
|
+
[
|
|
67805
|
+
"div",
|
|
67806
|
+
{ class: "yui-horizontal-toolbar-section center" },
|
|
67807
|
+
yui_graph_camera_items(gobj, null, gobj_read_str_attr(gobj, "wide"))
|
|
67808
|
+
],
|
|
67809
|
+
[
|
|
67810
|
+
"div",
|
|
67811
|
+
{ class: "yui-horizontal-toolbar-section right" },
|
|
67812
|
+
[]
|
|
67813
|
+
]
|
|
67814
|
+
]);
|
|
67815
|
+
refresh_language($toolbar, t);
|
|
67816
|
+
priv.$canvas = createElement2([
|
|
67817
|
+
"div",
|
|
67818
|
+
{
|
|
67819
|
+
class: "TREEDB_SCHEMA_CANVAS",
|
|
67820
|
+
style: "position:relative; flex:1 1 auto; min-height:0;"
|
|
67821
|
+
},
|
|
67822
|
+
[]
|
|
67823
|
+
]);
|
|
67722
67824
|
let $container = createElement2([
|
|
67723
67825
|
"div",
|
|
67724
67826
|
{
|
|
67725
67827
|
class: "C_YUI_TREEDB_SCHEMA TREEDB_SCHEMA_VIEW",
|
|
67726
|
-
style: "position:relative; height:100%; min-height:0;"
|
|
67828
|
+
style: "position:relative; height:100%; min-height:0; display:flex; flex-direction:column;"
|
|
67727
67829
|
},
|
|
67728
|
-
[
|
|
67830
|
+
[[
|
|
67831
|
+
"div",
|
|
67832
|
+
{
|
|
67833
|
+
class: "TREEDB_SCHEMA_TOOLBAR",
|
|
67834
|
+
style: "flex:0 0 auto;"
|
|
67835
|
+
},
|
|
67836
|
+
[$toolbar]
|
|
67837
|
+
], priv.$canvas]
|
|
67729
67838
|
]);
|
|
67730
67839
|
gobj_write_attr(gobj, "$container", $container);
|
|
67731
67840
|
}
|
|
@@ -68019,7 +68128,10 @@ function edge_style(dark) {
|
|
|
68019
68128
|
function build_graph(gobj) {
|
|
68020
68129
|
let priv = gobj.priv;
|
|
68021
68130
|
let $container = gobj_read_attr(gobj, "$container");
|
|
68022
|
-
if (!$container)
|
|
68131
|
+
if (!$container || !priv.$canvas) {
|
|
68132
|
+
log_error(`${gobj_short_name(gobj)}: no UI to draw the schema in`);
|
|
68133
|
+
return;
|
|
68134
|
+
}
|
|
68023
68135
|
destroy_graph(gobj);
|
|
68024
68136
|
let data = schema_to_graph(gobj);
|
|
68025
68137
|
if (data.nodes.length === 0) {
|
|
@@ -68031,15 +68143,16 @@ function build_graph(gobj) {
|
|
|
68031
68143
|
},
|
|
68032
68144
|
t("no topics", { defaultValue: "No topics" })
|
|
68033
68145
|
]);
|
|
68034
|
-
|
|
68146
|
+
priv.$canvas.appendChild($empty);
|
|
68035
68147
|
return;
|
|
68036
68148
|
}
|
|
68037
68149
|
let dark = yui_is_dark();
|
|
68038
68150
|
let graph;
|
|
68039
68151
|
try {
|
|
68040
68152
|
graph = new Graph({
|
|
68041
|
-
container:
|
|
68153
|
+
container: priv.$canvas,
|
|
68042
68154
|
autoResize: true,
|
|
68155
|
+
animation: false,
|
|
68043
68156
|
data,
|
|
68044
68157
|
edge: { style: edge_style(dark) },
|
|
68045
68158
|
layout: {
|
|
@@ -68049,8 +68162,8 @@ function build_graph(gobj) {
|
|
|
68049
68162
|
ranksep: 90
|
|
68050
68163
|
},
|
|
68051
68164
|
behaviors: [
|
|
68052
|
-
"zoom-canvas",
|
|
68053
68165
|
"drag-canvas",
|
|
68166
|
+
...yui_graph_camera_behaviors(),
|
|
68054
68167
|
"drag-element"
|
|
68055
68168
|
]
|
|
68056
68169
|
});
|
|
@@ -68060,11 +68173,17 @@ function build_graph(gobj) {
|
|
|
68060
68173
|
}
|
|
68061
68174
|
priv.graph = graph;
|
|
68062
68175
|
graph.setTheme(dark ? "dark" : "light");
|
|
68176
|
+
graph.on("aftertransform", () => {
|
|
68177
|
+
yui_graph_update_zoom($container, priv.graph);
|
|
68178
|
+
});
|
|
68179
|
+
priv.unforward_wheel = yui_graph_forward_wheel(graph, priv.$canvas);
|
|
68063
68180
|
graph.on(NodeEvent.CLICK, (evt) => {
|
|
68064
68181
|
let node_id = evt && evt.target && evt.target.id;
|
|
68065
68182
|
gobj_send_event(gobj, "EV_NODE_CLICK", { node_id }, gobj);
|
|
68066
68183
|
});
|
|
68067
|
-
graph.render().
|
|
68184
|
+
graph.render().then(() => {
|
|
68185
|
+
yui_graph_update_zoom($container, priv.graph);
|
|
68186
|
+
}).catch((e) => {
|
|
68068
68187
|
log_error(`${gobj_short_name(gobj)}: schema graph render failed: ${e}`);
|
|
68069
68188
|
});
|
|
68070
68189
|
}
|
|
@@ -68073,14 +68192,17 @@ function build_graph(gobj) {
|
|
|
68073
68192
|
************************************************************/
|
|
68074
68193
|
function destroy_graph(gobj) {
|
|
68075
68194
|
let priv = gobj.priv;
|
|
68195
|
+
if (priv.unforward_wheel) {
|
|
68196
|
+
priv.unforward_wheel();
|
|
68197
|
+
priv.unforward_wheel = null;
|
|
68198
|
+
}
|
|
68076
68199
|
if (priv.graph) {
|
|
68077
68200
|
try {
|
|
68078
68201
|
priv.graph.destroy();
|
|
68079
68202
|
} catch (e) {}
|
|
68080
68203
|
priv.graph = null;
|
|
68081
68204
|
}
|
|
68082
|
-
|
|
68083
|
-
if ($container) while ($container.firstChild) $container.removeChild($container.firstChild);
|
|
68205
|
+
if (priv.$canvas) while (priv.$canvas.firstChild) priv.$canvas.removeChild(priv.$canvas.firstChild);
|
|
68084
68206
|
}
|
|
68085
68207
|
/***************************
|
|
68086
68208
|
* Actions
|
|
@@ -68170,6 +68292,38 @@ function ac_theme(gobj, event, kw, src) {
|
|
|
68170
68292
|
return 0;
|
|
68171
68293
|
}
|
|
68172
68294
|
/************************************************************
|
|
68295
|
+
* The camera, from the toolbar. Same moves as the family's
|
|
68296
|
+
* (C_YUI_GOBJ_TREE_JS): +/- 20%, fit, and actual size at the
|
|
68297
|
+
* layout's origin.
|
|
68298
|
+
************************************************************/
|
|
68299
|
+
function camera_move(gobj, what, promise) {
|
|
68300
|
+
Promise.resolve(promise).then(() => {
|
|
68301
|
+
yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), gobj.priv.graph);
|
|
68302
|
+
}).catch((e) => {
|
|
68303
|
+
log_error(`${gobj_short_name(gobj)}: schema graph ${what} failed: ${e}`);
|
|
68304
|
+
});
|
|
68305
|
+
}
|
|
68306
|
+
function ac_zoom_in(gobj, event, kw, src) {
|
|
68307
|
+
let graph = gobj.priv.graph;
|
|
68308
|
+
if (graph) camera_move(gobj, "zoom in", graph.zoomTo(graph.getZoom() * 1.2));
|
|
68309
|
+
return 0;
|
|
68310
|
+
}
|
|
68311
|
+
function ac_zoom_out(gobj, event, kw, src) {
|
|
68312
|
+
let graph = gobj.priv.graph;
|
|
68313
|
+
if (graph) camera_move(gobj, "zoom out", graph.zoomTo(graph.getZoom() * .8));
|
|
68314
|
+
return 0;
|
|
68315
|
+
}
|
|
68316
|
+
function ac_zoom_reset(gobj, event, kw, src) {
|
|
68317
|
+
let graph = gobj.priv.graph;
|
|
68318
|
+
if (graph && graph.rendered) camera_move(gobj, "actual size", Promise.resolve(graph.zoomTo(1)).then(() => graph.translateTo([0, 0])));
|
|
68319
|
+
return 0;
|
|
68320
|
+
}
|
|
68321
|
+
function ac_center(gobj, event, kw, src) {
|
|
68322
|
+
let graph = gobj.priv.graph;
|
|
68323
|
+
if (graph) camera_move(gobj, "fit", graph.fitView());
|
|
68324
|
+
return 0;
|
|
68325
|
+
}
|
|
68326
|
+
/************************************************************
|
|
68173
68327
|
* Rebuild from a fresh schema (descs arrived / changed).
|
|
68174
68328
|
************************************************************/
|
|
68175
68329
|
function ac_rebuild(gobj, event, kw, src) {
|
|
@@ -68211,13 +68365,37 @@ function create_gclass$2(gclass_name) {
|
|
|
68211
68365
|
"EV_REBUILD",
|
|
68212
68366
|
ac_rebuild,
|
|
68213
68367
|
null
|
|
68368
|
+
],
|
|
68369
|
+
[
|
|
68370
|
+
"EV_ZOOM_IN",
|
|
68371
|
+
ac_zoom_in,
|
|
68372
|
+
null
|
|
68373
|
+
],
|
|
68374
|
+
[
|
|
68375
|
+
"EV_ZOOM_OUT",
|
|
68376
|
+
ac_zoom_out,
|
|
68377
|
+
null
|
|
68378
|
+
],
|
|
68379
|
+
[
|
|
68380
|
+
"EV_ZOOM_RESET",
|
|
68381
|
+
ac_zoom_reset,
|
|
68382
|
+
null
|
|
68383
|
+
],
|
|
68384
|
+
[
|
|
68385
|
+
"EV_CENTER",
|
|
68386
|
+
ac_center,
|
|
68387
|
+
null
|
|
68214
68388
|
]
|
|
68215
68389
|
]]];
|
|
68216
68390
|
const event_types = [
|
|
68217
68391
|
["EV_NODE_CLICK", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
|
|
68218
68392
|
["EV_SHOW", 0],
|
|
68219
68393
|
["EV_THEME", 0],
|
|
68220
|
-
["EV_REBUILD", 0]
|
|
68394
|
+
["EV_REBUILD", 0],
|
|
68395
|
+
["EV_ZOOM_IN", 0],
|
|
68396
|
+
["EV_ZOOM_OUT", 0],
|
|
68397
|
+
["EV_ZOOM_RESET", 0],
|
|
68398
|
+
["EV_CENTER", 0]
|
|
68221
68399
|
];
|
|
68222
68400
|
__gclass__$2 = gclass_create(gclass_name, event_types, states, gmt$2, 0, attrs_table$2, PRIVATE_DATA$2, 0, 0, 0, 0);
|
|
68223
68401
|
if (!__gclass__$2) return -1;
|