@yuneta/gobj-ui 7.23.168 → 7.23.169
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 +2 -2
- package/dist/gobj-ui.cjs.js +390 -92
- package/dist/gobj-ui.es.js +390 -92
- package/package.json +1 -1
- package/src/broadcast_attrs.test.js +115 -0
- package/src/c_g6_nodes_tree.js +208 -19
- package/src/c_yui_treedb_topic_with_form.js +201 -68
- package/src/yui_row_search.js +56 -27
- package/src/yui_row_search.test.js +51 -1
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -25563,49 +25563,65 @@ function yui_icon_is_defined(name) {
|
|
|
25563
25563
|
/***********************************************************************
|
|
25564
25564
|
* yui_row_search.js
|
|
25565
25565
|
*
|
|
25566
|
-
*
|
|
25567
|
-
*
|
|
25568
|
-
*
|
|
25569
|
-
*
|
|
25570
|
-
*
|
|
25571
|
-
* `[
|
|
25572
|
-
*
|
|
25573
|
-
*
|
|
25574
|
-
*
|
|
25575
|
-
*
|
|
25576
|
-
*
|
|
25577
|
-
*
|
|
25578
|
-
*
|
|
25579
|
-
*
|
|
25580
|
-
*
|
|
25581
|
-
*
|
|
25582
|
-
*
|
|
25583
|
-
*
|
|
25584
|
-
*
|
|
25585
|
-
*
|
|
25586
|
-
*
|
|
25587
|
-
*
|
|
25588
|
-
*
|
|
25589
|
-
*
|
|
25590
|
-
*
|
|
25566
|
+
* IS THIS TERM IN THIS ROW?
|
|
25567
|
+
*
|
|
25568
|
+
* The search box of a treedb table looked at the row's values with
|
|
25569
|
+
* `String(val)`, and a treedb row is not flat: an fkey arrives as a
|
|
25570
|
+
* LIST OF OBJECTS `[{id, topic_name, hook_name}]`, and `String()`
|
|
25571
|
+
* of that is `"[object Object]"`. So looking for the workshop of
|
|
25572
|
+
* a device -- which is where the datum an operator has in mind
|
|
25573
|
+
* lives -- never found anything, and the box gave no hint that it
|
|
25574
|
+
* had looked somewhere else.
|
|
25575
|
+
*
|
|
25576
|
+
* THREE RULES, AND THE LAST TWO ARE WHAT MAKE IT USEFUL:
|
|
25577
|
+
*
|
|
25578
|
+
* - It walks down lists and objects to a short depth: an fkey is
|
|
25579
|
+
* two levels down and nothing anybody searches for is deeper.
|
|
25580
|
+
* - **Of an fkey only the `id` is looked at.** `topic_name` and
|
|
25581
|
+
* `hook_name` are the SAME two words on every row, so looking at
|
|
25582
|
+
* them turns the term into a wildcard: searching "devices" would
|
|
25583
|
+
* bring the whole topic. The `id` is the only thing that names
|
|
25584
|
+
* the linked thing.
|
|
25585
|
+
* - **A hook read as its COUNT is not looked at at all.** Since
|
|
25586
|
+
* `hook_size` (7.23.163) a topic table loads a hook as
|
|
25587
|
+
* `[{"size": N}]` instead of the id of every child, and that
|
|
25588
|
+
* number is not a value of the row: matching it made "5" answer
|
|
25589
|
+
* every row whose hook happens to hold 5 children, next to the
|
|
25590
|
+
* rows that really say 5. A count nobody can see in the cell as
|
|
25591
|
+
* text is not what a person typing in a search box is after.
|
|
25592
|
+
*
|
|
25593
|
+
* Keys that start with `_` are not looked at on any level: they
|
|
25594
|
+
* belong to the scaffolding (`_check_box_state_`, `_operation`) or
|
|
25595
|
+
* are metadata (`__md_treedb__`), and nobody searches by them.
|
|
25591
25596
|
*
|
|
25592
|
-
* Copyright (c) 2026, ArtGins.
|
|
25597
|
+
* Copyright (c) 2024-2026, ArtGins.
|
|
25593
25598
|
* All Rights Reserved.
|
|
25594
25599
|
***********************************************************************/
|
|
25595
25600
|
var MAX_DEPTH = 4;
|
|
25596
25601
|
/***************************************************************
|
|
25597
|
-
*
|
|
25602
|
+
* An fkey, as `nodes` answers it with `list_dict`.
|
|
25598
25603
|
***************************************************************/
|
|
25599
25604
|
function is_fkey_ref(value) {
|
|
25600
25605
|
return !!value && typeof value === "object" && !Array.isArray(value) && "id" in value && "topic_name" in value && "hook_name" in value;
|
|
25601
25606
|
}
|
|
25602
25607
|
/***************************************************************
|
|
25603
|
-
*
|
|
25604
|
-
*
|
|
25608
|
+
* A hook read with `hook_size`: the COUNT of its children,
|
|
25609
|
+
* `[{"size": N}]`, in the place of the children themselves.
|
|
25610
|
+
* The same shape `delete_impact`'s `ref_count()` reads.
|
|
25611
|
+
***************************************************************/
|
|
25612
|
+
function is_hook_size(value) {
|
|
25613
|
+
if (!Array.isArray(value) || value.length !== 1) return false;
|
|
25614
|
+
const first = value[0];
|
|
25615
|
+
return !!first && typeof first === "object" && !Array.isArray(first) && typeof first.size === "number" && Object.keys(first).length === 1;
|
|
25616
|
+
}
|
|
25617
|
+
/***************************************************************
|
|
25618
|
+
* Does `value` hold the term? The term comes ALREADY in lower
|
|
25619
|
+
* case: whoever searches lowers it once, not once per cell.
|
|
25605
25620
|
***************************************************************/
|
|
25606
25621
|
function value_matches(value, term, depth) {
|
|
25607
25622
|
if (value === null || value === void 0) return false;
|
|
25608
25623
|
if (depth > MAX_DEPTH) return false;
|
|
25624
|
+
if (is_hook_size(value)) return false;
|
|
25609
25625
|
if (Array.isArray(value)) return value.some((v) => value_matches(v, term, depth + 1));
|
|
25610
25626
|
if (typeof value === "object") {
|
|
25611
25627
|
if (is_fkey_ref(value)) return value_matches(value.id, term, depth + 1);
|
|
@@ -25617,7 +25633,7 @@ function value_matches(value, term, depth) {
|
|
|
25617
25633
|
return String(value).toLowerCase().includes(term);
|
|
25618
25634
|
}
|
|
25619
25635
|
/***************************************************************
|
|
25620
|
-
*
|
|
25636
|
+
* Is the term anywhere in this row?
|
|
25621
25637
|
***************************************************************/
|
|
25622
25638
|
function row_matches(row, term) {
|
|
25623
25639
|
if (!row || typeof row !== "object" || !term) return false;
|
|
@@ -25823,8 +25839,8 @@ var attrs_table$5 = [
|
|
|
25823
25839
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_checkbox", 0, true, "Auxiliary first column to select rows"),
|
|
25824
25840
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_radio", 0, false, "Auxiliary first column to select one row"),
|
|
25825
25841
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_selection_bar", 0, false, "Show the shared selection bar (\"N selected\" + a way out) above the table while in edition mode. OFF by default: the bar takes its words from the HOST's i18n, and a host that has not defined \"{{n}} selected\" and \"clear selection\" would render the keys"),
|
|
25826
|
-
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "broadcast_select_rows_event", 0, false, "
|
|
25827
|
-
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "broadcast_unselect_rows_event", 0, false, "
|
|
25842
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "broadcast_select_rows_event", 0, false, "Publish EV_SELECT_ROWS to the subscriber. OFF by default: the event is an OUTPUT event, so a host that turns it on must declare EV_SELECT_ROWS in its own FSM or it answers \"Event NOT DEFINED in state\" on every selected row"),
|
|
25843
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "broadcast_unselect_rows_event", 0, false, "Publish EV_UNSELECT_ROWS to the subscriber. Same contract as broadcast_select_rows_event, and INDEPENDENT of it: a host that wants both sets both"),
|
|
25828
25844
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "tabulator_settings", 0, {
|
|
25829
25845
|
layout: "fitDataFill",
|
|
25830
25846
|
columnDefaults: { resizable: true },
|
|
@@ -26103,7 +26119,11 @@ function build_ui$5(gobj) {
|
|
|
26103
26119
|
"button",
|
|
26104
26120
|
{
|
|
26105
26121
|
id: ``,
|
|
26106
|
-
class: "button button-edit-record mr-1"
|
|
26122
|
+
class: "button button-edit-record mr-1",
|
|
26123
|
+
title: (0, i18next.t)("edit"),
|
|
26124
|
+
"data-i18n-title": "edit",
|
|
26125
|
+
"aria-label": (0, i18next.t)("edit"),
|
|
26126
|
+
"data-i18n-aria-label": "edit"
|
|
26107
26127
|
},
|
|
26108
26128
|
[yui_toolbar_icon("yi-pen"), [
|
|
26109
26129
|
"span",
|
|
@@ -26126,6 +26146,10 @@ function build_ui$5(gobj) {
|
|
|
26126
26146
|
{
|
|
26127
26147
|
id: ``,
|
|
26128
26148
|
class: "button button-new-record mr-1",
|
|
26149
|
+
title: (0, i18next.t)("new"),
|
|
26150
|
+
"data-i18n-title": "new",
|
|
26151
|
+
"aria-label": (0, i18next.t)("new"),
|
|
26152
|
+
"data-i18n-aria-label": "new",
|
|
26129
26153
|
disabled: true
|
|
26130
26154
|
},
|
|
26131
26155
|
[yui_toolbar_icon("yi-plus"), [
|
|
@@ -26150,6 +26174,10 @@ function build_ui$5(gobj) {
|
|
|
26150
26174
|
{
|
|
26151
26175
|
id: ``,
|
|
26152
26176
|
class: "button button-delete-record mr-1",
|
|
26177
|
+
title: (0, i18next.t)("delete"),
|
|
26178
|
+
"data-i18n-title": "delete",
|
|
26179
|
+
"aria-label": (0, i18next.t)("delete"),
|
|
26180
|
+
"data-i18n-aria-label": "delete",
|
|
26153
26181
|
disabled: true
|
|
26154
26182
|
},
|
|
26155
26183
|
[yui_toolbar_icon("yi-trash"), [
|
|
@@ -26174,6 +26202,10 @@ function build_ui$5(gobj) {
|
|
|
26174
26202
|
{
|
|
26175
26203
|
id: ``,
|
|
26176
26204
|
class: "button button-copy-record mr-1",
|
|
26205
|
+
title: (0, i18next.t)("copy"),
|
|
26206
|
+
"data-i18n-title": "copy",
|
|
26207
|
+
"aria-label": (0, i18next.t)("copy"),
|
|
26208
|
+
"data-i18n-aria-label": "copy",
|
|
26177
26209
|
disabled: true
|
|
26178
26210
|
},
|
|
26179
26211
|
[yui_toolbar_icon("yi-copy"), [
|
|
@@ -26198,6 +26230,10 @@ function build_ui$5(gobj) {
|
|
|
26198
26230
|
{
|
|
26199
26231
|
id: ``,
|
|
26200
26232
|
class: "button button-paste-record mr-1",
|
|
26233
|
+
title: (0, i18next.t)("paste"),
|
|
26234
|
+
"data-i18n-title": "paste",
|
|
26235
|
+
"aria-label": (0, i18next.t)("paste"),
|
|
26236
|
+
"data-i18n-aria-label": "paste",
|
|
26201
26237
|
disabled: true
|
|
26202
26238
|
},
|
|
26203
26239
|
[yui_toolbar_icon("yi-paste"), [
|
|
@@ -26237,7 +26273,11 @@ function build_ui$5(gobj) {
|
|
|
26237
26273
|
class: "input",
|
|
26238
26274
|
type: "text",
|
|
26239
26275
|
placeholder: (0, i18next.t)("search"),
|
|
26240
|
-
"data-i18n-placeholder": "search"
|
|
26276
|
+
"data-i18n-placeholder": "search",
|
|
26277
|
+
title: (0, i18next.t)("search"),
|
|
26278
|
+
"data-i18n-title": "search",
|
|
26279
|
+
"aria-label": (0, i18next.t)("search"),
|
|
26280
|
+
"data-i18n-aria-label": "search"
|
|
26241
26281
|
}], [
|
|
26242
26282
|
"span",
|
|
26243
26283
|
{ class: "icon is-left" },
|
|
@@ -26257,7 +26297,9 @@ function build_ui$5(gobj) {
|
|
|
26257
26297
|
{
|
|
26258
26298
|
class: "button mr-1",
|
|
26259
26299
|
title: (0, i18next.t)("refresh"),
|
|
26260
|
-
"data-i18n-title": "refresh"
|
|
26300
|
+
"data-i18n-title": "refresh",
|
|
26301
|
+
"aria-label": (0, i18next.t)("refresh"),
|
|
26302
|
+
"data-i18n-aria-label": "refresh"
|
|
26261
26303
|
},
|
|
26262
26304
|
[yui_toolbar_icon("yi-arrows-rotate"), [
|
|
26263
26305
|
"span",
|
|
@@ -26790,7 +26832,7 @@ function create_tabulator(gobj) {
|
|
|
26790
26832
|
let index = cell.getRow().getPosition();
|
|
26791
26833
|
if (e.target.closest(".edit")) {
|
|
26792
26834
|
e.stopPropagation();
|
|
26793
|
-
|
|
26835
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDIT_RECORD", { index }, gobj);
|
|
26794
26836
|
} else if (e.target.closest(".remove")) {
|
|
26795
26837
|
e.stopPropagation();
|
|
26796
26838
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_DELETE_ROWS", {
|
|
@@ -27252,11 +27294,11 @@ function open_form_dialog(gobj, mode, record) {
|
|
|
27252
27294
|
return;
|
|
27253
27295
|
}
|
|
27254
27296
|
let pkey = desc.pkey || "id";
|
|
27255
|
-
let title;
|
|
27256
|
-
|
|
27257
|
-
|
|
27297
|
+
let title = mode === "create" ? "new" : mode === "view" ? "view" : "edit";
|
|
27298
|
+
let title_prefix = "";
|
|
27299
|
+
if (mode !== "create") {
|
|
27258
27300
|
let rid = record ? String(record[pkey] ?? "") : "";
|
|
27259
|
-
|
|
27301
|
+
title_prefix = (0, _yuneta_gobj_js.empty_string)(rid) ? "" : rid;
|
|
27260
27302
|
}
|
|
27261
27303
|
let view_only = mode === "view";
|
|
27262
27304
|
let form_mode = view_only ? "update" : mode;
|
|
@@ -27291,6 +27333,7 @@ function open_form_dialog(gobj, mode, record) {
|
|
|
27291
27333
|
priv.form_modal = yui_shell_show_modal(shell, $body, {
|
|
27292
27334
|
dialog: true,
|
|
27293
27335
|
logical_class: "TREEDB_FORM_SHEET",
|
|
27336
|
+
title_prefix,
|
|
27294
27337
|
title,
|
|
27295
27338
|
t: i18next.t,
|
|
27296
27339
|
before_close: function() {
|
|
@@ -27319,14 +27362,7 @@ function form_may_close(gobj) {
|
|
|
27319
27362
|
let kw = {};
|
|
27320
27363
|
(0, _yuneta_gobj_js.gobj_send_event)(priv.form, "EV_WINDOW_TO_CLOSE", kw, gobj);
|
|
27321
27364
|
if (kw.abort_close) {
|
|
27322
|
-
|
|
27323
|
-
t: i18next.t,
|
|
27324
|
-
yes_label: "yes",
|
|
27325
|
-
no_label: "no",
|
|
27326
|
-
cancel_label: "cancel"
|
|
27327
|
-
}).then(function(answer) {
|
|
27328
|
-
if (answer === "yes" && priv.form_modal) priv.form_modal.close();
|
|
27329
|
-
});
|
|
27365
|
+
confirm_then$1(gobj, kw.warning || "all changes will be lost", { what: "close_form" });
|
|
27330
27366
|
return false;
|
|
27331
27367
|
}
|
|
27332
27368
|
}
|
|
@@ -27348,6 +27384,31 @@ function teardown_form_child(gobj) {
|
|
|
27348
27384
|
priv.form_modal = null;
|
|
27349
27385
|
}
|
|
27350
27386
|
/************************************************************
|
|
27387
|
+
* Ask, and turn the answer into an EVENT.
|
|
27388
|
+
*
|
|
27389
|
+
* A dialog's promise settles outside the machine: acting from its
|
|
27390
|
+
* `.then` puts the decision -- delete these records, throw these
|
|
27391
|
+
* edits away -- in a callback the `machine` trace never sees, and
|
|
27392
|
+
* in a view that may be gone by the time the person answers.
|
|
27393
|
+
*
|
|
27394
|
+
* `kw` carries an IDENTITY and never an object: the trace dumps
|
|
27395
|
+
* it, and a gobj, a Tabulator row or a DOM node in there is a
|
|
27396
|
+
* circular structure that breaks the very trace the FSM feeds.
|
|
27397
|
+
*
|
|
27398
|
+
* Same shape as C_YUI_SCHEMA_EDITOR's confirm_then().
|
|
27399
|
+
************************************************************/
|
|
27400
|
+
function confirm_then$1(gobj, message, kw) {
|
|
27401
|
+
yui_shell_confirm_yesnocancel(yui_shell_of(gobj), message, {
|
|
27402
|
+
t: i18next.t,
|
|
27403
|
+
yes_label: "yes",
|
|
27404
|
+
no_label: "no",
|
|
27405
|
+
cancel_label: "cancel"
|
|
27406
|
+
}).then(function(answer) {
|
|
27407
|
+
if (answer !== "yes" || (0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
27408
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONFIRMED", kw, gobj);
|
|
27409
|
+
});
|
|
27410
|
+
}
|
|
27411
|
+
/************************************************************
|
|
27351
27412
|
* Force the dialog down (bypasses the unsaved guard): used after a
|
|
27352
27413
|
* successful save and on teardown. Closing the modal runs its
|
|
27353
27414
|
* on_close, which tears the form child down.
|
|
@@ -27928,7 +27989,7 @@ function pkey_is_rowid(gobj) {
|
|
|
27928
27989
|
* Show the edit "update" form of a row (record)
|
|
27929
27990
|
* internally called from the icon edit at Op column
|
|
27930
27991
|
************************************************************/
|
|
27931
|
-
function show_edit_form(gobj, row
|
|
27992
|
+
function show_edit_form(gobj, row) {
|
|
27932
27993
|
open_form_dialog(gobj, pkey_is_rowid(gobj) ? "create" : "update", row);
|
|
27933
27994
|
}
|
|
27934
27995
|
/************************************************************
|
|
@@ -28427,31 +28488,57 @@ function ac_delete_rows(gobj, event, kw, src) {
|
|
|
28427
28488
|
});
|
|
28428
28489
|
return 0;
|
|
28429
28490
|
}
|
|
28430
|
-
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
|
|
28434
|
-
cancel_label: "cancel"
|
|
28435
|
-
}).then(function(answer) {
|
|
28436
|
-
if (answer === "yes") for (let row of rows) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_DELETE_RECORD", {
|
|
28437
|
-
topic_name: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"),
|
|
28438
|
-
record: row
|
|
28439
|
-
});
|
|
28440
|
-
});
|
|
28441
|
-
} else yui_shell_confirm_yesnocancel(yui_shell_of(gobj), build_delete_question(gobj, kw.row), {
|
|
28442
|
-
t: i18next.t,
|
|
28443
|
-
yes_label: "yes",
|
|
28444
|
-
no_label: "no",
|
|
28445
|
-
cancel_label: "cancel"
|
|
28446
|
-
}).then(function(answer) {
|
|
28447
|
-
if (answer === "yes") (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_DELETE_RECORD", {
|
|
28448
|
-
topic_name: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"),
|
|
28449
|
-
record: kw.row
|
|
28450
|
-
});
|
|
28491
|
+
confirm_then$1(gobj, build_delete_question(gobj, rows), { what: "delete_selection" });
|
|
28492
|
+
} else confirm_then$1(gobj, build_delete_question(gobj, kw.row), {
|
|
28493
|
+
what: "delete_row",
|
|
28494
|
+
index: kw.index
|
|
28451
28495
|
});
|
|
28452
28496
|
return 0;
|
|
28453
28497
|
}
|
|
28454
28498
|
/************************************************************
|
|
28499
|
+
* {what, ...} -- the person said yes to what confirm_then()
|
|
28500
|
+
* asked. The rows are read again HERE and not carried in the
|
|
28501
|
+
* kw: the kw is plain json, and a Tabulator row is not.
|
|
28502
|
+
************************************************************/
|
|
28503
|
+
function ac_confirmed$2(gobj, event, kw, src) {
|
|
28504
|
+
let priv = gobj.priv;
|
|
28505
|
+
let what = kw ? kw.what : "";
|
|
28506
|
+
if (what === "close_form") {
|
|
28507
|
+
if (priv.form_modal) priv.form_modal.close();
|
|
28508
|
+
return 0;
|
|
28509
|
+
}
|
|
28510
|
+
if (refuse_if_readonly$2(gobj, event)) return -1;
|
|
28511
|
+
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
28512
|
+
let topic_name = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name");
|
|
28513
|
+
if (what === "delete_selection") {
|
|
28514
|
+
let rows = yui_selected_rows(tabulator);
|
|
28515
|
+
if (!rows.length) {
|
|
28516
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with the selection gone`);
|
|
28517
|
+
return -1;
|
|
28518
|
+
}
|
|
28519
|
+
for (let row of rows) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_DELETE_RECORD", {
|
|
28520
|
+
topic_name,
|
|
28521
|
+
record: row
|
|
28522
|
+
});
|
|
28523
|
+
return 0;
|
|
28524
|
+
}
|
|
28525
|
+
if (what === "delete_row") {
|
|
28526
|
+
let index = kw.index;
|
|
28527
|
+
let row = tabulator && typeof index === "number" ? tabulator.getRowFromPosition(index) : null;
|
|
28528
|
+
if (!row) {
|
|
28529
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no row: ${index}`);
|
|
28530
|
+
return -1;
|
|
28531
|
+
}
|
|
28532
|
+
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_DELETE_RECORD", {
|
|
28533
|
+
topic_name,
|
|
28534
|
+
record: row.getData()
|
|
28535
|
+
});
|
|
28536
|
+
return 0;
|
|
28537
|
+
}
|
|
28538
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} of nothing this view asked about: ${what}`);
|
|
28539
|
+
return -1;
|
|
28540
|
+
}
|
|
28541
|
+
/************************************************************
|
|
28455
28542
|
* From internal
|
|
28456
28543
|
************************************************************/
|
|
28457
28544
|
function ac_copy_rows(gobj, event, kw, src) {
|
|
@@ -28506,9 +28593,7 @@ function ac_form_save_record(gobj, event, kw, src) {
|
|
|
28506
28593
|
const cols = Object.keys(picked);
|
|
28507
28594
|
if (cols.length === 0) {
|
|
28508
28595
|
publish_treedb_write(gobj, mode, kw);
|
|
28509
|
-
|
|
28510
|
-
close_form_dialog(gobj);
|
|
28511
|
-
}, 0);
|
|
28596
|
+
(0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_CLOSE_FORM", {}, gobj);
|
|
28512
28597
|
return 0;
|
|
28513
28598
|
}
|
|
28514
28599
|
const serial = ++priv.read_serial;
|
|
@@ -28586,6 +28671,14 @@ function publish_treedb_write(gobj, mode, record, jn_files) {
|
|
|
28586
28671
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, mode === "create" ? "EV_CREATE_RECORD" : "EV_UPDATE_RECORD", kw_write);
|
|
28587
28672
|
}
|
|
28588
28673
|
/************************************************************
|
|
28674
|
+
* The deferred close of the form dialog, posted by the save
|
|
28675
|
+
* from inside the form child's own publish stack.
|
|
28676
|
+
************************************************************/
|
|
28677
|
+
function ac_close_form(gobj, event, kw, src) {
|
|
28678
|
+
close_form_dialog(gobj);
|
|
28679
|
+
return 0;
|
|
28680
|
+
}
|
|
28681
|
+
/************************************************************
|
|
28589
28682
|
* {mode, record, picks} -- the bytes are here now
|
|
28590
28683
|
************************************************************/
|
|
28591
28684
|
function ac_files_read(gobj, event, kw, src) {
|
|
@@ -28626,7 +28719,7 @@ function ac_select_rows(gobj, event, kw, src) {
|
|
|
28626
28719
|
************************************************************/
|
|
28627
28720
|
function ac_unselect_rows(gobj, event, kw, src) {
|
|
28628
28721
|
render_selection_state(gobj);
|
|
28629
|
-
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "
|
|
28722
|
+
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "broadcast_unselect_rows_event")) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, event, kw);
|
|
28630
28723
|
return 0;
|
|
28631
28724
|
}
|
|
28632
28725
|
/************************************************************
|
|
@@ -29106,6 +29199,26 @@ function ac_show_record(gobj, event, kw, src) {
|
|
|
29106
29199
|
return 0;
|
|
29107
29200
|
}
|
|
29108
29201
|
/************************************************************
|
|
29202
|
+
* {index} -- the pencil of the Op column. Same shape as
|
|
29203
|
+
* EV_SHOW_RECORD: the kw carries WHICH row, and the row itself
|
|
29204
|
+
* is resolved here, where the table is.
|
|
29205
|
+
************************************************************/
|
|
29206
|
+
function ac_edit_record(gobj, event, kw, src) {
|
|
29207
|
+
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
29208
|
+
let index = kw ? kw.index : void 0;
|
|
29209
|
+
if (!tabulator || typeof index !== "number") {
|
|
29210
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no row ${index} to edit`);
|
|
29211
|
+
return -1;
|
|
29212
|
+
}
|
|
29213
|
+
let row = tabulator.getRowFromPosition(index);
|
|
29214
|
+
if (!row) {
|
|
29215
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: row ${index} is gone`);
|
|
29216
|
+
return -1;
|
|
29217
|
+
}
|
|
29218
|
+
show_edit_form(gobj, row.getData());
|
|
29219
|
+
return 0;
|
|
29220
|
+
}
|
|
29221
|
+
/************************************************************
|
|
29109
29222
|
* The reader picked another page size: remember it, so coming back to
|
|
29110
29223
|
* this topic opens where they left it instead of at 200.
|
|
29111
29224
|
************************************************************/
|
|
@@ -29230,6 +29343,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29230
29343
|
ac_form_save_record,
|
|
29231
29344
|
null
|
|
29232
29345
|
],
|
|
29346
|
+
[
|
|
29347
|
+
"EV_CLOSE_FORM",
|
|
29348
|
+
ac_close_form,
|
|
29349
|
+
null
|
|
29350
|
+
],
|
|
29233
29351
|
[
|
|
29234
29352
|
"EV_FILES_READ",
|
|
29235
29353
|
ac_files_read,
|
|
@@ -29250,6 +29368,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29250
29368
|
ac_delete_rows,
|
|
29251
29369
|
null
|
|
29252
29370
|
],
|
|
29371
|
+
[
|
|
29372
|
+
"EV_CONFIRMED",
|
|
29373
|
+
ac_confirmed$2,
|
|
29374
|
+
null
|
|
29375
|
+
],
|
|
29253
29376
|
[
|
|
29254
29377
|
"EV_SELECT_ROWS",
|
|
29255
29378
|
ac_select_rows,
|
|
@@ -29375,6 +29498,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29375
29498
|
ac_show_record,
|
|
29376
29499
|
null
|
|
29377
29500
|
],
|
|
29501
|
+
[
|
|
29502
|
+
"EV_EDIT_RECORD",
|
|
29503
|
+
ac_edit_record,
|
|
29504
|
+
null
|
|
29505
|
+
],
|
|
29378
29506
|
[
|
|
29379
29507
|
"EV_TOGGLE_COLUMN",
|
|
29380
29508
|
ac_toggle_column,
|
|
@@ -29404,10 +29532,12 @@ function create_gclass$5(gclass_name) {
|
|
|
29404
29532
|
["EV_NODE_DELETED", 0],
|
|
29405
29533
|
["EV_EDITION_MODE", 0],
|
|
29406
29534
|
["EV_SAVE_RECORD", 0],
|
|
29535
|
+
["EV_CLOSE_FORM", 0],
|
|
29407
29536
|
["EV_FILES_READ", 0],
|
|
29408
29537
|
["EV_FILES_FAILED", 0],
|
|
29409
29538
|
["EV_NEW_ROW", 0],
|
|
29410
29539
|
["EV_DELETE_ROWS", 0],
|
|
29540
|
+
["EV_CONFIRMED", 0],
|
|
29411
29541
|
["EV_COPY_ROWS", 0],
|
|
29412
29542
|
["EV_PASTE_ROWS", 0],
|
|
29413
29543
|
["EV_CLEAR_SELECTION", 0],
|
|
@@ -29437,6 +29567,7 @@ function create_gclass$5(gclass_name) {
|
|
|
29437
29567
|
["EV_OPEN_COLUMNS", 0],
|
|
29438
29568
|
["EV_PAGE_SIZE_CHANGED", 0],
|
|
29439
29569
|
["EV_SHOW_RECORD", 0],
|
|
29570
|
+
["EV_EDIT_RECORD", 0],
|
|
29440
29571
|
["EV_TOGGLE_COLUMN", 0],
|
|
29441
29572
|
["EV_EXPORT_TABLE", 0],
|
|
29442
29573
|
["EV_CREATE_RECORD", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT],
|
|
@@ -57970,13 +58101,38 @@ function build_graph$1(gobj) {
|
|
|
57970
58101
|
graph.setLayout(layout);
|
|
57971
58102
|
priv.graph_rendered = false;
|
|
57972
58103
|
graph_render(gobj).then(() => {
|
|
58104
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj) || !priv.graph) return;
|
|
57973
58105
|
configure_events(gobj);
|
|
57974
58106
|
configure_behaviour(gobj);
|
|
57975
58107
|
configure_plugins(gobj);
|
|
57976
58108
|
priv.graph_rendered = true;
|
|
58109
|
+
}).catch((e) => {
|
|
58110
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: graph render failed: ${e}`);
|
|
57977
58111
|
});
|
|
57978
58112
|
}
|
|
57979
58113
|
/************************************************************
|
|
58114
|
+
* A G6 event, as PLAIN JSON.
|
|
58115
|
+
*
|
|
58116
|
+
* A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
|
|
58117
|
+
* G6 / @antv/g event is circular: serializing one THROWS, so the
|
|
58118
|
+
* first thing a kw carrying `evt` breaks is the trace the FSM
|
|
58119
|
+
* exists to feed. It also drags a live graph element into a
|
|
58120
|
+
* message that may be read after that element is gone.
|
|
58121
|
+
*
|
|
58122
|
+
* What the actions read of it is an id and three scalars. The
|
|
58123
|
+
* event itself never leaves the callback that received it.
|
|
58124
|
+
************************************************************/
|
|
58125
|
+
function g6_event_kw(evt) {
|
|
58126
|
+
let target = evt && evt.target ? evt.target : null;
|
|
58127
|
+
let client = evt && evt.client ? evt.client : null;
|
|
58128
|
+
return {
|
|
58129
|
+
id: target && target.id ? String(target.id) : "",
|
|
58130
|
+
shift: !!(evt && evt.shiftKey),
|
|
58131
|
+
client_x: client && typeof client.x === "number" ? client.x : 0,
|
|
58132
|
+
client_y: client && typeof client.y === "number" ? client.y : 0
|
|
58133
|
+
};
|
|
58134
|
+
}
|
|
58135
|
+
/************************************************************
|
|
57980
58136
|
* Configure G6 event handlers
|
|
57981
58137
|
************************************************************/
|
|
57982
58138
|
function configure_events(gobj) {
|
|
@@ -57984,7 +58140,7 @@ function configure_events(gobj) {
|
|
|
57984
58140
|
let graph = priv.graph;
|
|
57985
58141
|
graph.on(_antv_g6.CanvasEvent.CLICK, (evt) => {
|
|
57986
58142
|
if (consume_long_press_click(graph)) return;
|
|
57987
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CANVAS_CLICK",
|
|
58143
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CANVAS_CLICK", g6_event_kw(evt), gobj);
|
|
57988
58144
|
});
|
|
57989
58145
|
graph.on(_antv_g6.NodeEvent.DRAG, (evt) => {
|
|
57990
58146
|
update_resize_handles_position(gobj);
|
|
@@ -57995,21 +58151,21 @@ function configure_events(gobj) {
|
|
|
57995
58151
|
update_port_icon_position(gobj);
|
|
57996
58152
|
});
|
|
57997
58153
|
graph.on(_antv_g6.NodeEvent.DRAG_END, (evt) => {
|
|
57998
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_DRAG_END",
|
|
58154
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_DRAG_END", g6_event_kw(evt), gobj);
|
|
57999
58155
|
});
|
|
58000
58156
|
graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
|
|
58001
58157
|
if (consume_long_press_click(graph)) return;
|
|
58002
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK",
|
|
58158
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
|
|
58003
58159
|
});
|
|
58004
58160
|
graph.on(_antv_g6.NodeEvent.CONTEXT_MENU, (evt) => {
|
|
58005
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CONTEXT_MENU",
|
|
58161
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CONTEXT_MENU", g6_event_kw(evt), gobj);
|
|
58006
58162
|
});
|
|
58007
58163
|
graph.on(_antv_g6.NodeEvent.DBLCLICK, (evt) => {
|
|
58008
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_DBLCLICK",
|
|
58164
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_DBLCLICK", g6_event_kw(evt), gobj);
|
|
58009
58165
|
});
|
|
58010
58166
|
graph.on(_antv_g6.EdgeEvent.CLICK, (evt) => {
|
|
58011
58167
|
if (consume_long_press_click(graph)) return;
|
|
58012
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDGE_CLICK",
|
|
58168
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_EDGE_CLICK", g6_event_kw(evt), gobj);
|
|
58013
58169
|
});
|
|
58014
58170
|
graph.on("aftertransform", () => {
|
|
58015
58171
|
update_resize_handles_position(gobj);
|
|
@@ -58093,7 +58249,7 @@ function configure_plugins(gobj) {
|
|
|
58093
58249
|
graph_add_plugin(gobj, "contextmenu", {
|
|
58094
58250
|
trigger: "contextmenu",
|
|
58095
58251
|
onClick: (value) => {
|
|
58096
|
-
|
|
58252
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONTEXT_MENU_ITEM", { value: String(value) }, gobj);
|
|
58097
58253
|
},
|
|
58098
58254
|
getItems: (e) => {
|
|
58099
58255
|
return build_context_menu_items(gobj, e);
|
|
@@ -61809,7 +61965,7 @@ function show_edge_icon(gobj) {
|
|
|
61809
61965
|
if (!priv._selected_edge_id) return;
|
|
61810
61966
|
let mid = get_edge_viewport_midpoint(gobj, priv._selected_edge_id);
|
|
61811
61967
|
if (!mid) return;
|
|
61812
|
-
let icons = show_dual_icons(gobj, mid.x + 4, mid.y + floating_icon_dy(), (0, i18next.t)("edge properties"), () => toggle_edge_popover(gobj), (0, i18next.t)("unlink"), () =>
|
|
61968
|
+
let icons = show_dual_icons(gobj, mid.x + 4, mid.y + floating_icon_dy(), (0, i18next.t)("edge properties"), () => toggle_edge_popover(gobj), (0, i18next.t)("unlink"), () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_REQUEST_UNLINK_EDGE", {}, gobj));
|
|
61813
61969
|
priv._edge_icon_el = icons.icon_el;
|
|
61814
61970
|
priv._edge_delete_el = icons.delete_el;
|
|
61815
61971
|
}
|
|
@@ -61964,7 +62120,7 @@ function show_node_icon(gobj) {
|
|
|
61964
62120
|
if (!priv._selected_node_id || priv._selected_port_key) return;
|
|
61965
62121
|
let rect = get_node_viewport_rect(gobj, priv._selected_node_id);
|
|
61966
62122
|
if (!rect) return;
|
|
61967
|
-
let icons = show_dual_icons(gobj, rect.right + 4, rect.top + floating_icon_dy(), (0, i18next.t)("node properties"), () => toggle_node_popover(gobj), (0, i18next.t)("delete node"), () =>
|
|
62123
|
+
let icons = show_dual_icons(gobj, rect.right + 4, rect.top + floating_icon_dy(), (0, i18next.t)("node properties"), () => toggle_node_popover(gobj), (0, i18next.t)("delete node"), () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_REQUEST_DELETE_NODE", {}, gobj));
|
|
61968
62124
|
priv._node_icon_el = icons.icon_el;
|
|
61969
62125
|
priv._node_delete_el = icons.delete_el;
|
|
61970
62126
|
}
|
|
@@ -62677,7 +62833,10 @@ function request_delete_selection(gobj) {
|
|
|
62677
62833
|
execute_delete_selection(gobj, nodes);
|
|
62678
62834
|
return;
|
|
62679
62835
|
}
|
|
62680
|
-
show_confirm_popover(gobj, null, delete_question(nodes), "delete", "#ff4d4f", () =>
|
|
62836
|
+
show_confirm_popover(gobj, null, delete_question(nodes), "delete", "#ff4d4f", () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONFIRMED", {
|
|
62837
|
+
what: "delete_selection",
|
|
62838
|
+
ids: nodes.map((nd) => String(nd.id))
|
|
62839
|
+
}, gobj), "_delete_confirm_el");
|
|
62681
62840
|
}
|
|
62682
62841
|
function execute_delete_selection(gobj, nodes) {
|
|
62683
62842
|
let priv = gobj.priv;
|
|
@@ -62694,7 +62853,10 @@ function execute_delete_selection(gobj, nodes) {
|
|
|
62694
62853
|
************************************************************/
|
|
62695
62854
|
function show_delete_confirm(gobj, nodeData) {
|
|
62696
62855
|
let priv = gobj.priv;
|
|
62697
|
-
show_confirm_popover(gobj, priv._node_delete_el, delete_question([nodeData]), "delete", "#ff4d4f", () =>
|
|
62856
|
+
show_confirm_popover(gobj, priv._node_delete_el, delete_question([nodeData]), "delete", "#ff4d4f", () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONFIRMED", {
|
|
62857
|
+
what: "delete_node",
|
|
62858
|
+
id: String(nodeData.id)
|
|
62859
|
+
}, gobj), "_delete_confirm_el");
|
|
62698
62860
|
}
|
|
62699
62861
|
function hide_delete_confirm(gobj) {
|
|
62700
62862
|
hide_overlay(gobj, "_delete_confirm_el");
|
|
@@ -62792,7 +62954,10 @@ function show_create_popover(gobj) {
|
|
|
62792
62954
|
idInput.focus();
|
|
62793
62955
|
return;
|
|
62794
62956
|
}
|
|
62795
|
-
|
|
62957
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SUBMIT_NEW_NODE", {
|
|
62958
|
+
topic_name: String(topicSelect.value),
|
|
62959
|
+
id: node_id
|
|
62960
|
+
}, gobj);
|
|
62796
62961
|
}
|
|
62797
62962
|
}]);
|
|
62798
62963
|
createBtn = popover.querySelector("button:last-child");
|
|
@@ -62852,7 +63017,10 @@ function execute_unlink_edge(gobj, edgeData) {
|
|
|
62852
63017
|
function show_unlink_confirm(gobj, edgeData) {
|
|
62853
63018
|
let priv = gobj.priv;
|
|
62854
63019
|
const d = edgeData.data;
|
|
62855
|
-
show_confirm_popover(gobj, priv._edge_delete_el, (0, i18next.t)("unlink") + " " + d.child_id + " → " + d.parent_id + "?\n" + (0, i18next.t)("neither record is deleted"), "unlink", "#ff4d4f", () =>
|
|
63020
|
+
show_confirm_popover(gobj, priv._edge_delete_el, (0, i18next.t)("unlink") + " " + d.child_id + " → " + d.parent_id + "?\n" + (0, i18next.t)("neither record is deleted"), "unlink", "#ff4d4f", () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CONFIRMED", {
|
|
63021
|
+
what: "unlink_edge",
|
|
63022
|
+
id: String(edgeData.id)
|
|
63023
|
+
}, gobj), "_unlink_confirm_el");
|
|
62856
63024
|
}
|
|
62857
63025
|
function hide_unlink_confirm(gobj) {
|
|
62858
63026
|
hide_overlay(gobj, "_unlink_confirm_el");
|
|
@@ -64735,7 +64903,7 @@ function ac_toggle_node_mode(gobj, event, kw, src) {
|
|
|
64735
64903
|
************************************************************/
|
|
64736
64904
|
function ac_node_dblclick(gobj, event, kw, src) {
|
|
64737
64905
|
let priv = gobj.priv;
|
|
64738
|
-
let node_id = kw && kw.
|
|
64906
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
64739
64907
|
let nd = null;
|
|
64740
64908
|
try {
|
|
64741
64909
|
nd = priv.graph.getNodeData(node_id);
|
|
@@ -64931,7 +65099,7 @@ function ac_brush_select(gobj, event, kw, src) {
|
|
|
64931
65099
|
function ac_node_click$2(gobj, event, kw, src) {
|
|
64932
65100
|
let priv = gobj.priv;
|
|
64933
65101
|
let graph = priv.graph;
|
|
64934
|
-
let node_id = kw.
|
|
65102
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
64935
65103
|
let more_nd = null;
|
|
64936
65104
|
try {
|
|
64937
65105
|
more_nd = graph.getNodeData(node_id);
|
|
@@ -64958,10 +65126,10 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
64958
65126
|
topic_name: nodedata.data.desc.topic_name,
|
|
64959
65127
|
record: nodedata.data.record
|
|
64960
65128
|
});
|
|
64961
|
-
if (priv.edit_mode && (kw.
|
|
65129
|
+
if (priv.edit_mode && (kw.shift || priv.selection_mode)) toggle_in_selection(gobj, node_id);
|
|
64962
65130
|
else if (priv.edit_mode) {
|
|
64963
65131
|
let containerRect = priv.$container.getBoundingClientRect();
|
|
64964
|
-
let canvasPoint = graph.getCanvasByViewport([kw.
|
|
65132
|
+
let canvasPoint = graph.getCanvasByViewport([kw.client_x - containerRect.left, kw.client_y - containerRect.top]);
|
|
64965
65133
|
let port_key = detect_port_click(gobj, node_id, canvasPoint[0], canvasPoint[1]);
|
|
64966
65134
|
if (priv._linking_mode) {
|
|
64967
65135
|
if (port_key && try_complete_link(gobj, node_id, port_key)) return 0;
|
|
@@ -64984,7 +65152,7 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
64984
65152
|
function ac_edge_click(gobj, event, kw, src) {
|
|
64985
65153
|
let priv = gobj.priv;
|
|
64986
65154
|
let graph = priv.graph;
|
|
64987
|
-
let edge_id = kw.
|
|
65155
|
+
let edge_id = kw && kw.id ? kw.id : "";
|
|
64988
65156
|
try {
|
|
64989
65157
|
let edgedata = graph.getEdgeData(edge_id);
|
|
64990
65158
|
if (edgedata && edgedata.data) {
|
|
@@ -65013,6 +65181,106 @@ function ac_node_context_menu(gobj, event, kw, src) {
|
|
|
65013
65181
|
return 0;
|
|
65014
65182
|
}
|
|
65015
65183
|
/************************************************************
|
|
65184
|
+
* {value} -- an item of the context menu was picked.
|
|
65185
|
+
************************************************************/
|
|
65186
|
+
function ac_context_menu_item(gobj, event, kw, src) {
|
|
65187
|
+
handle_context_menu_click(gobj, kw && kw.value ? kw.value : "");
|
|
65188
|
+
return 0;
|
|
65189
|
+
}
|
|
65190
|
+
/************************************************************
|
|
65191
|
+
* The delete icon floating beside the selected node.
|
|
65192
|
+
************************************************************/
|
|
65193
|
+
function ac_request_delete_node(gobj, event, kw, src) {
|
|
65194
|
+
request_delete_node(gobj);
|
|
65195
|
+
return 0;
|
|
65196
|
+
}
|
|
65197
|
+
/************************************************************
|
|
65198
|
+
* The unlink icon floating beside the selected edge.
|
|
65199
|
+
************************************************************/
|
|
65200
|
+
function ac_request_unlink_edge(gobj, event, kw, src) {
|
|
65201
|
+
request_unlink_edge(gobj);
|
|
65202
|
+
return 0;
|
|
65203
|
+
}
|
|
65204
|
+
/************************************************************
|
|
65205
|
+
* {topic_name, id} -- the create popover was filled in.
|
|
65206
|
+
************************************************************/
|
|
65207
|
+
function ac_submit_new_node(gobj, event, kw, src) {
|
|
65208
|
+
let topic_name = kw && kw.topic_name ? kw.topic_name : "";
|
|
65209
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
65210
|
+
if (!topic_name || !node_id) {
|
|
65211
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} without topic or id`);
|
|
65212
|
+
return -1;
|
|
65213
|
+
}
|
|
65214
|
+
execute_create_node(gobj, topic_name, node_id);
|
|
65215
|
+
return 0;
|
|
65216
|
+
}
|
|
65217
|
+
/************************************************************
|
|
65218
|
+
* {what, id|ids} -- the person said yes in a confirm popover.
|
|
65219
|
+
*
|
|
65220
|
+
* The kw carries IDS and not the graph elements they name: a kw
|
|
65221
|
+
* is plain json, and a node/edge datum of a live graph is not
|
|
65222
|
+
* something to park in a message. They are resolved here, where
|
|
65223
|
+
* the graph is -- and an id that no longer names anything is a
|
|
65224
|
+
* loud refusal instead of a silent nothing.
|
|
65225
|
+
************************************************************/
|
|
65226
|
+
function ac_confirmed$1(gobj, event, kw, src) {
|
|
65227
|
+
let graph = gobj.priv.graph;
|
|
65228
|
+
let what = kw && kw.what ? kw.what : "";
|
|
65229
|
+
if (!graph) {
|
|
65230
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} with no graph`);
|
|
65231
|
+
return -1;
|
|
65232
|
+
}
|
|
65233
|
+
if (what === "delete_selection") {
|
|
65234
|
+
let ids = kw && Array.isArray(kw.ids) ? kw.ids : [];
|
|
65235
|
+
let nodes = [];
|
|
65236
|
+
for (let id of ids) {
|
|
65237
|
+
let nd = null;
|
|
65238
|
+
try {
|
|
65239
|
+
nd = graph.getNodeData(id);
|
|
65240
|
+
} catch (e) {
|
|
65241
|
+
nd = null;
|
|
65242
|
+
}
|
|
65243
|
+
if (nd && nd.data && nd.data.desc) nodes.push(nd);
|
|
65244
|
+
}
|
|
65245
|
+
if (!nodes.length) {
|
|
65246
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no node any more`);
|
|
65247
|
+
return -1;
|
|
65248
|
+
}
|
|
65249
|
+
execute_delete_selection(gobj, nodes);
|
|
65250
|
+
return 0;
|
|
65251
|
+
}
|
|
65252
|
+
if (what === "delete_node") {
|
|
65253
|
+
let nd = null;
|
|
65254
|
+
try {
|
|
65255
|
+
nd = graph.getNodeData(kw.id);
|
|
65256
|
+
} catch (e) {
|
|
65257
|
+
nd = null;
|
|
65258
|
+
}
|
|
65259
|
+
if (!nd || !nd.data || !nd.data.desc) {
|
|
65260
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no node: ${kw.id}`);
|
|
65261
|
+
return -1;
|
|
65262
|
+
}
|
|
65263
|
+
execute_delete_node(gobj, nd);
|
|
65264
|
+
return 0;
|
|
65265
|
+
}
|
|
65266
|
+
if (what === "unlink_edge") {
|
|
65267
|
+
let ed = null;
|
|
65268
|
+
try {
|
|
65269
|
+
ed = graph.getEdgeData(kw.id);
|
|
65270
|
+
} catch (e) {
|
|
65271
|
+
ed = null;
|
|
65272
|
+
}
|
|
65273
|
+
if (!ed || !ed.data) {
|
|
65274
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} names no edge: ${kw.id}`);
|
|
65275
|
+
return -1;
|
|
65276
|
+
}
|
|
65277
|
+
execute_unlink_edge(gobj, ed);
|
|
65278
|
+
return 0;
|
|
65279
|
+
}
|
|
65280
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} of nothing this view asked about: ${what}`);
|
|
65281
|
+
return -1;
|
|
65282
|
+
}
|
|
65283
|
+
/************************************************************
|
|
65016
65284
|
* Canvas click
|
|
65017
65285
|
************************************************************/
|
|
65018
65286
|
function ac_canvas_click(gobj, event, kw, src) {
|
|
@@ -65176,6 +65444,31 @@ function create_gclass$4(gclass_name) {
|
|
|
65176
65444
|
ac_node_context_menu,
|
|
65177
65445
|
null
|
|
65178
65446
|
],
|
|
65447
|
+
[
|
|
65448
|
+
"EV_CONTEXT_MENU_ITEM",
|
|
65449
|
+
ac_context_menu_item,
|
|
65450
|
+
null
|
|
65451
|
+
],
|
|
65452
|
+
[
|
|
65453
|
+
"EV_REQUEST_DELETE_NODE",
|
|
65454
|
+
ac_request_delete_node,
|
|
65455
|
+
null
|
|
65456
|
+
],
|
|
65457
|
+
[
|
|
65458
|
+
"EV_REQUEST_UNLINK_EDGE",
|
|
65459
|
+
ac_request_unlink_edge,
|
|
65460
|
+
null
|
|
65461
|
+
],
|
|
65462
|
+
[
|
|
65463
|
+
"EV_SUBMIT_NEW_NODE",
|
|
65464
|
+
ac_submit_new_node,
|
|
65465
|
+
null
|
|
65466
|
+
],
|
|
65467
|
+
[
|
|
65468
|
+
"EV_CONFIRMED",
|
|
65469
|
+
ac_confirmed$1,
|
|
65470
|
+
null
|
|
65471
|
+
],
|
|
65179
65472
|
[
|
|
65180
65473
|
"EV_CANVAS_CLICK",
|
|
65181
65474
|
ac_canvas_click,
|
|
@@ -65392,6 +65685,11 @@ function create_gclass$4(gclass_name) {
|
|
|
65392
65685
|
["EV_NODE_CLICK", 0],
|
|
65393
65686
|
["EV_EDGE_CLICK", 0],
|
|
65394
65687
|
["EV_NODE_CONTEXT_MENU", 0],
|
|
65688
|
+
["EV_CONTEXT_MENU_ITEM", 0],
|
|
65689
|
+
["EV_REQUEST_DELETE_NODE", 0],
|
|
65690
|
+
["EV_REQUEST_UNLINK_EDGE", 0],
|
|
65691
|
+
["EV_SUBMIT_NEW_NODE", 0],
|
|
65692
|
+
["EV_CONFIRMED", 0],
|
|
65395
65693
|
["EV_CANVAS_CLICK", 0],
|
|
65396
65694
|
["EV_NODE_DRAG_END", 0],
|
|
65397
65695
|
["EV_BRUSH_SELECT", 0],
|