@yuneta/gobj-ui 7.31.4 → 7.31.6
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 +25 -0
- package/dist/gobj-ui.cjs.js +25141 -24990
- package/dist/gobj-ui.es.js +25140 -24989
- package/package.json +1 -1
- package/src/c_yui_json_graph.js +236 -9
- package/src/c_yui_treedb_topic_with_form.js +7 -9
- package/src/c_yui_treedb_topics.js +13 -26
- package/src/i18n_key_functions.js +0 -6
- package/src/i18n_key_functions.test.js +4 -2
- package/src/json_graph_lit_edge.wiring.test.js +260 -0
- package/src/named_controls.wiring.test.js +8 -2
package/package.json
CHANGED
package/src/c_yui_json_graph.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
gobj_publish_event,
|
|
35
35
|
gobj_save_persistent_attrs,
|
|
36
36
|
gobj_read_bool_attr,
|
|
37
|
+
gobj_read_integer_attr,
|
|
37
38
|
createElement2,
|
|
38
39
|
is_string,
|
|
39
40
|
is_array,
|
|
@@ -63,6 +64,8 @@ import {
|
|
|
63
64
|
yui_graph_update_zoom,
|
|
64
65
|
} from "./yui_graph_camera.js";
|
|
65
66
|
|
|
67
|
+
import {yui_graph_minimap_options, yui_graph_minimap_block} from "./yui_graph_minimap.js";
|
|
68
|
+
|
|
66
69
|
import {t} from "i18next";
|
|
67
70
|
|
|
68
71
|
import {
|
|
@@ -70,6 +73,7 @@ import {
|
|
|
70
73
|
ExtensionCategory,
|
|
71
74
|
Graph,
|
|
72
75
|
NodeEvent,
|
|
76
|
+
EdgeEvent,
|
|
73
77
|
CanvasEvent,
|
|
74
78
|
register,
|
|
75
79
|
} from '@antv/g6';
|
|
@@ -98,6 +102,19 @@ const GCLASS_NAME = "C_YUI_JSON_GRAPH";
|
|
|
98
102
|
*/
|
|
99
103
|
const FOLD_SWALLOWED_EVENTS = ["pointerdown", "pointerup", "mousedown", "click"];
|
|
100
104
|
|
|
105
|
+
/*
|
|
106
|
+
* A lit edge and its two ends: the amber of the schema graph and the
|
|
107
|
+
* treedb graph (C_YUI_TREEDB_SCHEMA, C_G6_NODES_TREE), one per scheme.
|
|
108
|
+
*/
|
|
109
|
+
const LIT_COLOR_DARK = "#f0a020";
|
|
110
|
+
const LIT_COLOR_LIGHT = "#b45309";
|
|
111
|
+
const LIT_HALO_DARK = "rgba(240,160,32,0.35)";
|
|
112
|
+
const LIT_HALO_LIGHT = "rgba(180,83,9,0.35)";
|
|
113
|
+
|
|
114
|
+
/* The width an edge takes a click on, in px: G6's default adds only
|
|
115
|
+
* 2 to the line's own. */
|
|
116
|
+
const EDGE_HIT_WIDTH = 14;
|
|
117
|
+
|
|
101
118
|
/*
|
|
102
119
|
* Layouts, same shape the gobj tree's registry uses
|
|
103
120
|
* (`c_yui_gobj_tree_js.js`): a G6 layout config plus the edge type
|
|
@@ -183,6 +200,7 @@ SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
|
|
|
183
200
|
/*---------------- Graph Settings ----------------*/
|
|
184
201
|
SDATA(data_type_t.DTP_STRING, "wide", 0, "40px", "Height of header. 40px and not 36: it is what an untouched Bulma control measures, so the find box stood 4px taller than every button beside it, and it is what the third graph of the family (C_YUI_TREEDB_GRAPH) uses"),
|
|
185
202
|
SDATA(data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
|
|
203
|
+
SDATA(data_type_t.DTP_INTEGER, "minimap_min_nodes", 0, 10, "Show the minimap from this many cards on (0 = never), as the treedb graph does"),
|
|
186
204
|
|
|
187
205
|
SDATA_END()
|
|
188
206
|
];
|
|
@@ -215,6 +233,12 @@ let PRIVATE_DATA = {
|
|
|
215
233
|
last_zoom: 1, // tells a wheel zoom from a drag in aftertransform
|
|
216
234
|
center_posted: false, // one re-centring in flight, never a queue of them
|
|
217
235
|
pending_keep: null, // {path,x,y}: a card to put back where it was
|
|
236
|
+
|
|
237
|
+
/*---------------- lit edge ----------------*/
|
|
238
|
+
lit_path: "", // path of the CHILD card of the lit edge: a rebuild finds it again
|
|
239
|
+
lit_parent_path: "", // path of its PARENT card
|
|
240
|
+
lit_port: "", // the parent's port the edge leaves from: its row is washed
|
|
241
|
+
lit_found: false, // the last build drew it
|
|
218
242
|
};
|
|
219
243
|
|
|
220
244
|
let __gclass__ = null;
|
|
@@ -732,7 +756,10 @@ function build_graph(gobj)
|
|
|
732
756
|
container: priv.canvas_id,
|
|
733
757
|
animation: false,
|
|
734
758
|
autoResize: false,
|
|
735
|
-
|
|
759
|
+
/* The floor was 0.1, and a document of a few hundred cards
|
|
760
|
+
* did not fit at 10%: Fit stopped there with most of it off
|
|
761
|
+
* screen. */
|
|
762
|
+
zoomRange: [0.02, 4],
|
|
736
763
|
|
|
737
764
|
node: {
|
|
738
765
|
style: {
|
|
@@ -816,8 +843,12 @@ function build_graph(gobj)
|
|
|
816
843
|
}
|
|
817
844
|
});
|
|
818
845
|
|
|
819
|
-
graph.on(
|
|
820
|
-
|
|
846
|
+
graph.on(EdgeEvent.CLICK, (evt) => {
|
|
847
|
+
gobj_send_event(gobj, "EV_EDGE_CLICK", g6_event_kw(evt), gobj);
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
graph.on(CanvasEvent.CLICK, () => {
|
|
851
|
+
gobj_send_event(gobj, "EV_CANVAS_CLICK", {}, gobj);
|
|
821
852
|
});
|
|
822
853
|
|
|
823
854
|
/*
|
|
@@ -1268,12 +1299,40 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
|
|
|
1268
1299
|
let border_color = card_matched? (dark? "#ffb300": "#ff8f00"): colors.border;
|
|
1269
1300
|
let border_width = card_matched? 2: 1;
|
|
1270
1301
|
|
|
1302
|
+
/*
|
|
1303
|
+
* The lit edge: this card is its CHILD end, or its PARENT end --
|
|
1304
|
+
* and then the row of the key the edge leaves from is washed, so
|
|
1305
|
+
* the line says which key it is.
|
|
1306
|
+
*/
|
|
1307
|
+
let lit_color = dark? LIT_COLOR_DARK : LIT_COLOR_LIGHT;
|
|
1308
|
+
let lit_child = !!parent_id && !empty_string(priv.lit_path) && path === priv.lit_path;
|
|
1309
|
+
let lit_row = -1;
|
|
1310
|
+
let lit_parent = !empty_string(priv.lit_path) && path === priv.lit_parent_path;
|
|
1311
|
+
if(lit_parent) {
|
|
1312
|
+
for(let pending of pending_complex) {
|
|
1313
|
+
if(pending.port === priv.lit_port) {
|
|
1314
|
+
lit_row = pending.row;
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
let lit_card = lit_child || lit_parent;
|
|
1320
|
+
if(lit_child) {
|
|
1321
|
+
priv.lit_found = true;
|
|
1322
|
+
}
|
|
1323
|
+
if(lit_card) {
|
|
1324
|
+
border_color = lit_color;
|
|
1325
|
+
border_width = 3;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1271
1328
|
/*
|
|
1272
1329
|
* Build node HTML content
|
|
1273
1330
|
*/
|
|
1274
|
-
let content_html = lines.map(line =>
|
|
1275
|
-
|
|
1276
|
-
|
|
1331
|
+
let content_html = lines.map((line, i) => {
|
|
1332
|
+
let wash = (i === lit_row)?
|
|
1333
|
+
` background:color-mix(in srgb, ${lit_color} 28%, transparent);` : "";
|
|
1334
|
+
return `<div style="font-family:monospace; font-size:13px; padding:1px 6px; white-space:nowrap;${wash}">${line}</div>`;
|
|
1335
|
+
}).join("");
|
|
1277
1336
|
|
|
1278
1337
|
let min_width = Math.max(180, label.length * 9);
|
|
1279
1338
|
let card_height = CARD_HEADER_H + lines.length * CARD_ROW_H;
|
|
@@ -1295,8 +1354,9 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
|
|
|
1295
1354
|
<div class="JSON_CARD" data-json-path="${escapeHtml(path)}" style="
|
|
1296
1355
|
min-width: ${min_width}px;
|
|
1297
1356
|
background: ${colors.bg};
|
|
1298
|
-
border: ${border_width}px ${is_dict ? 'dashed' : 'solid'} ${border_color};
|
|
1357
|
+
border: ${border_width}px ${(is_dict && !lit_card) ? 'dashed' : 'solid'} ${border_color};
|
|
1299
1358
|
border-radius: ${is_dict ? '6px' : '0'};
|
|
1359
|
+
${lit_card? `box-shadow: 0 0 0 4px ${dark? LIT_HALO_DARK : LIT_HALO_LIGHT};` : ""}
|
|
1300
1360
|
opacity: 0.9;
|
|
1301
1361
|
overflow: hidden;
|
|
1302
1362
|
">
|
|
@@ -1402,7 +1462,10 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
|
|
|
1402
1462
|
target: group_id,
|
|
1403
1463
|
style: {
|
|
1404
1464
|
stroke: colors.border,
|
|
1405
|
-
|
|
1465
|
+
/* 1.6 and a click 7px either side of it: a 1px line
|
|
1466
|
+
* was a 1px target. */
|
|
1467
|
+
lineWidth: 1.6,
|
|
1468
|
+
increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
|
|
1406
1469
|
/*
|
|
1407
1470
|
* Said on the EDGE and not left to the graph's element
|
|
1408
1471
|
* default: a per-element `style` is what the reader of
|
|
@@ -1425,6 +1488,17 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
|
|
|
1425
1488
|
if(parent_port) {
|
|
1426
1489
|
edge.style.sourcePort = parent_port;
|
|
1427
1490
|
}
|
|
1491
|
+
if(lit_child) {
|
|
1492
|
+
Object.assign(edge.style, {
|
|
1493
|
+
stroke: lit_color,
|
|
1494
|
+
lineWidth: 3,
|
|
1495
|
+
halo: true,
|
|
1496
|
+
haloStroke: dark? LIT_HALO_DARK : LIT_HALO_LIGHT,
|
|
1497
|
+
haloLineWidth: 8,
|
|
1498
|
+
endArrowFill: lit_color,
|
|
1499
|
+
endArrowStroke: lit_color,
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1428
1502
|
edges.push(edge);
|
|
1429
1503
|
}
|
|
1430
1504
|
|
|
@@ -1452,6 +1526,75 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
|
|
|
1452
1526
|
return group_id;
|
|
1453
1527
|
}
|
|
1454
1528
|
|
|
1529
|
+
/************************************************************
|
|
1530
|
+
* The minimap plugin of the graph, or null when it has none.
|
|
1531
|
+
************************************************************/
|
|
1532
|
+
function minimap_plugin(gobj)
|
|
1533
|
+
{
|
|
1534
|
+
let graph = gobj.priv.graph;
|
|
1535
|
+
let plugins = graph.getPlugins() || [];
|
|
1536
|
+
if(!plugins.some((p) => typeof p === "object" && p.key === "minimap")) {
|
|
1537
|
+
return null;
|
|
1538
|
+
}
|
|
1539
|
+
return graph.getPluginInstance("minimap") || null;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
/************************************************************
|
|
1543
|
+
* Show or hide the minimap, deciding by the number of cards
|
|
1544
|
+
* about to be drawn (`n`), from `minimap_min_nodes` on -- the
|
|
1545
|
+
* rule of the gobj tree (C_YUI_GOBJ_TREE_JS), whose code this
|
|
1546
|
+
* is: called BEFORE the render, because the minimap builds its
|
|
1547
|
+
* canvas off the render events and one added after the last
|
|
1548
|
+
* render is never painted. Its blocks wear the border colour of
|
|
1549
|
+
* their card, read at each paint, so a theme switch repaints
|
|
1550
|
+
* them; the phantom a fold leaves is not drawn.
|
|
1551
|
+
************************************************************/
|
|
1552
|
+
function refresh_minimap(gobj, n)
|
|
1553
|
+
{
|
|
1554
|
+
let graph = gobj.priv.graph;
|
|
1555
|
+
let threshold = gobj_read_integer_attr(gobj, "minimap_min_nodes");
|
|
1556
|
+
let plugin = minimap_plugin(gobj);
|
|
1557
|
+
|
|
1558
|
+
if(!threshold || n < threshold) {
|
|
1559
|
+
if(plugin) {
|
|
1560
|
+
graph.setPlugins((graph.getPlugins() || []).filter(
|
|
1561
|
+
(p) => !(typeof p === "object" && p.key === "minimap")
|
|
1562
|
+
));
|
|
1563
|
+
if(!plugin.destroyed && plugin.destroy) {
|
|
1564
|
+
plugin.destroy();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
if(plugin) {
|
|
1570
|
+
return; /* already up */
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
let shape = (id, element_type, element) => {
|
|
1574
|
+
if(element_type !== "node") {
|
|
1575
|
+
return element; /* edges clone themselves fine */
|
|
1576
|
+
}
|
|
1577
|
+
try {
|
|
1578
|
+
let nd = graph.getNodeData(id);
|
|
1579
|
+
let data = (nd && nd.data) || {};
|
|
1580
|
+
if(data.phantom) {
|
|
1581
|
+
return yui_graph_minimap_block(nd, "transparent");
|
|
1582
|
+
}
|
|
1583
|
+
let colors = json_card_style(
|
|
1584
|
+
data.is_dict? GROUP_COLORS.dict : GROUP_COLORS.list, yui_is_dark()
|
|
1585
|
+
);
|
|
1586
|
+
return yui_graph_minimap_block(nd, colors.border);
|
|
1587
|
+
} catch(e) {
|
|
1588
|
+
log_error(`${gobj_short_name(gobj)}: minimap shape failed: ${e}`);
|
|
1589
|
+
return element;
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
graph.setPlugins((plugins) => [
|
|
1593
|
+
...plugins,
|
|
1594
|
+
{key: "minimap", type: "minimap", ...yui_graph_minimap_options(shape)}
|
|
1595
|
+
]);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1455
1598
|
/************************************************************
|
|
1456
1599
|
* Load JSON data into graph
|
|
1457
1600
|
************************************************************/
|
|
@@ -1477,12 +1620,26 @@ function load_json(gobj)
|
|
|
1477
1620
|
|
|
1478
1621
|
priv.node_counter = 0;
|
|
1479
1622
|
priv.match_count = 0;
|
|
1623
|
+
priv.lit_found = false;
|
|
1480
1624
|
|
|
1481
1625
|
let nodes = [];
|
|
1482
1626
|
let edges = [];
|
|
1483
1627
|
|
|
1484
1628
|
build_json_nodes(gobj, path, json, nodes, edges, null);
|
|
1485
1629
|
|
|
1630
|
+
if(!empty_string(priv.lit_path) && !priv.lit_found) {
|
|
1631
|
+
/* Its child card is gone (a fold above it): nothing is lit. */
|
|
1632
|
+
priv.lit_path = "";
|
|
1633
|
+
priv.lit_parent_path = "";
|
|
1634
|
+
priv.lit_port = "";
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
try {
|
|
1638
|
+
refresh_minimap(gobj, nodes.length);
|
|
1639
|
+
} catch(e) {
|
|
1640
|
+
log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1486
1643
|
let preserve_view = !!priv.pending_preserve_view;
|
|
1487
1644
|
priv.pending_preserve_view = false;
|
|
1488
1645
|
|
|
@@ -1931,8 +2088,11 @@ function ac_load_data(gobj, event, kw, src)
|
|
|
1931
2088
|
if(kw.data !== undefined) {
|
|
1932
2089
|
gobj_write_attr(gobj, "json_data", kw.data);
|
|
1933
2090
|
/* A new document: the folds and the space they were holding
|
|
1934
|
-
* belonged to the old one. */
|
|
2091
|
+
* belonged to the old one, and so did the lit edge. */
|
|
1935
2092
|
priv_reset_folds(gobj);
|
|
2093
|
+
gobj.priv.lit_path = "";
|
|
2094
|
+
gobj.priv.lit_parent_path = "";
|
|
2095
|
+
gobj.priv.lit_port = "";
|
|
1936
2096
|
}
|
|
1937
2097
|
|
|
1938
2098
|
refresh_json(gobj);
|
|
@@ -2112,6 +2272,69 @@ function ac_collapse_all(gobj, event, kw, src)
|
|
|
2112
2272
|
return 0;
|
|
2113
2273
|
}
|
|
2114
2274
|
|
|
2275
|
+
/************************************************************
|
|
2276
|
+
* EV_EDGE_CLICK { id }
|
|
2277
|
+
*
|
|
2278
|
+
* Light the edge and its two ends, or put it out when it is
|
|
2279
|
+
* the lit one. Baked into the drawing, like a find match: the
|
|
2280
|
+
* cards are html, where G6 paints no state, so the drawing is
|
|
2281
|
+
* rebuilt with the camera kept. The edge is kept by the PATH
|
|
2282
|
+
* of its child card, which a rebuild keeps and the ids do not.
|
|
2283
|
+
************************************************************/
|
|
2284
|
+
function ac_edge_click(gobj, event, kw, src)
|
|
2285
|
+
{
|
|
2286
|
+
let priv = gobj.priv;
|
|
2287
|
+
let graph = priv.graph;
|
|
2288
|
+
|
|
2289
|
+
if(!graph || priv.anchor_state === "arming") {
|
|
2290
|
+
return 0; /* picking a card for the anchor: an edge is no answer */
|
|
2291
|
+
}
|
|
2292
|
+
let edge;
|
|
2293
|
+
let source;
|
|
2294
|
+
let target;
|
|
2295
|
+
try {
|
|
2296
|
+
edge = graph.getEdgeData(kw.id);
|
|
2297
|
+
source = graph.getNodeData(edge.source);
|
|
2298
|
+
target = graph.getNodeData(edge.target);
|
|
2299
|
+
} catch(e) {
|
|
2300
|
+
log_warning(`${gobj_short_name(gobj)}: EV_EDGE_CLICK of an edge not in the graph: ${kw.id}`);
|
|
2301
|
+
return -1;
|
|
2302
|
+
}
|
|
2303
|
+
let tdata = (target && target.data) || {};
|
|
2304
|
+
if(tdata.phantom || empty_string(tdata.path)) {
|
|
2305
|
+
return 0; /* the invisible edge a fold leaves */
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
if(priv.lit_path === tdata.path) {
|
|
2309
|
+
priv.lit_path = "";
|
|
2310
|
+
priv.lit_parent_path = "";
|
|
2311
|
+
priv.lit_port = "";
|
|
2312
|
+
} else {
|
|
2313
|
+
priv.lit_path = tdata.path;
|
|
2314
|
+
priv.lit_parent_path = (source && source.data && source.data.path) || "";
|
|
2315
|
+
priv.lit_port = (edge.style && edge.style.sourcePort) || "";
|
|
2316
|
+
}
|
|
2317
|
+
refresh_json(gobj, {preserve_view: true});
|
|
2318
|
+
return 0;
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
/************************************************************
|
|
2322
|
+
* EV_CANVAS_CLICK -- a click on nothing puts the lit edge out.
|
|
2323
|
+
************************************************************/
|
|
2324
|
+
function ac_canvas_click(gobj, event, kw, src)
|
|
2325
|
+
{
|
|
2326
|
+
let priv = gobj.priv;
|
|
2327
|
+
|
|
2328
|
+
if(empty_string(priv.lit_path)) {
|
|
2329
|
+
return 0;
|
|
2330
|
+
}
|
|
2331
|
+
priv.lit_path = "";
|
|
2332
|
+
priv.lit_parent_path = "";
|
|
2333
|
+
priv.lit_port = "";
|
|
2334
|
+
refresh_json(gobj, {preserve_view: true});
|
|
2335
|
+
return 0;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2115
2338
|
/************************************************************
|
|
2116
2339
|
*
|
|
2117
2340
|
************************************************************/
|
|
@@ -2525,6 +2748,8 @@ function create_gclass(gclass_name)
|
|
|
2525
2748
|
["EV_ZOOM_RESET", ac_zoom_reset, null],
|
|
2526
2749
|
["EV_CENTER", ac_center, null],
|
|
2527
2750
|
["EV_NODE_CLICK", ac_node_click, null],
|
|
2751
|
+
["EV_EDGE_CLICK", ac_edge_click, null],
|
|
2752
|
+
["EV_CANVAS_CLICK", ac_canvas_click, null],
|
|
2528
2753
|
["EV_TOGGLE_ANCHOR", ac_toggle_anchor, null],
|
|
2529
2754
|
["EV_CENTER_ANCHOR", ac_center_anchor, null],
|
|
2530
2755
|
["EV_RESIZE", ac_resize, null],
|
|
@@ -2550,6 +2775,8 @@ function create_gclass(gclass_name)
|
|
|
2550
2775
|
["EV_ZOOM_RESET", 0],
|
|
2551
2776
|
["EV_CENTER", 0],
|
|
2552
2777
|
["EV_NODE_CLICK", 0],
|
|
2778
|
+
["EV_EDGE_CLICK", 0],
|
|
2779
|
+
["EV_CANVAS_CLICK", 0],
|
|
2553
2780
|
["EV_TOGGLE_ANCHOR", 0],
|
|
2554
2781
|
["EV_CENTER_ANCHOR", 0],
|
|
2555
2782
|
["EV_RESIZE", 0],
|
|
@@ -3232,18 +3232,17 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook)
|
|
|
3232
3232
|
log_error(`${gobj_short_name(gobj)}: no shell, cannot ask which topic to open`);
|
|
3233
3233
|
return;
|
|
3234
3234
|
}
|
|
3235
|
-
/* The topic names are
|
|
3235
|
+
/* The topic names are shown as the schema has them, untranslated,
|
|
3236
|
+
* like the tabs that name them. */
|
|
3236
3237
|
let $body = createElement2(
|
|
3237
3238
|
['div', {class: 'TREEDB_HOOK_CHOICE'}, targets.map((tg) => {
|
|
3238
3239
|
return ['button', {
|
|
3239
3240
|
class: 'button HOOK_CHOICE_TOPIC',
|
|
3240
3241
|
type: 'button',
|
|
3241
|
-
title:
|
|
3242
|
-
'
|
|
3243
|
-
'aria-label': t(tg.topic_name),
|
|
3244
|
-
'data-i18n-aria-label': tg.topic_name
|
|
3242
|
+
title: tg.topic_name,
|
|
3243
|
+
'aria-label': tg.topic_name
|
|
3245
3244
|
}, [
|
|
3246
|
-
['span', {
|
|
3245
|
+
['span', {}, text_node(tg.topic_name)]
|
|
3247
3246
|
], {
|
|
3248
3247
|
click: () => {
|
|
3249
3248
|
gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
|
|
@@ -3372,8 +3371,7 @@ function render_parent_filter(gobj)
|
|
|
3372
3371
|
return;
|
|
3373
3372
|
}
|
|
3374
3373
|
let $topic = $chip.querySelector(".PARENT_FILTER_TOPIC");
|
|
3375
|
-
$topic.
|
|
3376
|
-
$topic.textContent = t(pf.parent_topic);
|
|
3374
|
+
$topic.textContent = pf.parent_topic;
|
|
3377
3375
|
$chip.querySelector(".PARENT_FILTER_ID").textContent = pf.parent_id;
|
|
3378
3376
|
$chip.classList.remove("is-hidden");
|
|
3379
3377
|
}
|
|
@@ -4716,7 +4714,7 @@ function ac_show_hook_data(gobj, event, kw, src)
|
|
|
4716
4714
|
String(kw.row_id), kw.col_id);
|
|
4717
4715
|
return 0;
|
|
4718
4716
|
}
|
|
4719
|
-
open_hook_choice_dialog(gobj,
|
|
4717
|
+
open_hook_choice_dialog(gobj, targets, String(kw.row_id), kw.col_id);
|
|
4720
4718
|
return 0;
|
|
4721
4719
|
}
|
|
4722
4720
|
|
|
@@ -594,13 +594,12 @@ function add_tab(gobj, gobj2, id, text, icon)
|
|
|
594
594
|
/*
|
|
595
595
|
* Create li a
|
|
596
596
|
*/
|
|
597
|
-
/* A tab is a control:
|
|
598
|
-
*
|
|
597
|
+
/* A tab is a control: it carries a title and a name. Both are the
|
|
598
|
+
* topic's own name, untranslated: it is the schema's identifier, the
|
|
599
|
+
* one the relations, the graph and the backend speak. */
|
|
599
600
|
let $item = createElement2(
|
|
600
601
|
['li', {class: ''}, [ // is-active
|
|
601
|
-
['a', {href: id,
|
|
602
|
-
title: t(text), 'data-i18n-title': text,
|
|
603
|
-
'aria-label': t(text), 'data-i18n-aria-label': text}]
|
|
602
|
+
['a', {href: id, title: text, 'aria-label': text}]
|
|
604
603
|
]]
|
|
605
604
|
);
|
|
606
605
|
$tabs.appendChild($item);
|
|
@@ -628,19 +627,9 @@ function add_tab(gobj, gobj2, id, text, icon)
|
|
|
628
627
|
* TAB: Add text
|
|
629
628
|
*/
|
|
630
629
|
$a.appendChild(
|
|
631
|
-
createElement2(['span', {
|
|
630
|
+
createElement2(['span', {class: ''}, text_node(text)])
|
|
632
631
|
);
|
|
633
632
|
|
|
634
|
-
/*
|
|
635
|
-
* Translate the tab NOW. The span carries data-i18n but its
|
|
636
|
-
* initial text is the raw key (the topic_name). Tabs are built
|
|
637
|
-
* lazily when topic descriptions arrive from the backend —
|
|
638
|
-
* AFTER the host's one-time refresh_language($container,t) —
|
|
639
|
-
* so without this they stay as raw keys ("groups", …).
|
|
640
|
-
* `t` is the i18next translator already imported here.
|
|
641
|
-
*/
|
|
642
|
-
refresh_language($a, t);
|
|
643
|
-
|
|
644
633
|
/*
|
|
645
634
|
* Self-contained tab navigation. The `href` is kept only as a
|
|
646
635
|
* stable id (remove_tab selects by it); intercept the click so
|
|
@@ -827,11 +816,10 @@ function add_topic_card(gobj, id, text, icon, desc)
|
|
|
827
816
|
let $card = createElement2(
|
|
828
817
|
['a', {class: 'yui-nav-item yui-nav-card TREEDB_TOPIC_CARD',
|
|
829
818
|
href: '#', 'data-topic-href': id,
|
|
830
|
-
title:
|
|
831
|
-
'aria-label': t(text), 'data-i18n-aria-label': text}, [
|
|
819
|
+
title: text, 'aria-label': text}, [
|
|
832
820
|
['span', {class: 'icon is-medium'}, [['i', {class: icon || 'yi-table',
|
|
833
821
|
'aria-hidden': 'true'}]]],
|
|
834
|
-
['span', {class: 'yui-nav-label'
|
|
822
|
+
['span', {class: 'yui-nav-label'}, text_node(text)]
|
|
835
823
|
]]
|
|
836
824
|
);
|
|
837
825
|
$card.addEventListener("click", function(ev) {
|
|
@@ -868,7 +856,7 @@ function add_topic_card(gobj, id, text, icon, desc)
|
|
|
868
856
|
|
|
869
857
|
let $card = createElement2(
|
|
870
858
|
['div', {class: 'TREEDB_TOPIC_CARD', 'data-topic': topic}, [
|
|
871
|
-
['span', {class: 'TREEDB_TOPIC_CARD_NAME'
|
|
859
|
+
['span', {class: 'TREEDB_TOPIC_CARD_NAME'}, text_node(text)],
|
|
872
860
|
...topic_card_meta(desc),
|
|
873
861
|
['div', {class: 'TREEDB_TOPIC_CARD_ACTIONS'}, actions]
|
|
874
862
|
]]
|
|
@@ -1218,7 +1206,7 @@ function build_topic_info_panel(gobj, $info, topic, desc)
|
|
|
1218
1206
|
["h3", {class: "TREEDB_TOPIC_INFO_TITLE title is-5"}, [
|
|
1219
1207
|
["span", {class: "icon-text"}, [
|
|
1220
1208
|
["span", {class: "icon"}, [["i", {class: "yi-circle-info"}]]],
|
|
1221
|
-
["span", {
|
|
1209
|
+
["span", {}, text_node(topic)]
|
|
1222
1210
|
]]
|
|
1223
1211
|
]],
|
|
1224
1212
|
["table", {class: "table is-narrow TREEDB_TOPIC_INFO_META mb-4"}, [
|
|
@@ -1374,9 +1362,8 @@ function process_treedb_descs(gobj)
|
|
|
1374
1362
|
);
|
|
1375
1363
|
|
|
1376
1364
|
// TODO get icon from remote config
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
add_topic_card(gobj, id, /* i18n: data */ key, "yi-table", desc);
|
|
1365
|
+
add_tab(gobj, gobj_topic_form, id, key, "yi-table");
|
|
1366
|
+
add_topic_card(gobj, id, key, "yi-table", desc);
|
|
1380
1367
|
|
|
1381
1368
|
gobj_start(gobj_topic_form);
|
|
1382
1369
|
}
|
|
@@ -1397,7 +1384,7 @@ function process_treedb_descs(gobj)
|
|
|
1397
1384
|
if(gobj.priv._pending_info) {
|
|
1398
1385
|
let ti = gobj.priv._pending_info;
|
|
1399
1386
|
gobj.priv._pending_info = null;
|
|
1400
|
-
show_topic_info(gobj,
|
|
1387
|
+
show_topic_info(gobj, ti);
|
|
1401
1388
|
} else if(href && href.indexOf("?") >= 0) {
|
|
1402
1389
|
gobj_send_event(gobj, "EV_SHOW", {href: href}, gobj);
|
|
1403
1390
|
} else {
|
|
@@ -2764,7 +2751,7 @@ function ac_show(gobj, event, kw, src)
|
|
|
2764
2751
|
************************************************************/
|
|
2765
2752
|
function ac_show_topic_info(gobj, event, kw, src)
|
|
2766
2753
|
{
|
|
2767
|
-
show_topic_info(gobj,
|
|
2754
|
+
show_topic_info(gobj, kw && kw.topic);
|
|
2768
2755
|
return 0;
|
|
2769
2756
|
}
|
|
2770
2757
|
|
|
@@ -202,18 +202,12 @@ export const I18N_KEY_FUNCTIONS = Object.freeze([
|
|
|
202
202
|
{module: "c_yui_treedb_topics.js", name: "card_action_anchor", exported: false, keys: ["2"]},
|
|
203
203
|
{module: "c_yui_treedb_topics.js", name: "push_meta", exported: false, keys: ["0"]},
|
|
204
204
|
{module: "c_yui_treedb_topics.js", name: "relation", exported: false, keys: ["1"]},
|
|
205
|
-
{module: "c_yui_treedb_topics.js", name: "add_tab", exported: false, keys: ["3"]},
|
|
206
|
-
{module: "c_yui_treedb_topics.js", name: "add_topic_card", exported: false, keys: ["2"]},
|
|
207
|
-
{module: "c_yui_treedb_topics.js", name: "show_topic_info", exported: false, keys: ["1"]},
|
|
208
|
-
{module: "c_yui_treedb_topics.js", name: "build_topic_info_panel", exported: false, keys: ["2"]},
|
|
209
205
|
{module: "c_yui_treedb_topic_with_form.js", name: "confirm_then", exported: false, keys: ["1"]},
|
|
210
206
|
{module: "c_yui_treedb_topic_with_form.js", name: "present_json_popup", exported: false,
|
|
211
207
|
keys: ["1", "2.title"]},
|
|
212
208
|
{module: "c_yui_treedb_topic_with_form.js", name: "col_title_formatter", exported: false, keys: ["1.id"]},
|
|
213
209
|
{module: "c_yui_treedb_topic_with_form.js", name: "open_cell_json_dialog", exported: false, keys: ["2"]},
|
|
214
210
|
{module: "c_yui_treedb_topic_with_form.js", name: "open_cell_file_dialog", exported: false, keys: ["2"]},
|
|
215
|
-
{module: "c_yui_treedb_topic_with_form.js", name: "open_hook_choice_dialog", exported: false,
|
|
216
|
-
keys: ["1[].topic_name"]},
|
|
217
211
|
{module: "c_yui_schema_editor.js", name: "show_notice", exported: false, keys: ["1", "2"]},
|
|
218
212
|
{module: "c_yui_schema_editor.js", name: "toolbar_button", exported: false, keys: ["2"]},
|
|
219
213
|
{module: "c_yui_schema_editor.js", name: "row_icon", exported: false, keys: ["3"]},
|
|
@@ -1207,11 +1207,13 @@ describe("every forwarder is in the table", () => {
|
|
|
1207
1207
|
});
|
|
1208
1208
|
|
|
1209
1209
|
test("the 17 functions that were missing are found, with the table as it was", () => {
|
|
1210
|
+
/* Three of the 17 are gone: add_tab, add_topic_card and
|
|
1211
|
+
* build_topic_info_panel stopped translating the topic name (7.31.6),
|
|
1212
|
+
* so they hand no key on any more. */
|
|
1210
1213
|
let names = ["name_form_control", "create_form_field", "item_li", "item_iconbar",
|
|
1211
1214
|
"build_toolbar_action_item", "build_toolbar_brand_item", "build_toolbar_avatar_item",
|
|
1212
1215
|
"build_toolbar_connection_item", "open_toolbar_dropdown", "build_dropdown_row",
|
|
1213
|
-
"col_title_formatter", "
|
|
1214
|
-
"card_descriptor", "render_node"];
|
|
1216
|
+
"col_title_formatter", "card_descriptor", "render_node"];
|
|
1215
1217
|
let before = I18N_KEY_FUNCTIONS.filter((e) => !names.includes(e.name));
|
|
1216
1218
|
let found = find_forwarders(MODULES, ast_of, before);
|
|
1217
1219
|
let missing = new Set(found.missing.map((m) => m.name));
|