@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.es.js
CHANGED
|
@@ -25558,49 +25558,65 @@ function yui_icon_is_defined(name) {
|
|
|
25558
25558
|
/***********************************************************************
|
|
25559
25559
|
* yui_row_search.js
|
|
25560
25560
|
*
|
|
25561
|
-
*
|
|
25562
|
-
*
|
|
25563
|
-
*
|
|
25564
|
-
*
|
|
25565
|
-
*
|
|
25566
|
-
* `[
|
|
25567
|
-
*
|
|
25568
|
-
*
|
|
25569
|
-
*
|
|
25570
|
-
*
|
|
25571
|
-
*
|
|
25572
|
-
*
|
|
25573
|
-
*
|
|
25574
|
-
*
|
|
25575
|
-
*
|
|
25576
|
-
*
|
|
25577
|
-
*
|
|
25578
|
-
*
|
|
25579
|
-
*
|
|
25580
|
-
*
|
|
25581
|
-
*
|
|
25582
|
-
*
|
|
25583
|
-
*
|
|
25584
|
-
*
|
|
25585
|
-
*
|
|
25561
|
+
* IS THIS TERM IN THIS ROW?
|
|
25562
|
+
*
|
|
25563
|
+
* The search box of a treedb table looked at the row's values with
|
|
25564
|
+
* `String(val)`, and a treedb row is not flat: an fkey arrives as a
|
|
25565
|
+
* LIST OF OBJECTS `[{id, topic_name, hook_name}]`, and `String()`
|
|
25566
|
+
* of that is `"[object Object]"`. So looking for the workshop of
|
|
25567
|
+
* a device -- which is where the datum an operator has in mind
|
|
25568
|
+
* lives -- never found anything, and the box gave no hint that it
|
|
25569
|
+
* had looked somewhere else.
|
|
25570
|
+
*
|
|
25571
|
+
* THREE RULES, AND THE LAST TWO ARE WHAT MAKE IT USEFUL:
|
|
25572
|
+
*
|
|
25573
|
+
* - It walks down lists and objects to a short depth: an fkey is
|
|
25574
|
+
* two levels down and nothing anybody searches for is deeper.
|
|
25575
|
+
* - **Of an fkey only the `id` is looked at.** `topic_name` and
|
|
25576
|
+
* `hook_name` are the SAME two words on every row, so looking at
|
|
25577
|
+
* them turns the term into a wildcard: searching "devices" would
|
|
25578
|
+
* bring the whole topic. The `id` is the only thing that names
|
|
25579
|
+
* the linked thing.
|
|
25580
|
+
* - **A hook read as its COUNT is not looked at at all.** Since
|
|
25581
|
+
* `hook_size` (7.23.163) a topic table loads a hook as
|
|
25582
|
+
* `[{"size": N}]` instead of the id of every child, and that
|
|
25583
|
+
* number is not a value of the row: matching it made "5" answer
|
|
25584
|
+
* every row whose hook happens to hold 5 children, next to the
|
|
25585
|
+
* rows that really say 5. A count nobody can see in the cell as
|
|
25586
|
+
* text is not what a person typing in a search box is after.
|
|
25587
|
+
*
|
|
25588
|
+
* Keys that start with `_` are not looked at on any level: they
|
|
25589
|
+
* belong to the scaffolding (`_check_box_state_`, `_operation`) or
|
|
25590
|
+
* are metadata (`__md_treedb__`), and nobody searches by them.
|
|
25586
25591
|
*
|
|
25587
|
-
* Copyright (c) 2026, ArtGins.
|
|
25592
|
+
* Copyright (c) 2024-2026, ArtGins.
|
|
25588
25593
|
* All Rights Reserved.
|
|
25589
25594
|
***********************************************************************/
|
|
25590
25595
|
var MAX_DEPTH = 4;
|
|
25591
25596
|
/***************************************************************
|
|
25592
|
-
*
|
|
25597
|
+
* An fkey, as `nodes` answers it with `list_dict`.
|
|
25593
25598
|
***************************************************************/
|
|
25594
25599
|
function is_fkey_ref(value) {
|
|
25595
25600
|
return !!value && typeof value === "object" && !Array.isArray(value) && "id" in value && "topic_name" in value && "hook_name" in value;
|
|
25596
25601
|
}
|
|
25597
25602
|
/***************************************************************
|
|
25598
|
-
*
|
|
25599
|
-
*
|
|
25603
|
+
* A hook read with `hook_size`: the COUNT of its children,
|
|
25604
|
+
* `[{"size": N}]`, in the place of the children themselves.
|
|
25605
|
+
* The same shape `delete_impact`'s `ref_count()` reads.
|
|
25606
|
+
***************************************************************/
|
|
25607
|
+
function is_hook_size(value) {
|
|
25608
|
+
if (!Array.isArray(value) || value.length !== 1) return false;
|
|
25609
|
+
const first = value[0];
|
|
25610
|
+
return !!first && typeof first === "object" && !Array.isArray(first) && typeof first.size === "number" && Object.keys(first).length === 1;
|
|
25611
|
+
}
|
|
25612
|
+
/***************************************************************
|
|
25613
|
+
* Does `value` hold the term? The term comes ALREADY in lower
|
|
25614
|
+
* case: whoever searches lowers it once, not once per cell.
|
|
25600
25615
|
***************************************************************/
|
|
25601
25616
|
function value_matches(value, term, depth) {
|
|
25602
25617
|
if (value === null || value === void 0) return false;
|
|
25603
25618
|
if (depth > MAX_DEPTH) return false;
|
|
25619
|
+
if (is_hook_size(value)) return false;
|
|
25604
25620
|
if (Array.isArray(value)) return value.some((v) => value_matches(v, term, depth + 1));
|
|
25605
25621
|
if (typeof value === "object") {
|
|
25606
25622
|
if (is_fkey_ref(value)) return value_matches(value.id, term, depth + 1);
|
|
@@ -25612,7 +25628,7 @@ function value_matches(value, term, depth) {
|
|
|
25612
25628
|
return String(value).toLowerCase().includes(term);
|
|
25613
25629
|
}
|
|
25614
25630
|
/***************************************************************
|
|
25615
|
-
*
|
|
25631
|
+
* Is the term anywhere in this row?
|
|
25616
25632
|
***************************************************************/
|
|
25617
25633
|
function row_matches(row, term) {
|
|
25618
25634
|
if (!row || typeof row !== "object" || !term) return false;
|
|
@@ -25818,8 +25834,8 @@ var attrs_table$5 = [
|
|
|
25818
25834
|
SDATA(data_type_t.DTP_BOOLEAN, "with_checkbox", 0, true, "Auxiliary first column to select rows"),
|
|
25819
25835
|
SDATA(data_type_t.DTP_BOOLEAN, "with_radio", 0, false, "Auxiliary first column to select one row"),
|
|
25820
25836
|
SDATA(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"),
|
|
25821
|
-
SDATA(data_type_t.DTP_BOOLEAN, "broadcast_select_rows_event", 0, false, "
|
|
25822
|
-
SDATA(data_type_t.DTP_BOOLEAN, "broadcast_unselect_rows_event", 0, false, "
|
|
25837
|
+
SDATA(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"),
|
|
25838
|
+
SDATA(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"),
|
|
25823
25839
|
SDATA(data_type_t.DTP_JSON, "tabulator_settings", 0, {
|
|
25824
25840
|
layout: "fitDataFill",
|
|
25825
25841
|
columnDefaults: { resizable: true },
|
|
@@ -26098,7 +26114,11 @@ function build_ui$5(gobj) {
|
|
|
26098
26114
|
"button",
|
|
26099
26115
|
{
|
|
26100
26116
|
id: ``,
|
|
26101
|
-
class: "button button-edit-record mr-1"
|
|
26117
|
+
class: "button button-edit-record mr-1",
|
|
26118
|
+
title: t("edit"),
|
|
26119
|
+
"data-i18n-title": "edit",
|
|
26120
|
+
"aria-label": t("edit"),
|
|
26121
|
+
"data-i18n-aria-label": "edit"
|
|
26102
26122
|
},
|
|
26103
26123
|
[yui_toolbar_icon("yi-pen"), [
|
|
26104
26124
|
"span",
|
|
@@ -26121,6 +26141,10 @@ function build_ui$5(gobj) {
|
|
|
26121
26141
|
{
|
|
26122
26142
|
id: ``,
|
|
26123
26143
|
class: "button button-new-record mr-1",
|
|
26144
|
+
title: t("new"),
|
|
26145
|
+
"data-i18n-title": "new",
|
|
26146
|
+
"aria-label": t("new"),
|
|
26147
|
+
"data-i18n-aria-label": "new",
|
|
26124
26148
|
disabled: true
|
|
26125
26149
|
},
|
|
26126
26150
|
[yui_toolbar_icon("yi-plus"), [
|
|
@@ -26145,6 +26169,10 @@ function build_ui$5(gobj) {
|
|
|
26145
26169
|
{
|
|
26146
26170
|
id: ``,
|
|
26147
26171
|
class: "button button-delete-record mr-1",
|
|
26172
|
+
title: t("delete"),
|
|
26173
|
+
"data-i18n-title": "delete",
|
|
26174
|
+
"aria-label": t("delete"),
|
|
26175
|
+
"data-i18n-aria-label": "delete",
|
|
26148
26176
|
disabled: true
|
|
26149
26177
|
},
|
|
26150
26178
|
[yui_toolbar_icon("yi-trash"), [
|
|
@@ -26169,6 +26197,10 @@ function build_ui$5(gobj) {
|
|
|
26169
26197
|
{
|
|
26170
26198
|
id: ``,
|
|
26171
26199
|
class: "button button-copy-record mr-1",
|
|
26200
|
+
title: t("copy"),
|
|
26201
|
+
"data-i18n-title": "copy",
|
|
26202
|
+
"aria-label": t("copy"),
|
|
26203
|
+
"data-i18n-aria-label": "copy",
|
|
26172
26204
|
disabled: true
|
|
26173
26205
|
},
|
|
26174
26206
|
[yui_toolbar_icon("yi-copy"), [
|
|
@@ -26193,6 +26225,10 @@ function build_ui$5(gobj) {
|
|
|
26193
26225
|
{
|
|
26194
26226
|
id: ``,
|
|
26195
26227
|
class: "button button-paste-record mr-1",
|
|
26228
|
+
title: t("paste"),
|
|
26229
|
+
"data-i18n-title": "paste",
|
|
26230
|
+
"aria-label": t("paste"),
|
|
26231
|
+
"data-i18n-aria-label": "paste",
|
|
26196
26232
|
disabled: true
|
|
26197
26233
|
},
|
|
26198
26234
|
[yui_toolbar_icon("yi-paste"), [
|
|
@@ -26232,7 +26268,11 @@ function build_ui$5(gobj) {
|
|
|
26232
26268
|
class: "input",
|
|
26233
26269
|
type: "text",
|
|
26234
26270
|
placeholder: t("search"),
|
|
26235
|
-
"data-i18n-placeholder": "search"
|
|
26271
|
+
"data-i18n-placeholder": "search",
|
|
26272
|
+
title: t("search"),
|
|
26273
|
+
"data-i18n-title": "search",
|
|
26274
|
+
"aria-label": t("search"),
|
|
26275
|
+
"data-i18n-aria-label": "search"
|
|
26236
26276
|
}], [
|
|
26237
26277
|
"span",
|
|
26238
26278
|
{ class: "icon is-left" },
|
|
@@ -26252,7 +26292,9 @@ function build_ui$5(gobj) {
|
|
|
26252
26292
|
{
|
|
26253
26293
|
class: "button mr-1",
|
|
26254
26294
|
title: t("refresh"),
|
|
26255
|
-
"data-i18n-title": "refresh"
|
|
26295
|
+
"data-i18n-title": "refresh",
|
|
26296
|
+
"aria-label": t("refresh"),
|
|
26297
|
+
"data-i18n-aria-label": "refresh"
|
|
26256
26298
|
},
|
|
26257
26299
|
[yui_toolbar_icon("yi-arrows-rotate"), [
|
|
26258
26300
|
"span",
|
|
@@ -26785,7 +26827,7 @@ function create_tabulator(gobj) {
|
|
|
26785
26827
|
let index = cell.getRow().getPosition();
|
|
26786
26828
|
if (e.target.closest(".edit")) {
|
|
26787
26829
|
e.stopPropagation();
|
|
26788
|
-
|
|
26830
|
+
gobj_send_event(gobj, "EV_EDIT_RECORD", { index }, gobj);
|
|
26789
26831
|
} else if (e.target.closest(".remove")) {
|
|
26790
26832
|
e.stopPropagation();
|
|
26791
26833
|
gobj_send_event(gobj, "EV_DELETE_ROWS", {
|
|
@@ -27247,11 +27289,11 @@ function open_form_dialog(gobj, mode, record) {
|
|
|
27247
27289
|
return;
|
|
27248
27290
|
}
|
|
27249
27291
|
let pkey = desc.pkey || "id";
|
|
27250
|
-
let title;
|
|
27251
|
-
|
|
27252
|
-
|
|
27292
|
+
let title = mode === "create" ? "new" : mode === "view" ? "view" : "edit";
|
|
27293
|
+
let title_prefix = "";
|
|
27294
|
+
if (mode !== "create") {
|
|
27253
27295
|
let rid = record ? String(record[pkey] ?? "") : "";
|
|
27254
|
-
|
|
27296
|
+
title_prefix = empty_string(rid) ? "" : rid;
|
|
27255
27297
|
}
|
|
27256
27298
|
let view_only = mode === "view";
|
|
27257
27299
|
let form_mode = view_only ? "update" : mode;
|
|
@@ -27286,6 +27328,7 @@ function open_form_dialog(gobj, mode, record) {
|
|
|
27286
27328
|
priv.form_modal = yui_shell_show_modal(shell, $body, {
|
|
27287
27329
|
dialog: true,
|
|
27288
27330
|
logical_class: "TREEDB_FORM_SHEET",
|
|
27331
|
+
title_prefix,
|
|
27289
27332
|
title,
|
|
27290
27333
|
t,
|
|
27291
27334
|
before_close: function() {
|
|
@@ -27314,14 +27357,7 @@ function form_may_close(gobj) {
|
|
|
27314
27357
|
let kw = {};
|
|
27315
27358
|
gobj_send_event(priv.form, "EV_WINDOW_TO_CLOSE", kw, gobj);
|
|
27316
27359
|
if (kw.abort_close) {
|
|
27317
|
-
|
|
27318
|
-
t,
|
|
27319
|
-
yes_label: "yes",
|
|
27320
|
-
no_label: "no",
|
|
27321
|
-
cancel_label: "cancel"
|
|
27322
|
-
}).then(function(answer) {
|
|
27323
|
-
if (answer === "yes" && priv.form_modal) priv.form_modal.close();
|
|
27324
|
-
});
|
|
27360
|
+
confirm_then$1(gobj, kw.warning || "all changes will be lost", { what: "close_form" });
|
|
27325
27361
|
return false;
|
|
27326
27362
|
}
|
|
27327
27363
|
}
|
|
@@ -27343,6 +27379,31 @@ function teardown_form_child(gobj) {
|
|
|
27343
27379
|
priv.form_modal = null;
|
|
27344
27380
|
}
|
|
27345
27381
|
/************************************************************
|
|
27382
|
+
* Ask, and turn the answer into an EVENT.
|
|
27383
|
+
*
|
|
27384
|
+
* A dialog's promise settles outside the machine: acting from its
|
|
27385
|
+
* `.then` puts the decision -- delete these records, throw these
|
|
27386
|
+
* edits away -- in a callback the `machine` trace never sees, and
|
|
27387
|
+
* in a view that may be gone by the time the person answers.
|
|
27388
|
+
*
|
|
27389
|
+
* `kw` carries an IDENTITY and never an object: the trace dumps
|
|
27390
|
+
* it, and a gobj, a Tabulator row or a DOM node in there is a
|
|
27391
|
+
* circular structure that breaks the very trace the FSM feeds.
|
|
27392
|
+
*
|
|
27393
|
+
* Same shape as C_YUI_SCHEMA_EDITOR's confirm_then().
|
|
27394
|
+
************************************************************/
|
|
27395
|
+
function confirm_then$1(gobj, message, kw) {
|
|
27396
|
+
yui_shell_confirm_yesnocancel(yui_shell_of(gobj), message, {
|
|
27397
|
+
t,
|
|
27398
|
+
yes_label: "yes",
|
|
27399
|
+
no_label: "no",
|
|
27400
|
+
cancel_label: "cancel"
|
|
27401
|
+
}).then(function(answer) {
|
|
27402
|
+
if (answer !== "yes" || gobj_is_destroying(gobj)) return;
|
|
27403
|
+
gobj_send_event(gobj, "EV_CONFIRMED", kw, gobj);
|
|
27404
|
+
});
|
|
27405
|
+
}
|
|
27406
|
+
/************************************************************
|
|
27346
27407
|
* Force the dialog down (bypasses the unsaved guard): used after a
|
|
27347
27408
|
* successful save and on teardown. Closing the modal runs its
|
|
27348
27409
|
* on_close, which tears the form child down.
|
|
@@ -27923,7 +27984,7 @@ function pkey_is_rowid(gobj) {
|
|
|
27923
27984
|
* Show the edit "update" form of a row (record)
|
|
27924
27985
|
* internally called from the icon edit at Op column
|
|
27925
27986
|
************************************************************/
|
|
27926
|
-
function show_edit_form(gobj, row
|
|
27987
|
+
function show_edit_form(gobj, row) {
|
|
27927
27988
|
open_form_dialog(gobj, pkey_is_rowid(gobj) ? "create" : "update", row);
|
|
27928
27989
|
}
|
|
27929
27990
|
/************************************************************
|
|
@@ -28422,31 +28483,57 @@ function ac_delete_rows(gobj, event, kw, src) {
|
|
|
28422
28483
|
});
|
|
28423
28484
|
return 0;
|
|
28424
28485
|
}
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28428
|
-
|
|
28429
|
-
cancel_label: "cancel"
|
|
28430
|
-
}).then(function(answer) {
|
|
28431
|
-
if (answer === "yes") for (let row of rows) gobj_publish_event(gobj, "EV_DELETE_RECORD", {
|
|
28432
|
-
topic_name: gobj_read_str_attr(gobj, "topic_name"),
|
|
28433
|
-
record: row
|
|
28434
|
-
});
|
|
28435
|
-
});
|
|
28436
|
-
} else yui_shell_confirm_yesnocancel(yui_shell_of(gobj), build_delete_question(gobj, kw.row), {
|
|
28437
|
-
t,
|
|
28438
|
-
yes_label: "yes",
|
|
28439
|
-
no_label: "no",
|
|
28440
|
-
cancel_label: "cancel"
|
|
28441
|
-
}).then(function(answer) {
|
|
28442
|
-
if (answer === "yes") gobj_publish_event(gobj, "EV_DELETE_RECORD", {
|
|
28443
|
-
topic_name: gobj_read_str_attr(gobj, "topic_name"),
|
|
28444
|
-
record: kw.row
|
|
28445
|
-
});
|
|
28486
|
+
confirm_then$1(gobj, build_delete_question(gobj, rows), { what: "delete_selection" });
|
|
28487
|
+
} else confirm_then$1(gobj, build_delete_question(gobj, kw.row), {
|
|
28488
|
+
what: "delete_row",
|
|
28489
|
+
index: kw.index
|
|
28446
28490
|
});
|
|
28447
28491
|
return 0;
|
|
28448
28492
|
}
|
|
28449
28493
|
/************************************************************
|
|
28494
|
+
* {what, ...} -- the person said yes to what confirm_then()
|
|
28495
|
+
* asked. The rows are read again HERE and not carried in the
|
|
28496
|
+
* kw: the kw is plain json, and a Tabulator row is not.
|
|
28497
|
+
************************************************************/
|
|
28498
|
+
function ac_confirmed$2(gobj, event, kw, src) {
|
|
28499
|
+
let priv = gobj.priv;
|
|
28500
|
+
let what = kw ? kw.what : "";
|
|
28501
|
+
if (what === "close_form") {
|
|
28502
|
+
if (priv.form_modal) priv.form_modal.close();
|
|
28503
|
+
return 0;
|
|
28504
|
+
}
|
|
28505
|
+
if (refuse_if_readonly$2(gobj, event)) return -1;
|
|
28506
|
+
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
28507
|
+
let topic_name = gobj_read_str_attr(gobj, "topic_name");
|
|
28508
|
+
if (what === "delete_selection") {
|
|
28509
|
+
let rows = yui_selected_rows(tabulator);
|
|
28510
|
+
if (!rows.length) {
|
|
28511
|
+
log_error(`${gobj_short_name(gobj)}: ${event} with the selection gone`);
|
|
28512
|
+
return -1;
|
|
28513
|
+
}
|
|
28514
|
+
for (let row of rows) gobj_publish_event(gobj, "EV_DELETE_RECORD", {
|
|
28515
|
+
topic_name,
|
|
28516
|
+
record: row
|
|
28517
|
+
});
|
|
28518
|
+
return 0;
|
|
28519
|
+
}
|
|
28520
|
+
if (what === "delete_row") {
|
|
28521
|
+
let index = kw.index;
|
|
28522
|
+
let row = tabulator && typeof index === "number" ? tabulator.getRowFromPosition(index) : null;
|
|
28523
|
+
if (!row) {
|
|
28524
|
+
log_error(`${gobj_short_name(gobj)}: ${event} names no row: ${index}`);
|
|
28525
|
+
return -1;
|
|
28526
|
+
}
|
|
28527
|
+
gobj_publish_event(gobj, "EV_DELETE_RECORD", {
|
|
28528
|
+
topic_name,
|
|
28529
|
+
record: row.getData()
|
|
28530
|
+
});
|
|
28531
|
+
return 0;
|
|
28532
|
+
}
|
|
28533
|
+
log_error(`${gobj_short_name(gobj)}: ${event} of nothing this view asked about: ${what}`);
|
|
28534
|
+
return -1;
|
|
28535
|
+
}
|
|
28536
|
+
/************************************************************
|
|
28450
28537
|
* From internal
|
|
28451
28538
|
************************************************************/
|
|
28452
28539
|
function ac_copy_rows(gobj, event, kw, src) {
|
|
@@ -28501,9 +28588,7 @@ function ac_form_save_record(gobj, event, kw, src) {
|
|
|
28501
28588
|
const cols = Object.keys(picked);
|
|
28502
28589
|
if (cols.length === 0) {
|
|
28503
28590
|
publish_treedb_write(gobj, mode, kw);
|
|
28504
|
-
|
|
28505
|
-
close_form_dialog(gobj);
|
|
28506
|
-
}, 0);
|
|
28591
|
+
gobj_post_event(gobj, "EV_CLOSE_FORM", {}, gobj);
|
|
28507
28592
|
return 0;
|
|
28508
28593
|
}
|
|
28509
28594
|
const serial = ++priv.read_serial;
|
|
@@ -28581,6 +28666,14 @@ function publish_treedb_write(gobj, mode, record, jn_files) {
|
|
|
28581
28666
|
gobj_publish_event(gobj, mode === "create" ? "EV_CREATE_RECORD" : "EV_UPDATE_RECORD", kw_write);
|
|
28582
28667
|
}
|
|
28583
28668
|
/************************************************************
|
|
28669
|
+
* The deferred close of the form dialog, posted by the save
|
|
28670
|
+
* from inside the form child's own publish stack.
|
|
28671
|
+
************************************************************/
|
|
28672
|
+
function ac_close_form(gobj, event, kw, src) {
|
|
28673
|
+
close_form_dialog(gobj);
|
|
28674
|
+
return 0;
|
|
28675
|
+
}
|
|
28676
|
+
/************************************************************
|
|
28584
28677
|
* {mode, record, picks} -- the bytes are here now
|
|
28585
28678
|
************************************************************/
|
|
28586
28679
|
function ac_files_read(gobj, event, kw, src) {
|
|
@@ -28621,7 +28714,7 @@ function ac_select_rows(gobj, event, kw, src) {
|
|
|
28621
28714
|
************************************************************/
|
|
28622
28715
|
function ac_unselect_rows(gobj, event, kw, src) {
|
|
28623
28716
|
render_selection_state(gobj);
|
|
28624
|
-
if (gobj_read_bool_attr(gobj, "
|
|
28717
|
+
if (gobj_read_bool_attr(gobj, "broadcast_unselect_rows_event")) gobj_publish_event(gobj, event, kw);
|
|
28625
28718
|
return 0;
|
|
28626
28719
|
}
|
|
28627
28720
|
/************************************************************
|
|
@@ -29101,6 +29194,26 @@ function ac_show_record(gobj, event, kw, src) {
|
|
|
29101
29194
|
return 0;
|
|
29102
29195
|
}
|
|
29103
29196
|
/************************************************************
|
|
29197
|
+
* {index} -- the pencil of the Op column. Same shape as
|
|
29198
|
+
* EV_SHOW_RECORD: the kw carries WHICH row, and the row itself
|
|
29199
|
+
* is resolved here, where the table is.
|
|
29200
|
+
************************************************************/
|
|
29201
|
+
function ac_edit_record(gobj, event, kw, src) {
|
|
29202
|
+
let tabulator = gobj_read_attr(gobj, "tabulator");
|
|
29203
|
+
let index = kw ? kw.index : void 0;
|
|
29204
|
+
if (!tabulator || typeof index !== "number") {
|
|
29205
|
+
log_error(`${gobj_short_name(gobj)}: no row ${index} to edit`);
|
|
29206
|
+
return -1;
|
|
29207
|
+
}
|
|
29208
|
+
let row = tabulator.getRowFromPosition(index);
|
|
29209
|
+
if (!row) {
|
|
29210
|
+
log_error(`${gobj_short_name(gobj)}: row ${index} is gone`);
|
|
29211
|
+
return -1;
|
|
29212
|
+
}
|
|
29213
|
+
show_edit_form(gobj, row.getData());
|
|
29214
|
+
return 0;
|
|
29215
|
+
}
|
|
29216
|
+
/************************************************************
|
|
29104
29217
|
* The reader picked another page size: remember it, so coming back to
|
|
29105
29218
|
* this topic opens where they left it instead of at 200.
|
|
29106
29219
|
************************************************************/
|
|
@@ -29225,6 +29338,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29225
29338
|
ac_form_save_record,
|
|
29226
29339
|
null
|
|
29227
29340
|
],
|
|
29341
|
+
[
|
|
29342
|
+
"EV_CLOSE_FORM",
|
|
29343
|
+
ac_close_form,
|
|
29344
|
+
null
|
|
29345
|
+
],
|
|
29228
29346
|
[
|
|
29229
29347
|
"EV_FILES_READ",
|
|
29230
29348
|
ac_files_read,
|
|
@@ -29245,6 +29363,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29245
29363
|
ac_delete_rows,
|
|
29246
29364
|
null
|
|
29247
29365
|
],
|
|
29366
|
+
[
|
|
29367
|
+
"EV_CONFIRMED",
|
|
29368
|
+
ac_confirmed$2,
|
|
29369
|
+
null
|
|
29370
|
+
],
|
|
29248
29371
|
[
|
|
29249
29372
|
"EV_SELECT_ROWS",
|
|
29250
29373
|
ac_select_rows,
|
|
@@ -29370,6 +29493,11 @@ function create_gclass$5(gclass_name) {
|
|
|
29370
29493
|
ac_show_record,
|
|
29371
29494
|
null
|
|
29372
29495
|
],
|
|
29496
|
+
[
|
|
29497
|
+
"EV_EDIT_RECORD",
|
|
29498
|
+
ac_edit_record,
|
|
29499
|
+
null
|
|
29500
|
+
],
|
|
29373
29501
|
[
|
|
29374
29502
|
"EV_TOGGLE_COLUMN",
|
|
29375
29503
|
ac_toggle_column,
|
|
@@ -29399,10 +29527,12 @@ function create_gclass$5(gclass_name) {
|
|
|
29399
29527
|
["EV_NODE_DELETED", 0],
|
|
29400
29528
|
["EV_EDITION_MODE", 0],
|
|
29401
29529
|
["EV_SAVE_RECORD", 0],
|
|
29530
|
+
["EV_CLOSE_FORM", 0],
|
|
29402
29531
|
["EV_FILES_READ", 0],
|
|
29403
29532
|
["EV_FILES_FAILED", 0],
|
|
29404
29533
|
["EV_NEW_ROW", 0],
|
|
29405
29534
|
["EV_DELETE_ROWS", 0],
|
|
29535
|
+
["EV_CONFIRMED", 0],
|
|
29406
29536
|
["EV_COPY_ROWS", 0],
|
|
29407
29537
|
["EV_PASTE_ROWS", 0],
|
|
29408
29538
|
["EV_CLEAR_SELECTION", 0],
|
|
@@ -29432,6 +29562,7 @@ function create_gclass$5(gclass_name) {
|
|
|
29432
29562
|
["EV_OPEN_COLUMNS", 0],
|
|
29433
29563
|
["EV_PAGE_SIZE_CHANGED", 0],
|
|
29434
29564
|
["EV_SHOW_RECORD", 0],
|
|
29565
|
+
["EV_EDIT_RECORD", 0],
|
|
29435
29566
|
["EV_TOGGLE_COLUMN", 0],
|
|
29436
29567
|
["EV_EXPORT_TABLE", 0],
|
|
29437
29568
|
["EV_CREATE_RECORD", event_flag_t.EVF_OUTPUT_EVENT],
|
|
@@ -57965,13 +58096,38 @@ function build_graph$1(gobj) {
|
|
|
57965
58096
|
graph.setLayout(layout);
|
|
57966
58097
|
priv.graph_rendered = false;
|
|
57967
58098
|
graph_render(gobj).then(() => {
|
|
58099
|
+
if (gobj_is_destroying(gobj) || !priv.graph) return;
|
|
57968
58100
|
configure_events(gobj);
|
|
57969
58101
|
configure_behaviour(gobj);
|
|
57970
58102
|
configure_plugins(gobj);
|
|
57971
58103
|
priv.graph_rendered = true;
|
|
58104
|
+
}).catch((e) => {
|
|
58105
|
+
log_error(`${gobj_short_name(gobj)}: graph render failed: ${e}`);
|
|
57972
58106
|
});
|
|
57973
58107
|
}
|
|
57974
58108
|
/************************************************************
|
|
58109
|
+
* A G6 event, as PLAIN JSON.
|
|
58110
|
+
*
|
|
58111
|
+
* A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
|
|
58112
|
+
* G6 / @antv/g event is circular: serializing one THROWS, so the
|
|
58113
|
+
* first thing a kw carrying `evt` breaks is the trace the FSM
|
|
58114
|
+
* exists to feed. It also drags a live graph element into a
|
|
58115
|
+
* message that may be read after that element is gone.
|
|
58116
|
+
*
|
|
58117
|
+
* What the actions read of it is an id and three scalars. The
|
|
58118
|
+
* event itself never leaves the callback that received it.
|
|
58119
|
+
************************************************************/
|
|
58120
|
+
function g6_event_kw(evt) {
|
|
58121
|
+
let target = evt && evt.target ? evt.target : null;
|
|
58122
|
+
let client = evt && evt.client ? evt.client : null;
|
|
58123
|
+
return {
|
|
58124
|
+
id: target && target.id ? String(target.id) : "",
|
|
58125
|
+
shift: !!(evt && evt.shiftKey),
|
|
58126
|
+
client_x: client && typeof client.x === "number" ? client.x : 0,
|
|
58127
|
+
client_y: client && typeof client.y === "number" ? client.y : 0
|
|
58128
|
+
};
|
|
58129
|
+
}
|
|
58130
|
+
/************************************************************
|
|
57975
58131
|
* Configure G6 event handlers
|
|
57976
58132
|
************************************************************/
|
|
57977
58133
|
function configure_events(gobj) {
|
|
@@ -57979,7 +58135,7 @@ function configure_events(gobj) {
|
|
|
57979
58135
|
let graph = priv.graph;
|
|
57980
58136
|
graph.on(CanvasEvent.CLICK, (evt) => {
|
|
57981
58137
|
if (consume_long_press_click(graph)) return;
|
|
57982
|
-
gobj_send_event(gobj, "EV_CANVAS_CLICK",
|
|
58138
|
+
gobj_send_event(gobj, "EV_CANVAS_CLICK", g6_event_kw(evt), gobj);
|
|
57983
58139
|
});
|
|
57984
58140
|
graph.on(NodeEvent.DRAG, (evt) => {
|
|
57985
58141
|
update_resize_handles_position(gobj);
|
|
@@ -57990,21 +58146,21 @@ function configure_events(gobj) {
|
|
|
57990
58146
|
update_port_icon_position(gobj);
|
|
57991
58147
|
});
|
|
57992
58148
|
graph.on(NodeEvent.DRAG_END, (evt) => {
|
|
57993
|
-
gobj_send_event(gobj, "EV_NODE_DRAG_END",
|
|
58149
|
+
gobj_send_event(gobj, "EV_NODE_DRAG_END", g6_event_kw(evt), gobj);
|
|
57994
58150
|
});
|
|
57995
58151
|
graph.on(NodeEvent.CLICK, (evt) => {
|
|
57996
58152
|
if (consume_long_press_click(graph)) return;
|
|
57997
|
-
gobj_send_event(gobj, "EV_NODE_CLICK",
|
|
58153
|
+
gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
|
|
57998
58154
|
});
|
|
57999
58155
|
graph.on(NodeEvent.CONTEXT_MENU, (evt) => {
|
|
58000
|
-
gobj_send_event(gobj, "EV_NODE_CONTEXT_MENU",
|
|
58156
|
+
gobj_send_event(gobj, "EV_NODE_CONTEXT_MENU", g6_event_kw(evt), gobj);
|
|
58001
58157
|
});
|
|
58002
58158
|
graph.on(NodeEvent.DBLCLICK, (evt) => {
|
|
58003
|
-
gobj_send_event(gobj, "EV_NODE_DBLCLICK",
|
|
58159
|
+
gobj_send_event(gobj, "EV_NODE_DBLCLICK", g6_event_kw(evt), gobj);
|
|
58004
58160
|
});
|
|
58005
58161
|
graph.on(EdgeEvent.CLICK, (evt) => {
|
|
58006
58162
|
if (consume_long_press_click(graph)) return;
|
|
58007
|
-
gobj_send_event(gobj, "EV_EDGE_CLICK",
|
|
58163
|
+
gobj_send_event(gobj, "EV_EDGE_CLICK", g6_event_kw(evt), gobj);
|
|
58008
58164
|
});
|
|
58009
58165
|
graph.on("aftertransform", () => {
|
|
58010
58166
|
update_resize_handles_position(gobj);
|
|
@@ -58088,7 +58244,7 @@ function configure_plugins(gobj) {
|
|
|
58088
58244
|
graph_add_plugin(gobj, "contextmenu", {
|
|
58089
58245
|
trigger: "contextmenu",
|
|
58090
58246
|
onClick: (value) => {
|
|
58091
|
-
|
|
58247
|
+
gobj_send_event(gobj, "EV_CONTEXT_MENU_ITEM", { value: String(value) }, gobj);
|
|
58092
58248
|
},
|
|
58093
58249
|
getItems: (e) => {
|
|
58094
58250
|
return build_context_menu_items(gobj, e);
|
|
@@ -61804,7 +61960,7 @@ function show_edge_icon(gobj) {
|
|
|
61804
61960
|
if (!priv._selected_edge_id) return;
|
|
61805
61961
|
let mid = get_edge_viewport_midpoint(gobj, priv._selected_edge_id);
|
|
61806
61962
|
if (!mid) return;
|
|
61807
|
-
let icons = show_dual_icons(gobj, mid.x + 4, mid.y + floating_icon_dy(), t("edge properties"), () => toggle_edge_popover(gobj), t("unlink"), () =>
|
|
61963
|
+
let icons = show_dual_icons(gobj, mid.x + 4, mid.y + floating_icon_dy(), t("edge properties"), () => toggle_edge_popover(gobj), t("unlink"), () => gobj_send_event(gobj, "EV_REQUEST_UNLINK_EDGE", {}, gobj));
|
|
61808
61964
|
priv._edge_icon_el = icons.icon_el;
|
|
61809
61965
|
priv._edge_delete_el = icons.delete_el;
|
|
61810
61966
|
}
|
|
@@ -61959,7 +62115,7 @@ function show_node_icon(gobj) {
|
|
|
61959
62115
|
if (!priv._selected_node_id || priv._selected_port_key) return;
|
|
61960
62116
|
let rect = get_node_viewport_rect(gobj, priv._selected_node_id);
|
|
61961
62117
|
if (!rect) return;
|
|
61962
|
-
let icons = show_dual_icons(gobj, rect.right + 4, rect.top + floating_icon_dy(), t("node properties"), () => toggle_node_popover(gobj), t("delete node"), () =>
|
|
62118
|
+
let icons = show_dual_icons(gobj, rect.right + 4, rect.top + floating_icon_dy(), t("node properties"), () => toggle_node_popover(gobj), t("delete node"), () => gobj_send_event(gobj, "EV_REQUEST_DELETE_NODE", {}, gobj));
|
|
61963
62119
|
priv._node_icon_el = icons.icon_el;
|
|
61964
62120
|
priv._node_delete_el = icons.delete_el;
|
|
61965
62121
|
}
|
|
@@ -62672,7 +62828,10 @@ function request_delete_selection(gobj) {
|
|
|
62672
62828
|
execute_delete_selection(gobj, nodes);
|
|
62673
62829
|
return;
|
|
62674
62830
|
}
|
|
62675
|
-
show_confirm_popover(gobj, null, delete_question(nodes), "delete", "#ff4d4f", () =>
|
|
62831
|
+
show_confirm_popover(gobj, null, delete_question(nodes), "delete", "#ff4d4f", () => gobj_send_event(gobj, "EV_CONFIRMED", {
|
|
62832
|
+
what: "delete_selection",
|
|
62833
|
+
ids: nodes.map((nd) => String(nd.id))
|
|
62834
|
+
}, gobj), "_delete_confirm_el");
|
|
62676
62835
|
}
|
|
62677
62836
|
function execute_delete_selection(gobj, nodes) {
|
|
62678
62837
|
let priv = gobj.priv;
|
|
@@ -62689,7 +62848,10 @@ function execute_delete_selection(gobj, nodes) {
|
|
|
62689
62848
|
************************************************************/
|
|
62690
62849
|
function show_delete_confirm(gobj, nodeData) {
|
|
62691
62850
|
let priv = gobj.priv;
|
|
62692
|
-
show_confirm_popover(gobj, priv._node_delete_el, delete_question([nodeData]), "delete", "#ff4d4f", () =>
|
|
62851
|
+
show_confirm_popover(gobj, priv._node_delete_el, delete_question([nodeData]), "delete", "#ff4d4f", () => gobj_send_event(gobj, "EV_CONFIRMED", {
|
|
62852
|
+
what: "delete_node",
|
|
62853
|
+
id: String(nodeData.id)
|
|
62854
|
+
}, gobj), "_delete_confirm_el");
|
|
62693
62855
|
}
|
|
62694
62856
|
function hide_delete_confirm(gobj) {
|
|
62695
62857
|
hide_overlay(gobj, "_delete_confirm_el");
|
|
@@ -62787,7 +62949,10 @@ function show_create_popover(gobj) {
|
|
|
62787
62949
|
idInput.focus();
|
|
62788
62950
|
return;
|
|
62789
62951
|
}
|
|
62790
|
-
|
|
62952
|
+
gobj_send_event(gobj, "EV_SUBMIT_NEW_NODE", {
|
|
62953
|
+
topic_name: String(topicSelect.value),
|
|
62954
|
+
id: node_id
|
|
62955
|
+
}, gobj);
|
|
62791
62956
|
}
|
|
62792
62957
|
}]);
|
|
62793
62958
|
createBtn = popover.querySelector("button:last-child");
|
|
@@ -62847,7 +63012,10 @@ function execute_unlink_edge(gobj, edgeData) {
|
|
|
62847
63012
|
function show_unlink_confirm(gobj, edgeData) {
|
|
62848
63013
|
let priv = gobj.priv;
|
|
62849
63014
|
const d = edgeData.data;
|
|
62850
|
-
show_confirm_popover(gobj, priv._edge_delete_el, t("unlink") + " " + d.child_id + " → " + d.parent_id + "?\n" + t("neither record is deleted"), "unlink", "#ff4d4f", () =>
|
|
63015
|
+
show_confirm_popover(gobj, priv._edge_delete_el, t("unlink") + " " + d.child_id + " → " + d.parent_id + "?\n" + t("neither record is deleted"), "unlink", "#ff4d4f", () => gobj_send_event(gobj, "EV_CONFIRMED", {
|
|
63016
|
+
what: "unlink_edge",
|
|
63017
|
+
id: String(edgeData.id)
|
|
63018
|
+
}, gobj), "_unlink_confirm_el");
|
|
62851
63019
|
}
|
|
62852
63020
|
function hide_unlink_confirm(gobj) {
|
|
62853
63021
|
hide_overlay(gobj, "_unlink_confirm_el");
|
|
@@ -64730,7 +64898,7 @@ function ac_toggle_node_mode(gobj, event, kw, src) {
|
|
|
64730
64898
|
************************************************************/
|
|
64731
64899
|
function ac_node_dblclick(gobj, event, kw, src) {
|
|
64732
64900
|
let priv = gobj.priv;
|
|
64733
|
-
let node_id = kw && kw.
|
|
64901
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
64734
64902
|
let nd = null;
|
|
64735
64903
|
try {
|
|
64736
64904
|
nd = priv.graph.getNodeData(node_id);
|
|
@@ -64926,7 +65094,7 @@ function ac_brush_select(gobj, event, kw, src) {
|
|
|
64926
65094
|
function ac_node_click$2(gobj, event, kw, src) {
|
|
64927
65095
|
let priv = gobj.priv;
|
|
64928
65096
|
let graph = priv.graph;
|
|
64929
|
-
let node_id = kw.
|
|
65097
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
64930
65098
|
let more_nd = null;
|
|
64931
65099
|
try {
|
|
64932
65100
|
more_nd = graph.getNodeData(node_id);
|
|
@@ -64953,10 +65121,10 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
64953
65121
|
topic_name: nodedata.data.desc.topic_name,
|
|
64954
65122
|
record: nodedata.data.record
|
|
64955
65123
|
});
|
|
64956
|
-
if (priv.edit_mode && (kw.
|
|
65124
|
+
if (priv.edit_mode && (kw.shift || priv.selection_mode)) toggle_in_selection(gobj, node_id);
|
|
64957
65125
|
else if (priv.edit_mode) {
|
|
64958
65126
|
let containerRect = priv.$container.getBoundingClientRect();
|
|
64959
|
-
let canvasPoint = graph.getCanvasByViewport([kw.
|
|
65127
|
+
let canvasPoint = graph.getCanvasByViewport([kw.client_x - containerRect.left, kw.client_y - containerRect.top]);
|
|
64960
65128
|
let port_key = detect_port_click(gobj, node_id, canvasPoint[0], canvasPoint[1]);
|
|
64961
65129
|
if (priv._linking_mode) {
|
|
64962
65130
|
if (port_key && try_complete_link(gobj, node_id, port_key)) return 0;
|
|
@@ -64979,7 +65147,7 @@ function ac_node_click$2(gobj, event, kw, src) {
|
|
|
64979
65147
|
function ac_edge_click(gobj, event, kw, src) {
|
|
64980
65148
|
let priv = gobj.priv;
|
|
64981
65149
|
let graph = priv.graph;
|
|
64982
|
-
let edge_id = kw.
|
|
65150
|
+
let edge_id = kw && kw.id ? kw.id : "";
|
|
64983
65151
|
try {
|
|
64984
65152
|
let edgedata = graph.getEdgeData(edge_id);
|
|
64985
65153
|
if (edgedata && edgedata.data) {
|
|
@@ -65008,6 +65176,106 @@ function ac_node_context_menu(gobj, event, kw, src) {
|
|
|
65008
65176
|
return 0;
|
|
65009
65177
|
}
|
|
65010
65178
|
/************************************************************
|
|
65179
|
+
* {value} -- an item of the context menu was picked.
|
|
65180
|
+
************************************************************/
|
|
65181
|
+
function ac_context_menu_item(gobj, event, kw, src) {
|
|
65182
|
+
handle_context_menu_click(gobj, kw && kw.value ? kw.value : "");
|
|
65183
|
+
return 0;
|
|
65184
|
+
}
|
|
65185
|
+
/************************************************************
|
|
65186
|
+
* The delete icon floating beside the selected node.
|
|
65187
|
+
************************************************************/
|
|
65188
|
+
function ac_request_delete_node(gobj, event, kw, src) {
|
|
65189
|
+
request_delete_node(gobj);
|
|
65190
|
+
return 0;
|
|
65191
|
+
}
|
|
65192
|
+
/************************************************************
|
|
65193
|
+
* The unlink icon floating beside the selected edge.
|
|
65194
|
+
************************************************************/
|
|
65195
|
+
function ac_request_unlink_edge(gobj, event, kw, src) {
|
|
65196
|
+
request_unlink_edge(gobj);
|
|
65197
|
+
return 0;
|
|
65198
|
+
}
|
|
65199
|
+
/************************************************************
|
|
65200
|
+
* {topic_name, id} -- the create popover was filled in.
|
|
65201
|
+
************************************************************/
|
|
65202
|
+
function ac_submit_new_node(gobj, event, kw, src) {
|
|
65203
|
+
let topic_name = kw && kw.topic_name ? kw.topic_name : "";
|
|
65204
|
+
let node_id = kw && kw.id ? kw.id : "";
|
|
65205
|
+
if (!topic_name || !node_id) {
|
|
65206
|
+
log_error(`${gobj_short_name(gobj)}: ${event} without topic or id`);
|
|
65207
|
+
return -1;
|
|
65208
|
+
}
|
|
65209
|
+
execute_create_node(gobj, topic_name, node_id);
|
|
65210
|
+
return 0;
|
|
65211
|
+
}
|
|
65212
|
+
/************************************************************
|
|
65213
|
+
* {what, id|ids} -- the person said yes in a confirm popover.
|
|
65214
|
+
*
|
|
65215
|
+
* The kw carries IDS and not the graph elements they name: a kw
|
|
65216
|
+
* is plain json, and a node/edge datum of a live graph is not
|
|
65217
|
+
* something to park in a message. They are resolved here, where
|
|
65218
|
+
* the graph is -- and an id that no longer names anything is a
|
|
65219
|
+
* loud refusal instead of a silent nothing.
|
|
65220
|
+
************************************************************/
|
|
65221
|
+
function ac_confirmed$1(gobj, event, kw, src) {
|
|
65222
|
+
let graph = gobj.priv.graph;
|
|
65223
|
+
let what = kw && kw.what ? kw.what : "";
|
|
65224
|
+
if (!graph) {
|
|
65225
|
+
log_error(`${gobj_short_name(gobj)}: ${event} with no graph`);
|
|
65226
|
+
return -1;
|
|
65227
|
+
}
|
|
65228
|
+
if (what === "delete_selection") {
|
|
65229
|
+
let ids = kw && Array.isArray(kw.ids) ? kw.ids : [];
|
|
65230
|
+
let nodes = [];
|
|
65231
|
+
for (let id of ids) {
|
|
65232
|
+
let nd = null;
|
|
65233
|
+
try {
|
|
65234
|
+
nd = graph.getNodeData(id);
|
|
65235
|
+
} catch (e) {
|
|
65236
|
+
nd = null;
|
|
65237
|
+
}
|
|
65238
|
+
if (nd && nd.data && nd.data.desc) nodes.push(nd);
|
|
65239
|
+
}
|
|
65240
|
+
if (!nodes.length) {
|
|
65241
|
+
log_error(`${gobj_short_name(gobj)}: ${event} names no node any more`);
|
|
65242
|
+
return -1;
|
|
65243
|
+
}
|
|
65244
|
+
execute_delete_selection(gobj, nodes);
|
|
65245
|
+
return 0;
|
|
65246
|
+
}
|
|
65247
|
+
if (what === "delete_node") {
|
|
65248
|
+
let nd = null;
|
|
65249
|
+
try {
|
|
65250
|
+
nd = graph.getNodeData(kw.id);
|
|
65251
|
+
} catch (e) {
|
|
65252
|
+
nd = null;
|
|
65253
|
+
}
|
|
65254
|
+
if (!nd || !nd.data || !nd.data.desc) {
|
|
65255
|
+
log_error(`${gobj_short_name(gobj)}: ${event} names no node: ${kw.id}`);
|
|
65256
|
+
return -1;
|
|
65257
|
+
}
|
|
65258
|
+
execute_delete_node(gobj, nd);
|
|
65259
|
+
return 0;
|
|
65260
|
+
}
|
|
65261
|
+
if (what === "unlink_edge") {
|
|
65262
|
+
let ed = null;
|
|
65263
|
+
try {
|
|
65264
|
+
ed = graph.getEdgeData(kw.id);
|
|
65265
|
+
} catch (e) {
|
|
65266
|
+
ed = null;
|
|
65267
|
+
}
|
|
65268
|
+
if (!ed || !ed.data) {
|
|
65269
|
+
log_error(`${gobj_short_name(gobj)}: ${event} names no edge: ${kw.id}`);
|
|
65270
|
+
return -1;
|
|
65271
|
+
}
|
|
65272
|
+
execute_unlink_edge(gobj, ed);
|
|
65273
|
+
return 0;
|
|
65274
|
+
}
|
|
65275
|
+
log_error(`${gobj_short_name(gobj)}: ${event} of nothing this view asked about: ${what}`);
|
|
65276
|
+
return -1;
|
|
65277
|
+
}
|
|
65278
|
+
/************************************************************
|
|
65011
65279
|
* Canvas click
|
|
65012
65280
|
************************************************************/
|
|
65013
65281
|
function ac_canvas_click(gobj, event, kw, src) {
|
|
@@ -65171,6 +65439,31 @@ function create_gclass$4(gclass_name) {
|
|
|
65171
65439
|
ac_node_context_menu,
|
|
65172
65440
|
null
|
|
65173
65441
|
],
|
|
65442
|
+
[
|
|
65443
|
+
"EV_CONTEXT_MENU_ITEM",
|
|
65444
|
+
ac_context_menu_item,
|
|
65445
|
+
null
|
|
65446
|
+
],
|
|
65447
|
+
[
|
|
65448
|
+
"EV_REQUEST_DELETE_NODE",
|
|
65449
|
+
ac_request_delete_node,
|
|
65450
|
+
null
|
|
65451
|
+
],
|
|
65452
|
+
[
|
|
65453
|
+
"EV_REQUEST_UNLINK_EDGE",
|
|
65454
|
+
ac_request_unlink_edge,
|
|
65455
|
+
null
|
|
65456
|
+
],
|
|
65457
|
+
[
|
|
65458
|
+
"EV_SUBMIT_NEW_NODE",
|
|
65459
|
+
ac_submit_new_node,
|
|
65460
|
+
null
|
|
65461
|
+
],
|
|
65462
|
+
[
|
|
65463
|
+
"EV_CONFIRMED",
|
|
65464
|
+
ac_confirmed$1,
|
|
65465
|
+
null
|
|
65466
|
+
],
|
|
65174
65467
|
[
|
|
65175
65468
|
"EV_CANVAS_CLICK",
|
|
65176
65469
|
ac_canvas_click,
|
|
@@ -65387,6 +65680,11 @@ function create_gclass$4(gclass_name) {
|
|
|
65387
65680
|
["EV_NODE_CLICK", 0],
|
|
65388
65681
|
["EV_EDGE_CLICK", 0],
|
|
65389
65682
|
["EV_NODE_CONTEXT_MENU", 0],
|
|
65683
|
+
["EV_CONTEXT_MENU_ITEM", 0],
|
|
65684
|
+
["EV_REQUEST_DELETE_NODE", 0],
|
|
65685
|
+
["EV_REQUEST_UNLINK_EDGE", 0],
|
|
65686
|
+
["EV_SUBMIT_NEW_NODE", 0],
|
|
65687
|
+
["EV_CONFIRMED", 0],
|
|
65390
65688
|
["EV_CANVAS_CLICK", 0],
|
|
65391
65689
|
["EV_NODE_DRAG_END", 0],
|
|
65392
65690
|
["EV_BRUSH_SELECT", 0],
|