@yuneta/gobj-ui 7.23.1 → 7.23.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/README.md +13 -2
- package/dist/gobj-ui.cjs.js +262 -24
- package/dist/gobj-ui.es.js +262 -24
- package/package.json +1 -1
- package/src/c_yui_json.js +15 -1
- package/src/c_yui_json_graph.js +147 -4
- package/src/c_yui_treedb_topic_with_form.js +152 -10
package/README.md
CHANGED
|
@@ -439,8 +439,19 @@ the order of arrival: the viewer opens on the **tree** (`view_mode` default).
|
|
|
439
439
|
| `tree` | *where is this value, and what is around it* | the lazy view; the only one that can drill; the default |
|
|
440
440
|
| `graph` | *what shape is this* | a hosted `C_YUI_JSON_GRAPH` child (AntV/G6) |
|
|
441
441
|
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
Since `7.23.2` the schema and cell-JSON popups of `C_YUI_TREEDB_TOPIC_WITH_FORM`
|
|
443
|
+
present that viewer as a floating `C_YUI_WINDOW` on a laptop — movable,
|
|
444
|
+
resizable, maximisable, position remembered — and keep the modal sheet on a
|
|
445
|
+
phone. A JSON document is read *while* looking at the table it came from, which
|
|
446
|
+
a modal cannot allow; a phone has no room to arrange anything, so the sheet
|
|
447
|
+
stays. Note the close contract: `C_YUI_WINDOW.close_window()` calls `on_close`
|
|
448
|
+
and THEN destroys itself, so a host must drop its reference rather than destroy
|
|
449
|
+
the window too.
|
|
450
|
+
|
|
451
|
+
The graph carries **its own** toolbar, a **layout picker**
|
|
452
|
+
(`EV_CHANGE_LAYOUT {layout}`: `vertical tree`, `dagre top-down`,
|
|
453
|
+
`dagre left-right` — the layout and the edge type move together), and since
|
|
454
|
+
`7.22.0` the same two facilities the tree has: a **find box** (rate-limited, `EV_FIND_NODES`)
|
|
444
455
|
that highlights matching rows and outlines the cards they are in and says how
|
|
445
456
|
many matched, and **expand-all / collapse-all** (`EV_EXPAND_ALL` /
|
|
446
457
|
`EV_COLLAPSE_ALL`) that fold every card but the root, marking each cut with
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -3518,7 +3518,7 @@ function composed_title(gobj) {
|
|
|
3518
3518
|
* Below the mobile breakpoint the window is a full-screen
|
|
3519
3519
|
* sheet (no float / drag / resize).
|
|
3520
3520
|
************************************************************/
|
|
3521
|
-
function is_mobile$
|
|
3521
|
+
function is_mobile$3() {
|
|
3522
3522
|
return (window.innerWidth || document.documentElement.offsetWidth) <= MOBILE_MAX;
|
|
3523
3523
|
}
|
|
3524
3524
|
/************************************************************
|
|
@@ -3551,7 +3551,7 @@ function do_minimize(gobj) {
|
|
|
3551
3551
|
************************************************************/
|
|
3552
3552
|
function build_ui$15(gobj) {
|
|
3553
3553
|
ensure_window_style();
|
|
3554
|
-
let mobile = is_mobile$
|
|
3554
|
+
let mobile = is_mobile$3();
|
|
3555
3555
|
let header = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "header");
|
|
3556
3556
|
if ((0, _yuneta_gobj_js.is_gobj)(header)) header = (0, _yuneta_gobj_js.gobj_read_attr)(header, "$container");
|
|
3557
3557
|
if (!header) header = build_default_header(gobj);
|
|
@@ -3889,7 +3889,7 @@ function min$1(gobj) {
|
|
|
3889
3889
|
* handlers moving
|
|
3890
3890
|
************************************************************/
|
|
3891
3891
|
function mvStart(gobj, evt) {
|
|
3892
|
-
if (is_mobile$
|
|
3892
|
+
if (is_mobile$3()) return;
|
|
3893
3893
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
3894
3894
|
let window_rect = $container.getBoundingClientRect();
|
|
3895
3895
|
let x = evt.screenX;
|
|
@@ -4048,7 +4048,7 @@ function do_center(gobj, x, y, width, height) {
|
|
|
4048
4048
|
function handleResize(gobj) {
|
|
4049
4049
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4050
4050
|
if (!$container) return;
|
|
4051
|
-
if (is_mobile$
|
|
4051
|
+
if (is_mobile$3()) {
|
|
4052
4052
|
$container.classList.add("is-mobile-sheet");
|
|
4053
4053
|
let vw = window.innerWidth || document.documentElement.offsetWidth;
|
|
4054
4054
|
let vh = window.innerHeight || document.documentElement.offsetHeight;
|
|
@@ -9479,6 +9479,56 @@ var FOLD_SWALLOWED_EVENTS = [
|
|
|
9479
9479
|
"mousedown",
|
|
9480
9480
|
"click"
|
|
9481
9481
|
];
|
|
9482
|
+
var LAYOUTS$1 = {
|
|
9483
|
+
"json-tree": {
|
|
9484
|
+
label: "vertical tree",
|
|
9485
|
+
g6_layout: { type: "json-tree-layout" },
|
|
9486
|
+
edge_type: "cubic-vertical"
|
|
9487
|
+
},
|
|
9488
|
+
"dagre-tb": {
|
|
9489
|
+
label: "dagre top-down",
|
|
9490
|
+
g6_layout: {
|
|
9491
|
+
type: "antv-dagre",
|
|
9492
|
+
rankdir: "TB",
|
|
9493
|
+
nodesep: 20,
|
|
9494
|
+
ranksep: 40
|
|
9495
|
+
},
|
|
9496
|
+
edge_type: "polyline"
|
|
9497
|
+
},
|
|
9498
|
+
"dagre-lr": {
|
|
9499
|
+
label: "dagre left-right",
|
|
9500
|
+
g6_layout: {
|
|
9501
|
+
type: "antv-dagre",
|
|
9502
|
+
rankdir: "LR",
|
|
9503
|
+
nodesep: 20,
|
|
9504
|
+
ranksep: 40
|
|
9505
|
+
},
|
|
9506
|
+
edge_type: "polyline"
|
|
9507
|
+
}
|
|
9508
|
+
};
|
|
9509
|
+
var DEFAULT_LAYOUT = "json-tree";
|
|
9510
|
+
function get_layout_cfg$1(key) {
|
|
9511
|
+
return LAYOUTS$1[key] || LAYOUTS$1[DEFAULT_LAYOUT];
|
|
9512
|
+
}
|
|
9513
|
+
/************************************************************
|
|
9514
|
+
* A layout's label, with every key SPELLED OUT inside t().
|
|
9515
|
+
*
|
|
9516
|
+
* Never t(LAYOUTS[key].label) nor a `data-i18n` fed from that
|
|
9517
|
+
* table: the apps' validate-locales scans for t("literal"),
|
|
9518
|
+
* so a key reached through a variable is a key it cannot
|
|
9519
|
+
* demand — and i18next answers an undefined key with the key
|
|
9520
|
+
* itself, which renders in lower-case English and never
|
|
9521
|
+
* changes language. Twice already in this component's
|
|
9522
|
+
* history (7.20.0 `tree view`, and this table on its first
|
|
9523
|
+
* draft).
|
|
9524
|
+
************************************************************/
|
|
9525
|
+
function layout_label(key) {
|
|
9526
|
+
switch (key) {
|
|
9527
|
+
case "dagre-tb": return (0, i18next.t)("dagre top-down");
|
|
9528
|
+
case "dagre-lr": return (0, i18next.t)("dagre left-right");
|
|
9529
|
+
default: return (0, i18next.t)("vertical tree");
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9482
9532
|
/***************************************************************
|
|
9483
9533
|
* Data
|
|
9484
9534
|
***************************************************************/
|
|
@@ -9489,6 +9539,7 @@ var attrs_table$11 = [
|
|
|
9489
9539
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
|
|
9490
9540
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
|
|
9491
9541
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
|
|
9542
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
|
|
9492
9543
|
(0, _yuneta_gobj_js.SDATA_END)()
|
|
9493
9544
|
];
|
|
9494
9545
|
var PRIVATE_DATA$11 = {
|
|
@@ -9504,6 +9555,7 @@ var PRIVATE_DATA$11 = {
|
|
|
9504
9555
|
match_count: 0,
|
|
9505
9556
|
find_timer: null,
|
|
9506
9557
|
fold_listener: null,
|
|
9558
|
+
$layout_select: null,
|
|
9507
9559
|
$find_input: null,
|
|
9508
9560
|
$find_result: null,
|
|
9509
9561
|
$find_count: null
|
|
@@ -9678,6 +9730,7 @@ function build_ui$10(gobj) {
|
|
|
9678
9730
|
};
|
|
9679
9731
|
for (let type of FOLD_SWALLOWED_EVENTS) $mount.addEventListener(type, priv.fold_listener, true);
|
|
9680
9732
|
} else (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no canvas mount, fold handles are dead`);
|
|
9733
|
+
priv.$layout_select = $container.querySelector(".JSON_GRAPH_LAYOUT");
|
|
9681
9734
|
priv.$find_input = $container.querySelector(".JSON_GRAPH_FIND_INPUT");
|
|
9682
9735
|
priv.$find_result = $container.querySelector(".JSON_GRAPH_FIND_RESULT");
|
|
9683
9736
|
priv.$find_count = $container.querySelector(".JSON_GRAPH_FIND_COUNT");
|
|
@@ -9835,7 +9888,42 @@ function make_toolbar$3(gobj) {
|
|
|
9835
9888
|
} }
|
|
9836
9889
|
]);
|
|
9837
9890
|
}
|
|
9838
|
-
let
|
|
9891
|
+
let current_layout = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "layout") || DEFAULT_LAYOUT;
|
|
9892
|
+
let options = Object.keys(LAYOUTS$1).map(function(key) {
|
|
9893
|
+
let attrs = {
|
|
9894
|
+
value: key,
|
|
9895
|
+
"data-i18n": LAYOUTS$1[key].label
|
|
9896
|
+
};
|
|
9897
|
+
if (key === current_layout) attrs.selected = "selected";
|
|
9898
|
+
return [
|
|
9899
|
+
"option",
|
|
9900
|
+
attrs,
|
|
9901
|
+
layout_label(key)
|
|
9902
|
+
];
|
|
9903
|
+
});
|
|
9904
|
+
let right_items = [
|
|
9905
|
+
(0, _yuneta_gobj_js.createElement2)([
|
|
9906
|
+
"select",
|
|
9907
|
+
{
|
|
9908
|
+
class: "JSON_GRAPH_LAYOUT select",
|
|
9909
|
+
style: {
|
|
9910
|
+
height: toolbar_wide,
|
|
9911
|
+
"margin-left": "0.5em"
|
|
9912
|
+
},
|
|
9913
|
+
title: (0, i18next.t)("layout"),
|
|
9914
|
+
"data-i18n-title": "layout",
|
|
9915
|
+
"aria-label": (0, i18next.t)("layout"),
|
|
9916
|
+
"data-i18n-aria-label": "layout"
|
|
9917
|
+
},
|
|
9918
|
+
options,
|
|
9919
|
+
{ change: (evt) => {
|
|
9920
|
+
evt.stopPropagation();
|
|
9921
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: evt.target.value }, gobj);
|
|
9922
|
+
} }
|
|
9923
|
+
]),
|
|
9924
|
+
graph_fold_button(gobj, "EV_EXPAND_ALL", "expand all", true),
|
|
9925
|
+
graph_fold_button(gobj, "EV_COLLAPSE_ALL", "collapse all", false)
|
|
9926
|
+
];
|
|
9839
9927
|
const $toolbar = yui_toolbar({}, [
|
|
9840
9928
|
[
|
|
9841
9929
|
"div",
|
|
@@ -9861,6 +9949,7 @@ function make_toolbar$3(gobj) {
|
|
|
9861
9949
|
************************************************************/
|
|
9862
9950
|
function build_graph$3(gobj) {
|
|
9863
9951
|
let priv = gobj.priv;
|
|
9952
|
+
let layout_cfg = get_layout_cfg$1((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "layout"));
|
|
9864
9953
|
const graph = priv.graph = new _antv_g6.Graph({
|
|
9865
9954
|
container: priv.canvas_id,
|
|
9866
9955
|
animation: false,
|
|
@@ -9868,14 +9957,14 @@ function build_graph$3(gobj) {
|
|
|
9868
9957
|
zoomRange: [.1, 4],
|
|
9869
9958
|
node: { style: { labelPlacement: "center" } },
|
|
9870
9959
|
edge: {
|
|
9871
|
-
type:
|
|
9960
|
+
type: layout_cfg.edge_type,
|
|
9872
9961
|
style: {
|
|
9873
9962
|
stroke: "#999",
|
|
9874
9963
|
lineWidth: 1,
|
|
9875
9964
|
endArrow: true
|
|
9876
9965
|
}
|
|
9877
9966
|
},
|
|
9878
|
-
layout:
|
|
9967
|
+
layout: layout_cfg.g6_layout,
|
|
9879
9968
|
behaviors: ["drag-canvas", "zoom-canvas"]
|
|
9880
9969
|
});
|
|
9881
9970
|
if (priv.theme) graph.setTheme(priv.theme);
|
|
@@ -10302,6 +10391,34 @@ function ac_refresh$5(gobj, event, kw, src) {
|
|
|
10302
10391
|
}
|
|
10303
10392
|
/************************************************************
|
|
10304
10393
|
* {theme: "dark"|"light"} — the app switched theme.
|
|
10394
|
+
* EV_CHANGE_LAYOUT { layout }
|
|
10395
|
+
*
|
|
10396
|
+
* The layout AND the edge type move together — a vertical
|
|
10397
|
+
* layout with horizontal cubics draws every edge the wrong way
|
|
10398
|
+
* round — and then the graph is rebuilt and refitted, because a
|
|
10399
|
+
* new layout is a new shape and the old camera framed the old
|
|
10400
|
+
* one.
|
|
10401
|
+
************************************************************/
|
|
10402
|
+
function ac_change_layout$1(gobj, event, kw, src) {
|
|
10403
|
+
let priv = gobj.priv;
|
|
10404
|
+
let key = kw && kw.layout || "";
|
|
10405
|
+
if (!LAYOUTS$1[key]) {
|
|
10406
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: unknown layout '${key}'`);
|
|
10407
|
+
return -1;
|
|
10408
|
+
}
|
|
10409
|
+
if (key === (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "layout")) return 0;
|
|
10410
|
+
(0, _yuneta_gobj_js.gobj_write_str_attr)(gobj, "layout", key);
|
|
10411
|
+
if (priv.$layout_select && priv.$layout_select.value !== key) priv.$layout_select.value = key;
|
|
10412
|
+
let cfg = get_layout_cfg$1(key);
|
|
10413
|
+
if (priv.graph) priv.graph.setOptions({
|
|
10414
|
+
layout: cfg.g6_layout,
|
|
10415
|
+
edge: { type: cfg.edge_type }
|
|
10416
|
+
});
|
|
10417
|
+
refresh_json(gobj);
|
|
10418
|
+
update_find_result(gobj);
|
|
10419
|
+
return 0;
|
|
10420
|
+
}
|
|
10421
|
+
/************************************************************
|
|
10305
10422
|
* EV_TOGGLE_FOLD { path } — fold or unfold ONE card.
|
|
10306
10423
|
*
|
|
10307
10424
|
* The camera does not move: folding one branch is a local
|
|
@@ -10516,6 +10633,11 @@ function create_gclass$11(gclass_name) {
|
|
|
10516
10633
|
ac_toggle_fold,
|
|
10517
10634
|
null
|
|
10518
10635
|
],
|
|
10636
|
+
[
|
|
10637
|
+
"EV_CHANGE_LAYOUT",
|
|
10638
|
+
ac_change_layout$1,
|
|
10639
|
+
null
|
|
10640
|
+
],
|
|
10519
10641
|
[
|
|
10520
10642
|
"EV_EXPAND_ALL",
|
|
10521
10643
|
ac_expand_all$2,
|
|
@@ -10577,6 +10699,7 @@ function create_gclass$11(gclass_name) {
|
|
|
10577
10699
|
["EV_REFRESH", 0],
|
|
10578
10700
|
["EV_FIND_NODES", 0],
|
|
10579
10701
|
["EV_TOGGLE_FOLD", 0],
|
|
10702
|
+
["EV_CHANGE_LAYOUT", 0],
|
|
10580
10703
|
["EV_EXPAND_ALL", 0],
|
|
10581
10704
|
["EV_COLLAPSE_ALL", 0],
|
|
10582
10705
|
["EV_THEME", 0],
|
|
@@ -10910,12 +11033,13 @@ function mt_start$10(gobj) {
|
|
|
10910
11033
|
/***************************************************************
|
|
10911
11034
|
* Framework Method: Stop
|
|
10912
11035
|
***************************************************************/
|
|
10913
|
-
function mt_stop$10(gobj) {
|
|
11036
|
+
function mt_stop$10(gobj) {
|
|
11037
|
+
teardown_graph_child(gobj);
|
|
11038
|
+
}
|
|
10914
11039
|
/***************************************************************
|
|
10915
11040
|
* Framework Method: Destroy
|
|
10916
11041
|
***************************************************************/
|
|
10917
11042
|
function mt_destroy$10(gobj) {
|
|
10918
|
-
teardown_graph_child(gobj);
|
|
10919
11043
|
destroy_ui$5(gobj);
|
|
10920
11044
|
}
|
|
10921
11045
|
/***************************
|
|
@@ -16215,7 +16339,7 @@ function treedb_delete_node$1(gobj, treedb_name, topic_name, record, options) {
|
|
|
16215
16339
|
/************************************************************
|
|
16216
16340
|
* True on a phone-width viewport (Bulma's mobile breakpoint).
|
|
16217
16341
|
************************************************************/
|
|
16218
|
-
function is_mobile$
|
|
16342
|
+
function is_mobile$2() {
|
|
16219
16343
|
return typeof window !== "undefined" && window.innerWidth <= 768;
|
|
16220
16344
|
}
|
|
16221
16345
|
/************************************************************
|
|
@@ -16234,7 +16358,7 @@ function open_json_viewer$1(gobj) {
|
|
|
16234
16358
|
yui_shell_show_error(yui_shell_of(gobj), "raw json viewer unavailable", { t: i18next.t });
|
|
16235
16359
|
return;
|
|
16236
16360
|
}
|
|
16237
|
-
let mobile = is_mobile$
|
|
16361
|
+
let mobile = is_mobile$2();
|
|
16238
16362
|
let shell = yui_shell_of(gobj);
|
|
16239
16363
|
let jv = (0, _yuneta_gobj_js.gobj_create_service)(`treedb-topics-json-${(0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj))}`, "C_YUI_JSON", { subscriber: gobj }, gobj);
|
|
16240
16364
|
if (!jv) {
|
|
@@ -17447,10 +17571,102 @@ var PRIVATE_DATA$5 = {
|
|
|
17447
17571
|
form_modal: null,
|
|
17448
17572
|
schema_gobj: null,
|
|
17449
17573
|
schema_modal: null,
|
|
17574
|
+
schema_win: null,
|
|
17450
17575
|
cell_json_gobj: null,
|
|
17451
|
-
cell_json_modal: null
|
|
17576
|
+
cell_json_modal: null,
|
|
17577
|
+
cell_json_win: null
|
|
17452
17578
|
};
|
|
17453
17579
|
var __gclass__$5 = null;
|
|
17580
|
+
function is_mobile$1() {
|
|
17581
|
+
return typeof window !== "undefined" && window.innerWidth <= 768;
|
|
17582
|
+
}
|
|
17583
|
+
/************************************************************
|
|
17584
|
+
* Present a JSON viewer's $container.
|
|
17585
|
+
*
|
|
17586
|
+
* On a LAPTOP a floating C_YUI_WINDOW: a JSON document is
|
|
17587
|
+
* something you read WHILE looking at the table behind it —
|
|
17588
|
+
* you move it, you resize it, you maximise it when the
|
|
17589
|
+
* document is big. A modal can do none of that, and it
|
|
17590
|
+
* darkens exactly the rows you opened the cell from.
|
|
17591
|
+
*
|
|
17592
|
+
* On a phone the modal sheet stays: there is no room to
|
|
17593
|
+
* arrange anything, and the sheet already carries the shell's
|
|
17594
|
+
* Escape / Back handling.
|
|
17595
|
+
*
|
|
17596
|
+
* Returns {win, modal} — exactly one of them is set.
|
|
17597
|
+
************************************************************/
|
|
17598
|
+
function present_json_popup(gobj, $box, opts) {
|
|
17599
|
+
let shell = yui_shell_of(gobj);
|
|
17600
|
+
if (!shell) {
|
|
17601
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no shell, cannot present the json`);
|
|
17602
|
+
return null;
|
|
17603
|
+
}
|
|
17604
|
+
if (is_mobile$1()) return {
|
|
17605
|
+
modal: yui_shell_show_modal(shell, $box, {
|
|
17606
|
+
dialog: true,
|
|
17607
|
+
logical_class: opts.logical_class + "_SHEET",
|
|
17608
|
+
title_prefix: opts.title_prefix,
|
|
17609
|
+
title: opts.title,
|
|
17610
|
+
t: i18next.t,
|
|
17611
|
+
on_close: opts.on_close
|
|
17612
|
+
}),
|
|
17613
|
+
win: null
|
|
17614
|
+
};
|
|
17615
|
+
let win = (0, _yuneta_gobj_js.gobj_create_service)(opts.name, "C_YUI_WINDOW", {
|
|
17616
|
+
$parent: popup_mount_layer(gobj),
|
|
17617
|
+
subscriber: null,
|
|
17618
|
+
modal: false,
|
|
17619
|
+
showMax: true,
|
|
17620
|
+
showFooter: false,
|
|
17621
|
+
resizable: true,
|
|
17622
|
+
center: true,
|
|
17623
|
+
auto_save_size_and_position: true,
|
|
17624
|
+
width: 720,
|
|
17625
|
+
height: 620,
|
|
17626
|
+
logical_class: opts.logical_class + "_WINDOW",
|
|
17627
|
+
title_prefix: opts.title_prefix,
|
|
17628
|
+
title: opts.title,
|
|
17629
|
+
icon: opts.icon,
|
|
17630
|
+
body: $box,
|
|
17631
|
+
manager: null,
|
|
17632
|
+
on_close: function() {
|
|
17633
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
17634
|
+
opts.forget_window();
|
|
17635
|
+
opts.on_close();
|
|
17636
|
+
}
|
|
17637
|
+
}, gobj);
|
|
17638
|
+
if (!win) {
|
|
17639
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot create the json window`);
|
|
17640
|
+
return null;
|
|
17641
|
+
}
|
|
17642
|
+
(0, _yuneta_gobj_js.gobj_start)(win);
|
|
17643
|
+
return {
|
|
17644
|
+
win,
|
|
17645
|
+
modal: null
|
|
17646
|
+
};
|
|
17647
|
+
}
|
|
17648
|
+
/************************************************************
|
|
17649
|
+
* Retire a presenting window: reference cleared FIRST, then
|
|
17650
|
+
* stop, then destroy.
|
|
17651
|
+
*
|
|
17652
|
+
* The order is the whole content of this function. The ✕ of
|
|
17653
|
+
* the window calls back into the teardown that calls this, so
|
|
17654
|
+
* clearing the reference first is what stops the recursion.
|
|
17655
|
+
* And it is STOP then destroy because the window was started
|
|
17656
|
+
* on open: handing a running gobj to gobj_destroy() makes the
|
|
17657
|
+
* framework rescue it and say so — "Destroying a RUNNING
|
|
17658
|
+
* gobj" — which is a caller's bug, not a framework message.
|
|
17659
|
+
* Same lesson `c_tranger_view.close_json_viewer` carries.
|
|
17660
|
+
************************************************************/
|
|
17661
|
+
function retire_popup_window(win) {
|
|
17662
|
+
if (!win) return;
|
|
17663
|
+
try {
|
|
17664
|
+
if ((0, _yuneta_gobj_js.gobj_is_running)(win)) (0, _yuneta_gobj_js.gobj_stop)(win);
|
|
17665
|
+
(0, _yuneta_gobj_js.gobj_destroy)(win);
|
|
17666
|
+
} catch (e) {
|
|
17667
|
+
(0, _yuneta_gobj_js.log_warning)(`${GCLASS_NAME$5}: json window already gone: ${e}`);
|
|
17668
|
+
}
|
|
17669
|
+
}
|
|
17454
17670
|
function popup_mount_layer(gobj) {
|
|
17455
17671
|
let $layer = yui_shell_popup_layer(yui_shell_of(gobj));
|
|
17456
17672
|
if ($layer) return $layer;
|
|
@@ -18621,8 +18837,7 @@ function open_schema_dialog(gobj) {
|
|
|
18621
18837
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no desc, no schema to show`);
|
|
18622
18838
|
return;
|
|
18623
18839
|
}
|
|
18624
|
-
|
|
18625
|
-
if (!shell) {
|
|
18840
|
+
if (!yui_shell_of(gobj)) {
|
|
18626
18841
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no shell, cannot open the schema view`);
|
|
18627
18842
|
return;
|
|
18628
18843
|
}
|
|
@@ -18639,16 +18854,25 @@ function open_schema_dialog(gobj) {
|
|
|
18639
18854
|
teardown_schema_child(gobj);
|
|
18640
18855
|
return;
|
|
18641
18856
|
}
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
logical_class: "
|
|
18857
|
+
let presented = present_json_popup(gobj, $box, {
|
|
18858
|
+
name: "schemawin_" + (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj)),
|
|
18859
|
+
logical_class: "TREEDB_SCHEMA",
|
|
18645
18860
|
title_prefix: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"),
|
|
18646
18861
|
title: "schema",
|
|
18647
|
-
|
|
18862
|
+
icon: "yi-table",
|
|
18863
|
+
forget_window: function() {
|
|
18864
|
+
priv.schema_win = null;
|
|
18865
|
+
},
|
|
18648
18866
|
on_close: function() {
|
|
18649
18867
|
teardown_schema_child(gobj);
|
|
18650
18868
|
}
|
|
18651
18869
|
});
|
|
18870
|
+
if (!presented) {
|
|
18871
|
+
teardown_schema_child(gobj);
|
|
18872
|
+
return;
|
|
18873
|
+
}
|
|
18874
|
+
priv.schema_modal = presented.modal;
|
|
18875
|
+
priv.schema_win = presented.win;
|
|
18652
18876
|
(0, _yuneta_gobj_js.gobj_send_event)(json_view, "EV_SET_JSON", { json: desc }, gobj);
|
|
18653
18877
|
}
|
|
18654
18878
|
/************************************************************
|
|
@@ -18663,6 +18887,9 @@ function teardown_schema_child(gobj) {
|
|
|
18663
18887
|
(0, _yuneta_gobj_js.gobj_destroy)(priv.schema_gobj);
|
|
18664
18888
|
priv.schema_gobj = null;
|
|
18665
18889
|
}
|
|
18890
|
+
let win = priv.schema_win;
|
|
18891
|
+
priv.schema_win = null;
|
|
18892
|
+
retire_popup_window(win);
|
|
18666
18893
|
priv.schema_modal = null;
|
|
18667
18894
|
}
|
|
18668
18895
|
/************************************************************
|
|
@@ -18709,8 +18936,7 @@ function open_cell_json_dialog(gobj, row_id, col_id) {
|
|
|
18709
18936
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: row '${row_id}' has no col '${col_id}'`);
|
|
18710
18937
|
return;
|
|
18711
18938
|
}
|
|
18712
|
-
|
|
18713
|
-
if (!shell) {
|
|
18939
|
+
if (!yui_shell_of(gobj)) {
|
|
18714
18940
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no shell, cannot open the cell json`);
|
|
18715
18941
|
return;
|
|
18716
18942
|
}
|
|
@@ -18727,16 +18953,25 @@ function open_cell_json_dialog(gobj, row_id, col_id) {
|
|
|
18727
18953
|
teardown_cell_json_child(gobj);
|
|
18728
18954
|
return;
|
|
18729
18955
|
}
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
logical_class: "
|
|
18956
|
+
let presented = present_json_popup(gobj, $box, {
|
|
18957
|
+
name: "cellwin_" + (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj)),
|
|
18958
|
+
logical_class: "TREEDB_CELL_JSON",
|
|
18733
18959
|
title_prefix: String(row_id),
|
|
18734
18960
|
title: col_id,
|
|
18735
|
-
|
|
18961
|
+
icon: "yi-js-square",
|
|
18962
|
+
forget_window: function() {
|
|
18963
|
+
priv.cell_json_win = null;
|
|
18964
|
+
},
|
|
18736
18965
|
on_close: function() {
|
|
18737
18966
|
teardown_cell_json_child(gobj);
|
|
18738
18967
|
}
|
|
18739
18968
|
});
|
|
18969
|
+
if (!presented) {
|
|
18970
|
+
teardown_cell_json_child(gobj);
|
|
18971
|
+
return;
|
|
18972
|
+
}
|
|
18973
|
+
priv.cell_json_modal = presented.modal;
|
|
18974
|
+
priv.cell_json_win = presented.win;
|
|
18740
18975
|
(0, _yuneta_gobj_js.gobj_send_event)(json_view, "EV_SET_JSON", { json: value }, gobj);
|
|
18741
18976
|
}
|
|
18742
18977
|
/************************************************************
|
|
@@ -18751,6 +18986,9 @@ function teardown_cell_json_child(gobj) {
|
|
|
18751
18986
|
(0, _yuneta_gobj_js.gobj_destroy)(priv.cell_json_gobj);
|
|
18752
18987
|
priv.cell_json_gobj = null;
|
|
18753
18988
|
}
|
|
18989
|
+
let win = priv.cell_json_win;
|
|
18990
|
+
priv.cell_json_win = null;
|
|
18991
|
+
retire_popup_window(win);
|
|
18754
18992
|
priv.cell_json_modal = null;
|
|
18755
18993
|
}
|
|
18756
18994
|
/************************************************************
|