@yuneta/gobj-ui 7.26.41 → 7.26.43
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 +510 -78
- package/dist/gobj-ui.cjs.js +1120 -326
- package/dist/gobj-ui.es.js +1120 -326
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +971 -177
- package/src/c_g6_nodes_tree.js +3 -2
- package/src/c_yui_form.js +261 -154
- package/src/c_yui_fsm_graph.js +3 -2
- package/src/c_yui_gobj_tree_js.js +3 -2
- package/src/c_yui_json_graph.js +3 -2
- package/src/c_yui_nav.js +43 -28
- package/src/c_yui_node.js +51 -7
- package/src/c_yui_schema_editor.css +16 -0
- package/src/c_yui_schema_editor.js +110 -20
- package/src/c_yui_shell.css +4 -1
- package/src/c_yui_shell.js +227 -61
- package/src/c_yui_treedb_schema.js +3 -2
- package/src/c_yui_window.js +373 -62
- package/src/c_yui_window_manager.js +80 -8
- package/src/escape_taken.js +58 -0
- package/src/form_close_asks_for_edits.wiring.test.js +6 -3
- package/src/form_json_editor_names.js +3 -1
- package/src/form_json_editor_names.wiring.test.js +8 -4
- package/src/form_json_expand.wiring.test.js +6 -3
- package/src/form_json_field.wiring.test.js +8 -4
- package/src/form_label_i18n.wiring.test.js +10 -5
- package/src/form_table_edits_ask.wiring.test.js +18 -8
- package/src/form_table_rearm.wiring.test.js +13 -5
- package/src/form_table_rows.wiring.test.js +489 -0
- package/src/form_table_validator.wiring.test.js +8 -4
- package/src/form_template_field.wiring.test.js +6 -3
- package/src/g6_canvas_tab_order.css +29 -0
- package/src/g6_canvas_tab_order.js +41 -9
- package/src/g6_canvas_tab_order.wiring.test.js +107 -1
- package/src/g6_long_press_clock.test.js +8 -3
- package/src/i18n_key_functions.js +81 -27
- package/src/i18n_key_functions.test.js +402 -4
- package/src/modal_guard_back.wiring.test.js +188 -0
- package/src/named_controls.wiring.test.js +323 -19
- package/src/nav_cards_helpers.js +9 -4
- package/src/nav_item_badge.wiring.test.js +163 -15
- package/src/node_nav_events.wiring.test.js +93 -1
- package/src/route_map_model.js +59 -10
- package/src/route_map_model.test.js +90 -0
- package/src/schema_editor_diagram_click.wiring.test.js +277 -0
- package/src/schema_editor_openers.wiring.test.js +283 -0
- package/src/shell_dialog_names.wiring.test.js +149 -0
- package/src/shell_escape_taken.wiring.test.js +142 -0
- package/src/shell_focus_trap.js +30 -2
- package/src/shell_focus_trap.test.js +90 -6
- package/src/shell_modals.js +113 -22
- package/src/shell_route_map.js +15 -3
- package/src/shell_section_index.js +3 -1
- package/src/table_editor_name.wiring.test.js +10 -5
- package/src/treedb_column_title.wiring.test.js +8 -4
- package/src/treedb_graph_writes.wiring.test.js +6 -3
- package/src/treedb_json_drill.wiring.test.js +6 -3
- package/src/uplot_add_serie.test.js +6 -3
- package/src/uplot_ink.test.js +8 -4
- package/src/window_dialog.wiring.test.js +486 -0
- package/src/window_dock_band.wiring.test.js +189 -0
- package/src/window_layer.wiring.test.js +114 -0
- package/src/window_rect_rounding.wiring.test.js +121 -0
- package/src/yui_gclass_view.js +16 -1
- package/src/yui_tabulator_i18n.js +31 -1
- package/src/yui_tabulator_i18n.test.js +46 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -131,6 +131,14 @@ function yui_tint(colour) {
|
|
|
131
131
|
* - restores focus to whatever element had it before
|
|
132
132
|
* activation when release() runs.
|
|
133
133
|
*
|
|
134
|
+
* Only a control that is DRAWN counts: focus() on one that is
|
|
135
|
+
* not (display:none) does nothing. The adaptive dialog's back
|
|
136
|
+
* arrow is the first control of every dialog and is hidden on a
|
|
137
|
+
* laptop: up to 7.26.42 the trap gave it the focus on activation
|
|
138
|
+
* (so the focus stayed outside the dialog), and every Tab after
|
|
139
|
+
* that wrapped to it, did nothing and was prevented -- the
|
|
140
|
+
* keyboard never got into the dialog.
|
|
141
|
+
*
|
|
134
142
|
* Pure module — no gobj / Yuneta dependencies. The optional
|
|
135
143
|
* second argument lets callers inject a mock document object
|
|
136
144
|
* for unit tests.
|
|
@@ -140,6 +148,14 @@ function yui_tint(colour) {
|
|
|
140
148
|
***********************************************************************/
|
|
141
149
|
var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
142
150
|
var __trap_stack__ = [];
|
|
151
|
+
function is_drawn(el) {
|
|
152
|
+
if (typeof el.checkVisibility === "function") return el.checkVisibility();
|
|
153
|
+
if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
function focusables_of($panel) {
|
|
157
|
+
return Array.from($panel.querySelectorAll(FOCUSABLE_SELECTOR)).filter(is_drawn);
|
|
158
|
+
}
|
|
143
159
|
/***************************************************************
|
|
144
160
|
* Activate the focus-trap on $panel.
|
|
145
161
|
*
|
|
@@ -157,7 +173,7 @@ function activate_focus_trap_on($panel, doc) {
|
|
|
157
173
|
let trap = function(ev) {
|
|
158
174
|
if (ev.key !== "Tab" && ev.keyCode !== 9) return;
|
|
159
175
|
if (__trap_stack__[__trap_stack__.length - 1] !== trap) return;
|
|
160
|
-
let nodes = $panel
|
|
176
|
+
let nodes = focusables_of($panel);
|
|
161
177
|
if (nodes.length === 0) return;
|
|
162
178
|
let first = nodes[0];
|
|
163
179
|
let last = nodes[nodes.length - 1];
|
|
@@ -174,7 +190,7 @@ function activate_focus_trap_on($panel, doc) {
|
|
|
174
190
|
};
|
|
175
191
|
doc.addEventListener("keydown", trap, true);
|
|
176
192
|
__trap_stack__.push(trap);
|
|
177
|
-
let firstFocusable = $panel
|
|
193
|
+
let firstFocusable = focusables_of($panel)[0];
|
|
178
194
|
if (firstFocusable && typeof firstFocusable.focus === "function") firstFocusable.focus();
|
|
179
195
|
return function release_focus_trap() {
|
|
180
196
|
if (released) return;
|
|
@@ -262,6 +278,51 @@ function bulma_hidden_class(bp) {
|
|
|
262
278
|
return "";
|
|
263
279
|
}
|
|
264
280
|
//#endregion
|
|
281
|
+
//#region src/escape_taken.js
|
|
282
|
+
/***********************************************************************
|
|
283
|
+
* escape_taken.js
|
|
284
|
+
*
|
|
285
|
+
* Whose is an Escape? The overlay around the focus (a window, the
|
|
286
|
+
* shell's dialog on top) closes with it -- unless what the key was
|
|
287
|
+
* typed in took it first:
|
|
288
|
+
*
|
|
289
|
+
* - a handler used it and said so (`preventDefault()`): Tom
|
|
290
|
+
* Select closing its list, the json editor its search box;
|
|
291
|
+
* - an input method is composing (the key cancels the
|
|
292
|
+
* composition);
|
|
293
|
+
* - the element it was typed in is no longer in the document:
|
|
294
|
+
* an inline editor closed with it. Tabulator cancels a cell
|
|
295
|
+
* edit on Escape by removing the box, and says nothing else
|
|
296
|
+
* -- so this is the only trace the key leaves;
|
|
297
|
+
* - it was typed in a search box that holds text: the browser
|
|
298
|
+
* clears the box with it (a default action, not a
|
|
299
|
+
* preventDefault() anyone can see -- and taking the key would
|
|
300
|
+
* prevent it). An empty one gives it on;
|
|
301
|
+
* - it was typed in a text editor (a textarea, a
|
|
302
|
+
* contenteditable): what is being written there is not lost
|
|
303
|
+
* to a key that also means "stop" inside the editor. The
|
|
304
|
+
* overlay is one Tab away.
|
|
305
|
+
*
|
|
306
|
+
* Pure module: an event in, a boolean out.
|
|
307
|
+
*
|
|
308
|
+
* Copyright (c) 2026, ArtGins.
|
|
309
|
+
* All Rights Reserved.
|
|
310
|
+
***********************************************************************/
|
|
311
|
+
/***************************************************************
|
|
312
|
+
* True when the Escape `evt` belongs to what it was typed in,
|
|
313
|
+
* and not to the overlay around it.
|
|
314
|
+
***************************************************************/
|
|
315
|
+
function escape_is_taken(evt) {
|
|
316
|
+
if (!evt) return false;
|
|
317
|
+
if (evt.defaultPrevented || evt.isComposing) return true;
|
|
318
|
+
let target = evt.target;
|
|
319
|
+
if (!target || target.nodeType !== 1) return false;
|
|
320
|
+
if (target.isConnected === false) return true;
|
|
321
|
+
if (target.tagName === "INPUT" && target.type === "search" && target.value) return true;
|
|
322
|
+
if (target.tagName === "TEXTAREA" || target.isContentEditable === true) return true;
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
265
326
|
//#region src/shell_toolbar_helpers.js
|
|
266
327
|
var TOOLBAR_ACTION_TYPES = [
|
|
267
328
|
"navigate",
|
|
@@ -709,12 +770,42 @@ function paint_badge($badge, value, tone) {
|
|
|
709
770
|
* All Rights Reserved.
|
|
710
771
|
***********************************************************************/
|
|
711
772
|
/************************************************************
|
|
773
|
+
* The label of a row is the name of its CONTROL: one rule names
|
|
774
|
+
* an item everywhere.
|
|
775
|
+
*
|
|
776
|
+
* - A menu entry, as the nav names it (c_yui_nav.js item_li):
|
|
777
|
+
* its `name`, else its `aria_label`, else its id.
|
|
778
|
+
* - A toolbar item and a row of its dropdown, as the toolbar
|
|
779
|
+
* names them (c_yui_shell.js build_toolbar_*): its
|
|
780
|
+
* `aria_label` first -- the visible `name` of a toolbar
|
|
781
|
+
* button is often a symbol ("ES/EN") --, then its `name`,
|
|
782
|
+
* then, for an avatar or a connection dot, the library's own
|
|
783
|
+
* key, else its id.
|
|
784
|
+
*
|
|
785
|
+
* A route is no key: it has its own column, and an item with
|
|
786
|
+
* none of these has no label. Up to 7.26.41 a row was labelled
|
|
787
|
+
* `name || wordmark || id || route` -- an entry that declares
|
|
788
|
+
* only an `aria_label` had its id here, the language button read
|
|
789
|
+
* "ES/EN" where its control says "toggle language", and a route
|
|
790
|
+
* was asked of the locales as a key.
|
|
791
|
+
************************************************************/
|
|
792
|
+
function menu_item_label(it) {
|
|
793
|
+
return it.name || it.aria_label || it.id || "";
|
|
794
|
+
}
|
|
795
|
+
function toolbar_item_label(it) {
|
|
796
|
+
let fallback = it.id || "";
|
|
797
|
+
if (it.type === "avatar") fallback = "user menu";
|
|
798
|
+
else if (it.type === "connection") fallback = "backend connection";
|
|
799
|
+
return it.aria_label || it.name || fallback;
|
|
800
|
+
}
|
|
801
|
+
/************************************************************
|
|
712
802
|
* One node of the nav map from a declared config item, in
|
|
713
803
|
* DECLARATION ORDER (never sorted). Recurses into static submenus
|
|
714
804
|
* and toolbar dropdowns, and merges the LIVE dynamic submenu tabs
|
|
715
805
|
* (added at runtime via yui_shell_set_submenu) by parent id.
|
|
806
|
+
* `label_of` names it: menu_item_label() or toolbar_item_label().
|
|
716
807
|
************************************************************/
|
|
717
|
-
function nav_node_from_item(it, index) {
|
|
808
|
+
function nav_node_from_item(it, index, label_of) {
|
|
718
809
|
if (!it || it.type === "divider" || it.type === "header") return null;
|
|
719
810
|
let action = it.action || {};
|
|
720
811
|
let route = it.route || (action.type === "navigate" ? action.route : "") || "";
|
|
@@ -727,7 +818,7 @@ function nav_node_from_item(it, index) {
|
|
|
727
818
|
}
|
|
728
819
|
let node = {
|
|
729
820
|
id: it.id || "",
|
|
730
|
-
label: it
|
|
821
|
+
label: label_of(it),
|
|
731
822
|
icon: it.icon || "",
|
|
732
823
|
route,
|
|
733
824
|
event,
|
|
@@ -737,14 +828,14 @@ function nav_node_from_item(it, index) {
|
|
|
737
828
|
};
|
|
738
829
|
let sub_items = it.submenu && Array.isArray(it.submenu.items) ? it.submenu.items : action.type === "dropdown" && Array.isArray(action.items) ? action.items : null;
|
|
739
830
|
if (sub_items) for (let s of sub_items) {
|
|
740
|
-
let n = nav_node_from_item(s, index);
|
|
831
|
+
let n = nav_node_from_item(s, index, label_of);
|
|
741
832
|
if (n) node.children.push(n);
|
|
742
833
|
}
|
|
743
834
|
if (it.id && index) for (let r of Object.keys(index)) {
|
|
744
835
|
let e = index[r];
|
|
745
836
|
if (e && e.parent_item && e.parent_item.id === it.id && !node.children.some((c) => c.route === r)) node.children.push({
|
|
746
837
|
id: e.item && e.item.id || "",
|
|
747
|
-
label: e.item
|
|
838
|
+
label: e.item ? menu_item_label(e.item) : "",
|
|
748
839
|
icon: e.item && e.item.icon || "",
|
|
749
840
|
route: r,
|
|
750
841
|
event: "",
|
|
@@ -860,7 +951,10 @@ function mark_current(groups, current_route) {
|
|
|
860
951
|
*
|
|
861
952
|
* - `nav` walks EVERY declared menu in declaration order: the
|
|
862
953
|
* `primary` menu contributes its items flat (the common case);
|
|
863
|
-
* any other menu contributes a group node labelled by its key
|
|
954
|
+
* any other menu contributes a group node labelled by its key,
|
|
955
|
+
* as data (`data_label: true`).
|
|
956
|
+
* - a node is labelled as its control is named (menu_item_label(),
|
|
957
|
+
* toolbar_item_label()); a node no item names has label "".
|
|
864
958
|
* - `other` lists the routes declared only in the route table
|
|
865
959
|
* (config.shell.routes) that no rendered node covers — root "/",
|
|
866
960
|
* URL-only action routes, toolbar-less forms. Brand-covered
|
|
@@ -895,7 +989,7 @@ function build_nav_map(input) {
|
|
|
895
989
|
};
|
|
896
990
|
continue;
|
|
897
991
|
}
|
|
898
|
-
let n = nav_node_from_item(it, index);
|
|
992
|
+
let n = nav_node_from_item(it, index, toolbar_item_label);
|
|
899
993
|
if (n) toolbar.push(n);
|
|
900
994
|
}
|
|
901
995
|
let nav = [];
|
|
@@ -905,13 +999,14 @@ function build_nav_map(input) {
|
|
|
905
999
|
if (!m || !Array.isArray(m.items)) continue;
|
|
906
1000
|
let nodes = [];
|
|
907
1001
|
for (let it of m.items) {
|
|
908
|
-
let n = nav_node_from_item(it, index);
|
|
1002
|
+
let n = nav_node_from_item(it, index, menu_item_label);
|
|
909
1003
|
if (n) nodes.push(n);
|
|
910
1004
|
}
|
|
911
1005
|
if (menu_id === "primary") nav = nav.concat(nodes);
|
|
912
1006
|
else if (nodes.length) nav.push({
|
|
913
1007
|
id: menu_id,
|
|
914
1008
|
label: menu_id,
|
|
1009
|
+
data_label: true,
|
|
915
1010
|
icon: "",
|
|
916
1011
|
route: "",
|
|
917
1012
|
event: "",
|
|
@@ -938,7 +1033,7 @@ function build_nav_map(input) {
|
|
|
938
1033
|
let tgt = e && e.target || null;
|
|
939
1034
|
other.push({
|
|
940
1035
|
id: e && e.item && e.item.id || "",
|
|
941
|
-
label: e && e.item
|
|
1036
|
+
label: e && e.item ? menu_item_label(e.item) : "",
|
|
942
1037
|
icon: e && e.item && e.item.icon || "",
|
|
943
1038
|
route: r,
|
|
944
1039
|
event: tgt && tgt.kind === "action" && tgt.event || "",
|
|
@@ -1018,7 +1113,7 @@ function section_index_target(menu_id, item) {
|
|
|
1018
1113
|
gclass: "C_YUI_NAV",
|
|
1019
1114
|
kw: {
|
|
1020
1115
|
menu_id: `index.${menu_id}.${item.id}`,
|
|
1021
|
-
nav_label: item.name || item.id || "",
|
|
1116
|
+
nav_label: item.name || item.aria_label || item.id || "",
|
|
1022
1117
|
menu_items: sub.items,
|
|
1023
1118
|
layout: "cards",
|
|
1024
1119
|
level: "secondary"
|
|
@@ -1090,7 +1185,7 @@ function secondary_nav_renders(item, layout) {
|
|
|
1090
1185
|
* Constants
|
|
1091
1186
|
***************************************************************/
|
|
1092
1187
|
var GCLASS_NAME$22 = "C_YUI_SHELL";
|
|
1093
|
-
var
|
|
1188
|
+
var __live_shells__ = [];
|
|
1094
1189
|
var __shell_watchers__ = [];
|
|
1095
1190
|
var __window_z__ = 10;
|
|
1096
1191
|
var ZONE_IDS = [
|
|
@@ -1133,6 +1228,8 @@ var PRIVATE_DATA$22 = {
|
|
|
1133
1228
|
item_index: {},
|
|
1134
1229
|
nav_badges: {},
|
|
1135
1230
|
badge_status: null,
|
|
1231
|
+
badge_news: [],
|
|
1232
|
+
badge_news_closing: false,
|
|
1136
1233
|
dynamic_items: {},
|
|
1137
1234
|
section_pos: {},
|
|
1138
1235
|
route_mru: [],
|
|
@@ -1171,14 +1268,14 @@ var __gclass__$22 = null;
|
|
|
1171
1268
|
function mt_create$22(gobj) {
|
|
1172
1269
|
const subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
|
|
1173
1270
|
if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
|
|
1174
|
-
|
|
1271
|
+
__live_shells__.push(gobj);
|
|
1175
1272
|
build_ui$19(gobj);
|
|
1176
1273
|
tell_shell_watchers(gobj);
|
|
1177
1274
|
}
|
|
1178
1275
|
/***************************************************************
|
|
1179
1276
|
* Framework Method: Start
|
|
1180
1277
|
***************************************************************/
|
|
1181
|
-
function mt_start$
|
|
1278
|
+
function mt_start$21(gobj) {
|
|
1182
1279
|
let config = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "config") || {};
|
|
1183
1280
|
let priv = gobj.priv;
|
|
1184
1281
|
if (!validate_config(config)) {
|
|
@@ -1282,6 +1379,7 @@ function mt_start$20(gobj) {
|
|
|
1282
1379
|
priv.keydown_handler = (ev) => {
|
|
1283
1380
|
if (ev.key !== "Escape" && ev.keyCode !== 27) return;
|
|
1284
1381
|
if (priv.escape_stack.length === 0) return;
|
|
1382
|
+
if (escape_is_taken(ev)) return;
|
|
1285
1383
|
let top = priv.escape_stack[priv.escape_stack.length - 1];
|
|
1286
1384
|
ev.preventDefault();
|
|
1287
1385
|
ev.stopPropagation();
|
|
@@ -1357,7 +1455,8 @@ function mt_stop$20(gobj) {
|
|
|
1357
1455
|
***************************************************************/
|
|
1358
1456
|
function mt_destroy$22(gobj) {
|
|
1359
1457
|
close_toolbar_dropdown(gobj);
|
|
1360
|
-
|
|
1458
|
+
let live_idx = __live_shells__.indexOf(gobj);
|
|
1459
|
+
if (live_idx >= 0) __live_shells__.splice(live_idx, 1);
|
|
1361
1460
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
1362
1461
|
if ($container && $container.parentNode) $container.parentNode.removeChild($container);
|
|
1363
1462
|
tell_shell_watchers(gobj);
|
|
@@ -1740,7 +1839,7 @@ function instantiate_menus(gobj, config) {
|
|
|
1740
1839
|
let nav = instantiate_nav_in_zone(gobj, {
|
|
1741
1840
|
items: sub.items,
|
|
1742
1841
|
render: { [zone_id]: render_cfg }
|
|
1743
|
-
}, sub_menu_id, zone_id, "secondary", item.name || "");
|
|
1842
|
+
}, sub_menu_id, zone_id, "secondary", item.name || item.aria_label || item.id || "");
|
|
1744
1843
|
let $c = (0, _yuneta_gobj_js.gobj_read_attr)(nav, "$container");
|
|
1745
1844
|
if ($c) $c.classList.add("is-hidden");
|
|
1746
1845
|
}
|
|
@@ -2108,25 +2207,24 @@ function build_toolbar_action_item(gobj, it) {
|
|
|
2108
2207
|
},
|
|
2109
2208
|
text_node(it.name)
|
|
2110
2209
|
]);
|
|
2111
|
-
let
|
|
2112
|
-
let i18n_aria = it.aria_label || it.name;
|
|
2210
|
+
let name_key = it.aria_label || it.name || it.id || "";
|
|
2113
2211
|
let btn_attrs = {
|
|
2114
2212
|
class: "navbar-item yui-toolbar-item is-unselectable",
|
|
2115
2213
|
type: "button",
|
|
2116
2214
|
"data-toolbar-item-id": it.id || "",
|
|
2117
|
-
"aria-label":
|
|
2215
|
+
"aria-label": name_key
|
|
2118
2216
|
};
|
|
2119
|
-
if (
|
|
2217
|
+
if (name_key) btn_attrs["data-i18n-aria-label"] = name_key;
|
|
2120
2218
|
if ((it.action && it.action.type || "") === "dropdown") {
|
|
2121
2219
|
btn_attrs["aria-haspopup"] = "menu";
|
|
2122
2220
|
btn_attrs["aria-expanded"] = "false";
|
|
2123
2221
|
}
|
|
2124
|
-
let tip = it.tooltip ||
|
|
2222
|
+
let tip = it.tooltip || name_key;
|
|
2125
2223
|
if (tip) {
|
|
2126
2224
|
btn_attrs.title = tip;
|
|
2127
2225
|
btn_attrs["data-i18n-title"] = tip;
|
|
2128
2226
|
}
|
|
2129
|
-
if (badge && !(0, _yuneta_gobj_js.empty_string)(
|
|
2227
|
+
if (badge && !(0, _yuneta_gobj_js.empty_string)(name_key)) name_control_with_badge(btn_attrs, badge);
|
|
2130
2228
|
let link = toolbar_link_attrs(it);
|
|
2131
2229
|
if (link) {
|
|
2132
2230
|
delete btn_attrs.type;
|
|
@@ -2210,21 +2308,20 @@ function build_toolbar_brand_item(gobj, it) {
|
|
|
2210
2308
|
************************************************************/
|
|
2211
2309
|
function build_toolbar_avatar_item(gobj, it) {
|
|
2212
2310
|
let priv = gobj.priv;
|
|
2213
|
-
const
|
|
2214
|
-
const i18n_aria = it.aria_label || it.name || "user menu";
|
|
2311
|
+
const name_key = it.aria_label || it.name || "user menu";
|
|
2215
2312
|
let action_type = it.action && it.action.type || "";
|
|
2216
2313
|
let attrs = {
|
|
2217
2314
|
class: "navbar-item yui-toolbar-item yui-toolbar-avatar is-unselectable",
|
|
2218
2315
|
type: "button",
|
|
2219
2316
|
"data-toolbar-item-id": it.id || "",
|
|
2220
|
-
"aria-label":
|
|
2221
|
-
"data-i18n-aria-label":
|
|
2317
|
+
"aria-label": name_key,
|
|
2318
|
+
"data-i18n-aria-label": name_key
|
|
2222
2319
|
};
|
|
2223
2320
|
if (action_type === "dropdown") {
|
|
2224
2321
|
attrs["aria-haspopup"] = "menu";
|
|
2225
2322
|
attrs["aria-expanded"] = "false";
|
|
2226
2323
|
}
|
|
2227
|
-
let tip = it.tooltip ||
|
|
2324
|
+
let tip = it.tooltip || name_key;
|
|
2228
2325
|
if (tip) {
|
|
2229
2326
|
attrs.title = tip;
|
|
2230
2327
|
attrs["data-i18n-title"] = tip;
|
|
@@ -2267,13 +2364,17 @@ function refresh_avatars(gobj) {
|
|
|
2267
2364
|
* Wire an optional secondary (right-click) action on a
|
|
2268
2365
|
* toolbar item. Same action shape as `action`; used e.g. by
|
|
2269
2366
|
* the connection indicator to open a dev panel on right-click.
|
|
2367
|
+
* The item goes along whole, with the secondary action in place
|
|
2368
|
+
* of its own: a menu it opens is named as its trigger is (up to
|
|
2369
|
+
* 7.26.42 it went as `{id, action}`, and the menu was named by
|
|
2370
|
+
* the raw id whatever the item declared).
|
|
2270
2371
|
************************************************************/
|
|
2271
2372
|
function attach_context_action(gobj, $item, it) {
|
|
2272
2373
|
if (!it || !it.context_action) return;
|
|
2273
2374
|
$item.addEventListener("contextmenu", (ev) => {
|
|
2274
2375
|
ev.preventDefault();
|
|
2275
2376
|
handle_toolbar_action(gobj, {
|
|
2276
|
-
|
|
2377
|
+
...it,
|
|
2277
2378
|
action: it.context_action
|
|
2278
2379
|
}, $item);
|
|
2279
2380
|
});
|
|
@@ -2287,16 +2388,15 @@ function attach_context_action(gobj, $item, it) {
|
|
|
2287
2388
|
************************************************************/
|
|
2288
2389
|
function build_toolbar_connection_item(gobj, it) {
|
|
2289
2390
|
let priv = gobj.priv;
|
|
2290
|
-
const
|
|
2291
|
-
const i18n_aria = it.aria_label || it.name || "backend connection";
|
|
2391
|
+
const name_key = it.aria_label || it.name || "backend connection";
|
|
2292
2392
|
let attrs = {
|
|
2293
2393
|
class: "navbar-item yui-toolbar-item yui-toolbar-conn is-unselectable is-disconnected",
|
|
2294
2394
|
type: "button",
|
|
2295
2395
|
"data-toolbar-item-id": it.id || "",
|
|
2296
|
-
"aria-label":
|
|
2297
|
-
"data-i18n-aria-label":
|
|
2396
|
+
"aria-label": name_key,
|
|
2397
|
+
"data-i18n-aria-label": name_key
|
|
2298
2398
|
};
|
|
2299
|
-
let tip = it.tooltip ||
|
|
2399
|
+
let tip = it.tooltip || name_key;
|
|
2300
2400
|
if (tip) {
|
|
2301
2401
|
attrs.title = tip;
|
|
2302
2402
|
attrs["data-i18n-title"] = tip;
|
|
@@ -2394,13 +2494,12 @@ function toggle_toolbar_dropdown(gobj, item, action, $trigger) {
|
|
|
2394
2494
|
function open_toolbar_dropdown(gobj, item, action, $trigger) {
|
|
2395
2495
|
let priv = gobj.priv;
|
|
2396
2496
|
if (!priv || !priv.layers || !priv.layers.popup) return;
|
|
2397
|
-
const
|
|
2398
|
-
const i18n_aria = item && (item.aria_label || item.name) || "menu";
|
|
2497
|
+
const name_key = item && (item.aria_label || item.name || (classify_toolbar_item(item) === "avatar" ? "user menu" : item.id)) || "menu";
|
|
2399
2498
|
let $panel = (0, _yuneta_gobj_js.createElement2)(["div", {
|
|
2400
2499
|
class: "yui-toolbar-dropdown-panel",
|
|
2401
2500
|
role: "menu",
|
|
2402
|
-
"aria-label":
|
|
2403
|
-
"data-i18n-aria-label":
|
|
2501
|
+
"aria-label": name_key,
|
|
2502
|
+
"data-i18n-aria-label": name_key,
|
|
2404
2503
|
"data-toolbar-dropdown-for": item && item.id || ""
|
|
2405
2504
|
}]);
|
|
2406
2505
|
let raw_items = (0, _yuneta_gobj_js.is_array)(action.items) ? action.items : [];
|
|
@@ -2533,20 +2632,19 @@ function build_dropdown_row(gobj, sub, idx) {
|
|
|
2533
2632
|
"aria-hidden": "true"
|
|
2534
2633
|
}]
|
|
2535
2634
|
]);
|
|
2536
|
-
let
|
|
2537
|
-
let i18n_aria = sub.aria_label || sub.name;
|
|
2635
|
+
let name_key = sub.aria_label || sub.name || sub.id || "";
|
|
2538
2636
|
let attrs = {
|
|
2539
2637
|
class: "yui-toolbar-dropdown-item" + (sub.selected ? " is-selected" : ""),
|
|
2540
2638
|
type: "button",
|
|
2541
2639
|
role: "menuitemradio",
|
|
2542
2640
|
"aria-checked": sub.selected ? "true" : "false",
|
|
2543
2641
|
"data-dropdown-item-id": sub.id || "",
|
|
2544
|
-
"aria-label":
|
|
2642
|
+
"aria-label": name_key
|
|
2545
2643
|
};
|
|
2546
|
-
if (
|
|
2547
|
-
attrs["data-i18n-aria-label"] =
|
|
2548
|
-
attrs.title =
|
|
2549
|
-
attrs["data-i18n-title"] =
|
|
2644
|
+
if (name_key) {
|
|
2645
|
+
attrs["data-i18n-aria-label"] = name_key;
|
|
2646
|
+
attrs.title = name_key;
|
|
2647
|
+
attrs["data-i18n-title"] = name_key;
|
|
2550
2648
|
}
|
|
2551
2649
|
let $btn = (0, _yuneta_gobj_js.createElement2)([
|
|
2552
2650
|
"button",
|
|
@@ -2968,11 +3066,23 @@ function shell_navs(gobj) {
|
|
|
2968
3066
|
* `name_key` is the key of the control's name; the phrase is a
|
|
2969
3067
|
* key of its own, so a language orders and punctuates it its
|
|
2970
3068
|
* way. Said once: a live region needs no re-translation.
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
3069
|
+
*
|
|
3070
|
+
* `source` names the badge ("toolbar:<id>", "nav:<id>"). Every
|
|
3071
|
+
* change of ONE turn of the loop is said in ONE message, a line
|
|
3072
|
+
* of the region each, in the order they came; a badge that moves
|
|
3073
|
+
* twice in the turn says its last count. Up to 7.26.41 each
|
|
3074
|
+
* change replaced the region's text, and a reader hears the
|
|
3075
|
+
* region as it is when the turn is over: of two changes in one
|
|
3076
|
+
* action (a feed that updates the toolbar's count and the menu
|
|
3077
|
+
* entry's, which is what a count is for) only the second was
|
|
3078
|
+
* ever said. The turn is closed by EV_CLOSE_BADGE_NEWS, posted to
|
|
3079
|
+
* the shell by its first change: gobj_post_event() delivers it on
|
|
3080
|
+
* the next turn, through the machine -- a deferral, not a time.
|
|
3081
|
+
************************************************************/
|
|
3082
|
+
function announce_badge(gobj, name_key, text, source) {
|
|
3083
|
+
let priv = gobj.priv;
|
|
3084
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
3085
|
+
if (!priv.badge_status) {
|
|
2976
3086
|
(0, _yuneta_gobj_js.log_error)(`C_YUI_SHELL: no live region to say badge '${name_key}': ${text}`);
|
|
2977
3087
|
return;
|
|
2978
3088
|
}
|
|
@@ -2981,10 +3091,60 @@ function announce_badge(gobj, name_key, text) {
|
|
|
2981
3091
|
const tr = priv.translator;
|
|
2982
3092
|
message = tr("{{name}}, {{n}}", {
|
|
2983
3093
|
name: tr(name_key),
|
|
2984
|
-
n: text
|
|
3094
|
+
n: text,
|
|
3095
|
+
interpolation: { escapeValue: false }
|
|
2985
3096
|
});
|
|
2986
3097
|
} else message = `${name_key}, ${text}`;
|
|
2987
|
-
|
|
3098
|
+
let news = priv.badge_news.find((n) => n.source === source);
|
|
3099
|
+
if (news) news.message = message;
|
|
3100
|
+
else priv.badge_news.push({
|
|
3101
|
+
source,
|
|
3102
|
+
message
|
|
3103
|
+
});
|
|
3104
|
+
write_badge_news(gobj);
|
|
3105
|
+
if (priv.badge_news_closing) return;
|
|
3106
|
+
if ((0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_CLOSE_BADGE_NEWS", {}, gobj) < 0) {
|
|
3107
|
+
priv.badge_news = [];
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
priv.badge_news_closing = true;
|
|
3111
|
+
}
|
|
3112
|
+
/************************************************************
|
|
3113
|
+
* A badge whose count went away in the turn it changed: what
|
|
3114
|
+
* this turn said of it is no news any more -- the badge shows
|
|
3115
|
+
* nothing -- and is taken out of the message.
|
|
3116
|
+
************************************************************/
|
|
3117
|
+
function forget_badge_news(gobj, source) {
|
|
3118
|
+
let priv = gobj.priv;
|
|
3119
|
+
let idx = priv.badge_news.findIndex((n) => n.source === source);
|
|
3120
|
+
if (idx < 0) return;
|
|
3121
|
+
priv.badge_news.splice(idx, 1);
|
|
3122
|
+
write_badge_news(gobj);
|
|
3123
|
+
}
|
|
3124
|
+
/************************************************************
|
|
3125
|
+
* The live region holds the message of this turn: a line per
|
|
3126
|
+
* change, so a reader separates them without a punctuation of
|
|
3127
|
+
* ours, and two controls of one name with one count say it once.
|
|
3128
|
+
*
|
|
3129
|
+
* Written whole, and with new nodes, even when it reads the same:
|
|
3130
|
+
* the callers filter what is no news, and a count that went away
|
|
3131
|
+
* and came back IS news -- a new text node is a change a reader
|
|
3132
|
+
* announces.
|
|
3133
|
+
************************************************************/
|
|
3134
|
+
function write_badge_news(gobj) {
|
|
3135
|
+
let priv = gobj.priv;
|
|
3136
|
+
let said = [];
|
|
3137
|
+
let $lines = [];
|
|
3138
|
+
for (let news of priv.badge_news) {
|
|
3139
|
+
if (said.includes(news.message)) continue;
|
|
3140
|
+
said.push(news.message);
|
|
3141
|
+
$lines.push((0, _yuneta_gobj_js.createElement2)([
|
|
3142
|
+
"div",
|
|
3143
|
+
{ class: "SHELL_BADGE_NEWS" },
|
|
3144
|
+
text_node(news.message)
|
|
3145
|
+
]));
|
|
3146
|
+
}
|
|
3147
|
+
priv.badge_status.replaceChildren(...$lines);
|
|
2988
3148
|
}
|
|
2989
3149
|
/************************************************************
|
|
2990
3150
|
* A shell was built (mt_create) or is being destroyed
|
|
@@ -3057,6 +3217,19 @@ function ac_back_wait_timeout(gobj, event, kw, src) {
|
|
|
3057
3217
|
return 0;
|
|
3058
3218
|
}
|
|
3059
3219
|
/************************************************************
|
|
3220
|
+
* The turn in which badges changed is over (posted by the first
|
|
3221
|
+
* change, announce_badge()): the message in the live region is
|
|
3222
|
+
* complete, and a reader hears it as it stands. The next change
|
|
3223
|
+
* starts a message of its own -- added to this one, it would say
|
|
3224
|
+
* again what was already said.
|
|
3225
|
+
************************************************************/
|
|
3226
|
+
function ac_close_badge_news(gobj, event, kw, src) {
|
|
3227
|
+
let priv = gobj.priv;
|
|
3228
|
+
priv.badge_news = [];
|
|
3229
|
+
priv.badge_news_closing = false;
|
|
3230
|
+
return 0;
|
|
3231
|
+
}
|
|
3232
|
+
/************************************************************
|
|
3060
3233
|
* Drawer backdrop click on a C_YUI_NAV child: the nav publishes
|
|
3061
3234
|
* this so the shell can close the drawer through the canonical
|
|
3062
3235
|
* flow (DOM + focus-trap + escape-stack pop) instead of mutating
|
|
@@ -3104,7 +3277,7 @@ function mt_publication_pre_filter(gobj, subs, event, kw) {
|
|
|
3104
3277
|
}
|
|
3105
3278
|
var gmt$22 = {
|
|
3106
3279
|
mt_create: mt_create$22,
|
|
3107
|
-
mt_start: mt_start$
|
|
3280
|
+
mt_start: mt_start$21,
|
|
3108
3281
|
mt_stop: mt_stop$20,
|
|
3109
3282
|
mt_destroy: mt_destroy$22,
|
|
3110
3283
|
mt_publication_pre_filter
|
|
@@ -3134,12 +3307,18 @@ function create_gclass$22(gclass_name) {
|
|
|
3134
3307
|
"EV_BACK_WAIT_TIMEOUT",
|
|
3135
3308
|
ac_back_wait_timeout,
|
|
3136
3309
|
null
|
|
3310
|
+
],
|
|
3311
|
+
[
|
|
3312
|
+
"EV_CLOSE_BADGE_NEWS",
|
|
3313
|
+
ac_close_badge_news,
|
|
3314
|
+
null
|
|
3137
3315
|
]
|
|
3138
3316
|
]]];
|
|
3139
3317
|
const event_types = [
|
|
3140
3318
|
["EV_NAV_CLICKED", 0],
|
|
3141
3319
|
["EV_DRAWER_CLOSE_REQUESTED", 0],
|
|
3142
3320
|
["EV_BACK_WAIT_TIMEOUT", 0],
|
|
3321
|
+
["EV_CLOSE_BADGE_NEWS", 0],
|
|
3143
3322
|
["EV_NAV_ITEM_CLOSE", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
3144
3323
|
["EV_ROUTE_REQUESTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
3145
3324
|
["EV_ROUTE_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
@@ -3265,9 +3444,9 @@ function yui_shell_previous_route(shell_gobj) {
|
|
|
3265
3444
|
/************************************************************
|
|
3266
3445
|
* Resolve the shell that governs `gobj`: the nearest
|
|
3267
3446
|
* C_YUI_SHELL ancestor, else the last shell created on the
|
|
3268
|
-
* page (apps have exactly one). Null when
|
|
3269
|
-
* callers must degrade loudly (shell_modals
|
|
3270
|
-
* and resolves the safe default).
|
|
3447
|
+
* page that is still alive (apps have exactly one). Null when
|
|
3448
|
+
* no shell exists — callers must degrade loudly (shell_modals
|
|
3449
|
+
* logs a warning and resolves the safe default).
|
|
3271
3450
|
************************************************************/
|
|
3272
3451
|
function yui_shell_of(gobj) {
|
|
3273
3452
|
let g = gobj;
|
|
@@ -3275,7 +3454,7 @@ function yui_shell_of(gobj) {
|
|
|
3275
3454
|
if ((0, _yuneta_gobj_js.gobj_gclass_name)(g) === GCLASS_NAME$22) return g;
|
|
3276
3455
|
g = (0, _yuneta_gobj_js.gobj_parent)(g);
|
|
3277
3456
|
}
|
|
3278
|
-
return
|
|
3457
|
+
return __live_shells__.length > 0 ? __live_shells__[__live_shells__.length - 1] : null;
|
|
3279
3458
|
}
|
|
3280
3459
|
/************************************************************
|
|
3281
3460
|
* The DOM where a C_YUI_WINDOW lives when its host names no
|
|
@@ -3291,6 +3470,16 @@ function yui_shell_window_layer(shell_gobj) {
|
|
|
3291
3470
|
return priv.window_layer || priv.layers && priv.layers.overlay || null;
|
|
3292
3471
|
}
|
|
3293
3472
|
/************************************************************
|
|
3473
|
+
* The DOM where a MODAL C_YUI_WINDOW lives when its host names
|
|
3474
|
+
* no `$parent`: the shell's dialog layer, with the dialogs of
|
|
3475
|
+
* shell_modals.js -- above the drawer, the dock and every other
|
|
3476
|
+
* window, below the toasts. Null with no shell.
|
|
3477
|
+
************************************************************/
|
|
3478
|
+
function yui_shell_modal_layer(shell_gobj) {
|
|
3479
|
+
if (!shell_gobj || !shell_gobj.priv || !shell_gobj.priv.layers) return null;
|
|
3480
|
+
return shell_gobj.priv.layers.modal || null;
|
|
3481
|
+
}
|
|
3482
|
+
/************************************************************
|
|
3294
3483
|
* Put a window on top of the others: the next number of ONE
|
|
3295
3484
|
* counter, the same for a window of the dock and for a floating
|
|
3296
3485
|
* one.
|
|
@@ -3613,8 +3802,8 @@ function yui_shell_set_toolbar_item_badge(shell_gobj, item_id, value, tone) {
|
|
|
3613
3802
|
let now = badge_text(value);
|
|
3614
3803
|
if (now && now !== before) {
|
|
3615
3804
|
let $item = $badge.closest("[data-toolbar-item-id]");
|
|
3616
|
-
announce_badge(shell_gobj, $item && $item.getAttribute("data-i18n-aria-label") || item_id, now);
|
|
3617
|
-
}
|
|
3805
|
+
announce_badge(shell_gobj, $item && $item.getAttribute("data-i18n-aria-label") || item_id, now, `toolbar:${item_id}`);
|
|
3806
|
+
} else if (!now) forget_badge_news(shell_gobj, `toolbar:${item_id}`);
|
|
3618
3807
|
}
|
|
3619
3808
|
/************************************************************
|
|
3620
3809
|
* Set (or clear) the badge of a MENU item — the twin of
|
|
@@ -3663,7 +3852,8 @@ function yui_shell_set_nav_item_badge(shell_gobj, item_id, value, tone) {
|
|
|
3663
3852
|
badge_tone: tone
|
|
3664
3853
|
}, shell_gobj);
|
|
3665
3854
|
let now = badge_text(badge);
|
|
3666
|
-
if (now && now !== before) announce_badge(shell_gobj, item.name || item_id, now);
|
|
3855
|
+
if (now && now !== before) announce_badge(shell_gobj, item.name || item.aria_label || item_id, now, `nav:${item_id}`);
|
|
3856
|
+
else if (!now) forget_badge_news(shell_gobj, `nav:${item_id}`);
|
|
3667
3857
|
}
|
|
3668
3858
|
/************************************************************
|
|
3669
3859
|
* Programmatic close of any open toolbar dropdown. Useful for
|
|
@@ -3714,6 +3904,14 @@ function modal_layer(shell) {
|
|
|
3714
3904
|
let priv = shell.priv;
|
|
3715
3905
|
return priv && priv.layers && priv.layers.modal;
|
|
3716
3906
|
}
|
|
3907
|
+
var __opened_by_shell__ = /* @__PURE__ */ new WeakMap();
|
|
3908
|
+
function note_opened(shell) {
|
|
3909
|
+
__opened_by_shell__.set(shell, opened_count(shell) + 1);
|
|
3910
|
+
}
|
|
3911
|
+
function opened_count(shell) {
|
|
3912
|
+
return __opened_by_shell__.get(shell) || 0;
|
|
3913
|
+
}
|
|
3914
|
+
var __dialog_seq__ = 0;
|
|
3717
3915
|
function yui_shell_popup_layer(shell) {
|
|
3718
3916
|
if (!shell) return null;
|
|
3719
3917
|
let priv = shell.priv;
|
|
@@ -3848,18 +4046,43 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3848
4046
|
(0, _yuneta_gobj_js.log_warning)("yui_shell_show_modal: shell has no modal layer");
|
|
3849
4047
|
return { close: () => {} };
|
|
3850
4048
|
}
|
|
4049
|
+
let label_id = `yui-modal-${++__dialog_seq__}`;
|
|
3851
4050
|
let inner = typeof content === "string" ? [
|
|
3852
4051
|
"div",
|
|
3853
4052
|
{ class: "box" },
|
|
3854
4053
|
[[
|
|
3855
4054
|
"p",
|
|
3856
|
-
{
|
|
4055
|
+
{
|
|
4056
|
+
class: "MODAL_MESSAGE",
|
|
4057
|
+
id: `${label_id}-msg`,
|
|
4058
|
+
i18n: content
|
|
4059
|
+
},
|
|
3857
4060
|
content
|
|
3858
4061
|
]]
|
|
3859
4062
|
] : null;
|
|
3860
4063
|
let dialog = !!(opts && opts.dialog);
|
|
3861
4064
|
let title = opts && opts.title || "";
|
|
3862
4065
|
let title_prefix = opts && opts.title_prefix || "";
|
|
4066
|
+
let title_halves = (title_prefix ? [[
|
|
4067
|
+
"span",
|
|
4068
|
+
{
|
|
4069
|
+
class: "MODAL_TITLE_PREFIX",
|
|
4070
|
+
id: `${label_id}-prefix`
|
|
4071
|
+
},
|
|
4072
|
+
text_node(title_prefix)
|
|
4073
|
+
]] : []).concat(title ? [[
|
|
4074
|
+
"span",
|
|
4075
|
+
{
|
|
4076
|
+
class: "MODAL_TITLE_KIND",
|
|
4077
|
+
id: `${label_id}-kind`,
|
|
4078
|
+
i18n: title
|
|
4079
|
+
},
|
|
4080
|
+
text_node(title)
|
|
4081
|
+
]] : []);
|
|
4082
|
+
let label_ids = [];
|
|
4083
|
+
if (title_prefix) label_ids.push(`${label_id}-prefix`);
|
|
4084
|
+
if (title) label_ids.push(`${label_id}-kind`);
|
|
4085
|
+
if (label_ids.length === 0 && inner) label_ids.push(`${label_id}-msg`);
|
|
3863
4086
|
let with_close = !(opts && opts.with_close_button === false);
|
|
3864
4087
|
let modal_children;
|
|
3865
4088
|
if (dialog) {
|
|
@@ -3885,18 +4108,7 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3885
4108
|
[
|
|
3886
4109
|
"span",
|
|
3887
4110
|
{ class: "MODAL_TITLE yui-dialog-title" },
|
|
3888
|
-
|
|
3889
|
-
"span",
|
|
3890
|
-
{ class: "MODAL_TITLE_PREFIX" },
|
|
3891
|
-
text_node(title_prefix)
|
|
3892
|
-
]] : []).concat(title ? [[
|
|
3893
|
-
"span",
|
|
3894
|
-
{
|
|
3895
|
-
class: "MODAL_TITLE_KIND",
|
|
3896
|
-
i18n: title
|
|
3897
|
-
},
|
|
3898
|
-
text_node(title)
|
|
3899
|
-
]] : [])
|
|
4111
|
+
title_halves
|
|
3900
4112
|
],
|
|
3901
4113
|
[
|
|
3902
4114
|
"button",
|
|
@@ -3924,6 +4136,11 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3924
4136
|
{ class: "MODAL_CONTENT modal-content" },
|
|
3925
4137
|
inner ? [inner] : []
|
|
3926
4138
|
]];
|
|
4139
|
+
if (title_halves.length > 0) modal_children.unshift([
|
|
4140
|
+
"span",
|
|
4141
|
+
{ class: "MODAL_TITLE is-sr-only" },
|
|
4142
|
+
title_halves
|
|
4143
|
+
]);
|
|
3927
4144
|
if (with_close) modal_children.push(["button", {
|
|
3928
4145
|
class: "MODAL_CLOSE modal-close is-large",
|
|
3929
4146
|
title: (0, i18next.t)("close"),
|
|
@@ -3934,16 +4151,20 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3934
4151
|
}
|
|
3935
4152
|
let logical = opts && opts.logical_class || "";
|
|
3936
4153
|
let wide = !!(opts && opts.wide);
|
|
4154
|
+
let modal_attrs = {
|
|
4155
|
+
class: "MODAL" + (logical ? " " + logical : "") + " modal yui-modal" + (dialog ? " yui-dialog" : "") + (dialog && wide ? " yui-dialog-wide" : "") + " is-active",
|
|
4156
|
+
role: "dialog",
|
|
4157
|
+
"aria-modal": "true"
|
|
4158
|
+
};
|
|
4159
|
+
if (label_ids.length > 0) modal_attrs["aria-labelledby"] = label_ids.join(" ");
|
|
4160
|
+
else (0, _yuneta_gobj_js.log_warning)(`yui_shell_show_modal: a dialog with no title and no message has no name for a reader` + (logical ? ` (${logical})` : "") + `: give it opts.title`);
|
|
3937
4161
|
let $modal = (0, _yuneta_gobj_js.createElement2)([
|
|
3938
4162
|
"div",
|
|
3939
|
-
|
|
3940
|
-
class: "MODAL" + (logical ? " " + logical : "") + " modal yui-modal" + (dialog ? " yui-dialog" : "") + (dialog && wide ? " yui-dialog-wide" : "") + " is-active",
|
|
3941
|
-
role: "dialog",
|
|
3942
|
-
"aria-modal": "true"
|
|
3943
|
-
},
|
|
4163
|
+
modal_attrs,
|
|
3944
4164
|
modal_children
|
|
3945
4165
|
]);
|
|
3946
4166
|
$layer.appendChild($modal);
|
|
4167
|
+
note_opened(shell);
|
|
3947
4168
|
if (!inner && content && typeof content.appendChild !== "undefined") (dialog ? $modal.querySelector(".yui-dialog-body") : $modal.querySelector(".modal-content")).appendChild(content);
|
|
3948
4169
|
maybe_apply_translator($modal, opts);
|
|
3949
4170
|
let closed = false;
|
|
@@ -3972,6 +4193,7 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3972
4193
|
let guarded_close = function(on_veto) {
|
|
3973
4194
|
if (closed) return;
|
|
3974
4195
|
let allow = true;
|
|
4196
|
+
let opened_before = opened_count(shell);
|
|
3975
4197
|
if (opts && typeof opts.before_close === "function") try {
|
|
3976
4198
|
allow = opts.before_close();
|
|
3977
4199
|
} catch (e) {
|
|
@@ -3979,7 +4201,20 @@ function yui_shell_show_modal(shell, content, opts) {
|
|
|
3979
4201
|
allow = true;
|
|
3980
4202
|
}
|
|
3981
4203
|
if (allow && typeof allow.then === "function") {
|
|
3982
|
-
|
|
4204
|
+
let vetoed = function() {
|
|
4205
|
+
if (typeof on_veto === "function") on_veto();
|
|
4206
|
+
};
|
|
4207
|
+
allow.then(function(answer) {
|
|
4208
|
+
if (answer === true) {
|
|
4209
|
+
do_close();
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
if (answer === void 0 && !closed && opened_count(shell) === opened_before) (0, _yuneta_gobj_js.log_warning)("yui_shell_show_modal: before_close settled with undefined and asked nothing: the modal stays open (only true closes it)");
|
|
4213
|
+
vetoed();
|
|
4214
|
+
}, function(e) {
|
|
4215
|
+
(0, _yuneta_gobj_js.log_warning)(`yui_shell_show_modal: before_close rejected: ${e}`);
|
|
4216
|
+
vetoed();
|
|
4217
|
+
});
|
|
3983
4218
|
return;
|
|
3984
4219
|
}
|
|
3985
4220
|
if (allow === false) {
|
|
@@ -4082,10 +4317,12 @@ function build_dialog(shell, message, buttons, opts) {
|
|
|
4082
4317
|
"aria-hidden": "true"
|
|
4083
4318
|
}]]
|
|
4084
4319
|
]];
|
|
4320
|
+
let label_id = `yui-confirm-${++__dialog_seq__}`;
|
|
4085
4321
|
if (!(0, _yuneta_gobj_js.empty_string)(title)) $card_children.push([
|
|
4086
4322
|
"p",
|
|
4087
4323
|
{
|
|
4088
4324
|
class: "CONFIRM_TITLE yui-confirm-title has-text-centered",
|
|
4325
|
+
id: `${label_id}-title`,
|
|
4089
4326
|
i18n: title
|
|
4090
4327
|
},
|
|
4091
4328
|
text_node(title)
|
|
@@ -4098,21 +4335,28 @@ function build_dialog(shell, message, buttons, opts) {
|
|
|
4098
4335
|
"data-i18n-aria-label": "close"
|
|
4099
4336
|
}], [
|
|
4100
4337
|
"section",
|
|
4101
|
-
{
|
|
4338
|
+
{
|
|
4339
|
+
class: "CONFIRM_BODY modal-card-body has-text-centered",
|
|
4340
|
+
id: `${label_id}-body`
|
|
4341
|
+
},
|
|
4102
4342
|
$body_children
|
|
4103
4343
|
], [
|
|
4104
4344
|
"footer",
|
|
4105
4345
|
{ class: "CONFIRM_FOOT modal-card-foot" },
|
|
4106
4346
|
$footer_children
|
|
4107
4347
|
]);
|
|
4108
|
-
let
|
|
4348
|
+
let confirm_attrs = {
|
|
4349
|
+
class: `CONFIRM${opts && opts.logical_class ? " " + opts.logical_class : ""} modal yui-modal yui-confirm is-active is-${type}`,
|
|
4350
|
+
role: "dialog",
|
|
4351
|
+
"aria-modal": "true"
|
|
4352
|
+
};
|
|
4353
|
+
if (!(0, _yuneta_gobj_js.empty_string)(title)) {
|
|
4354
|
+
confirm_attrs["aria-labelledby"] = `${label_id}-title`;
|
|
4355
|
+
confirm_attrs["aria-describedby"] = `${label_id}-body`;
|
|
4356
|
+
} else confirm_attrs["aria-labelledby"] = `${label_id}-body`;
|
|
4109
4357
|
let $modal = (0, _yuneta_gobj_js.createElement2)([
|
|
4110
4358
|
"div",
|
|
4111
|
-
|
|
4112
|
-
class: `CONFIRM${logical} modal yui-modal yui-confirm is-active is-${type}`,
|
|
4113
|
-
role: "dialog",
|
|
4114
|
-
"aria-modal": "true"
|
|
4115
|
-
},
|
|
4359
|
+
confirm_attrs,
|
|
4116
4360
|
[["div", { class: "CONFIRM_BACKDROP modal-background" }], [
|
|
4117
4361
|
"div",
|
|
4118
4362
|
{ class: "CONFIRM_CARD modal-card" },
|
|
@@ -4120,6 +4364,7 @@ function build_dialog(shell, message, buttons, opts) {
|
|
|
4120
4364
|
]]
|
|
4121
4365
|
]);
|
|
4122
4366
|
$layer.appendChild($modal);
|
|
4367
|
+
note_opened(shell);
|
|
4123
4368
|
maybe_apply_translator($modal, opts);
|
|
4124
4369
|
return new Promise((resolve) => {
|
|
4125
4370
|
let resolved = false;
|
|
@@ -4254,6 +4499,30 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
|
|
|
4254
4499
|
*
|
|
4255
4500
|
* Window - position fixed
|
|
4256
4501
|
*
|
|
4502
|
+
* A window is a DIALOG for the keyboard and for a reader:
|
|
4503
|
+
*
|
|
4504
|
+
* - it says so (`role="dialog"`) and is named by its title
|
|
4505
|
+
* (`aria-labelledby` on its two halves, the kind half carrying
|
|
4506
|
+
* its key, so the name changes language with it);
|
|
4507
|
+
* - when it starts in answer to the reader (a press, a key) it
|
|
4508
|
+
* takes the focus (`focus`: an element, a selector, a number;
|
|
4509
|
+
* by default the window itself, which is focusable with
|
|
4510
|
+
* tabindex=-1) -- not one the app restores on its own at start
|
|
4511
|
+
* up -- and when it goes it gives the focus back to where it
|
|
4512
|
+
* came from, if the focus was in it;
|
|
4513
|
+
* - Escape closes it (`keyboard`) the way its ✕ does, through
|
|
4514
|
+
* EV_CLOSE_WINDOW, so EV_WINDOW_TO_CLOSE can still veto or
|
|
4515
|
+
* ask; not an Escape that what it was typed in took first
|
|
4516
|
+
* (escape_is_taken());
|
|
4517
|
+
* - a `modal` one blocks the rest of the app: it hangs over a
|
|
4518
|
+
* backdrop in the shell's dialog layer (above the dock, the
|
|
4519
|
+
* drawer, every other window), a press outside it does
|
|
4520
|
+
* nothing, Tab stays inside (activate_focus_trap_on(), the
|
|
4521
|
+
* trap of the shell's dialogs), and it never goes to the dock.
|
|
4522
|
+
*
|
|
4523
|
+
* Up to 7.26.42 `focus`, `modal` and `keyboard` were declared and
|
|
4524
|
+
* did nothing.
|
|
4525
|
+
*
|
|
4257
4526
|
* Copyright (c) 2025-2026, ArtGins.
|
|
4258
4527
|
* All Rights Reserved.
|
|
4259
4528
|
***********************************************************************/
|
|
@@ -4266,6 +4535,10 @@ var WC_MAX = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"3.3\" y=
|
|
|
4266
4535
|
var WC_RESTORE = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"5.2\" y=\"3\" width=\"7.8\" height=\"7.8\" rx=\"1.3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.4\"/><rect x=\"3\" y=\"5.2\" width=\"7.8\" height=\"7.8\" rx=\"1.3\" fill=\"var(--bulma-scheme-main)\" stroke=\"currentColor\" stroke-width=\"1.4\"/></svg>";
|
|
4267
4536
|
var WC_CLOSE = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4 4 L12 12 M12 4 L4 12\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/></svg>";
|
|
4268
4537
|
var MOBILE_MAX = 768;
|
|
4538
|
+
var DOCK_INSET_TOP = "var(--yui-dock-inset-top, 0px)";
|
|
4539
|
+
var DOCK_INSET_BOTTOM = "var(--yui-dock-inset-bottom, 0px)";
|
|
4540
|
+
var MODAL_WINDOW_Z = 40;
|
|
4541
|
+
var __title_seq__ = 0;
|
|
4269
4542
|
/***************************************************************
|
|
4270
4543
|
* Data
|
|
4271
4544
|
***************************************************************/
|
|
@@ -4296,9 +4569,9 @@ var attrs_table$21 = [
|
|
|
4296
4569
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title_prefix", 0, "", "Optional DATA half of the title (a topic/service/marker name), shown before `title` and never translated. Use it instead of composing `${name} · ${t(key)}` into `title`, which cannot re-translate"),
|
|
4297
4570
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title", 0, "", "Window title, an i18n KEY: painted in the title bar (unless `header` overrides it) and on the dock chip. Pass the key, not t(key), or it cannot re-translate"),
|
|
4298
4571
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "icon", 0, "", "Window icon (by window type), leading the title bar and the dock chip: a yi-* class name or inline SVG"),
|
|
4299
|
-
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "
|
|
4300
|
-
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "
|
|
4301
|
-
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "
|
|
4572
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "What takes the focus when the window starts in answer to the reader (a press, a key; a window the app restores on its own leaves the focus in the page, a modal one takes it always): an element of the window, a CSS selector looked up in it, or a number (the n-th control of the body, from 0). Null: the window itself. The focus goes back where it came from when the window goes, if it was in the window"),
|
|
4573
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "Block the rest of the app while the window is open: a backdrop in the shell's dialog layer (above the dock, the drawer, every other window), a press outside does nothing, Tab stays inside, aria-modal. A modal window never goes to the dock: `manager` is ignored"),
|
|
4574
|
+
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Escape closes the window the way its ✕ does (EV_WINDOW_TO_CLOSE can veto or ask), when the focus is in it -- not an Escape that what it was typed in took first: a handler that used it, a cell editor that closed with it, a textarea or a contenteditable"),
|
|
4302
4575
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
|
|
4303
4576
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
|
|
4304
4577
|
(0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
|
|
@@ -4310,7 +4583,10 @@ var attrs_table$21 = [
|
|
|
4310
4583
|
var PRIVATE_DATA$21 = {
|
|
4311
4584
|
prevSize: 0,
|
|
4312
4585
|
placed_by_shell: false,
|
|
4313
|
-
back_shell: null
|
|
4586
|
+
back_shell: null,
|
|
4587
|
+
opener: null,
|
|
4588
|
+
$lock: null,
|
|
4589
|
+
release_focus: null
|
|
4314
4590
|
};
|
|
4315
4591
|
var __gclass__$21 = null;
|
|
4316
4592
|
/******************************
|
|
@@ -4324,6 +4600,10 @@ function mt_create$21(gobj) {
|
|
|
4324
4600
|
if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
|
|
4325
4601
|
let window_id = "window-" + (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_short_name)(gobj));
|
|
4326
4602
|
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "window_id", window_id);
|
|
4603
|
+
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal") && (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager")) {
|
|
4604
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a modal window does not go to the dock: its manager is ignored`);
|
|
4605
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "manager", null);
|
|
4606
|
+
}
|
|
4327
4607
|
let manager = resolve_manager(gobj);
|
|
4328
4608
|
build_ui$18(gobj);
|
|
4329
4609
|
yui_shell_watch_changes(gobj);
|
|
@@ -4359,13 +4639,41 @@ function mt_create$21(gobj) {
|
|
|
4359
4639
|
window.addEventListener("resize", on_win_resize);
|
|
4360
4640
|
}
|
|
4361
4641
|
/***************************************************************
|
|
4642
|
+
* Framework Method: Start
|
|
4643
|
+
*
|
|
4644
|
+
* The window takes the focus when it STARTS, not when it is
|
|
4645
|
+
* created: a host fills the body between the two (the json pad,
|
|
4646
|
+
* the frontend view), and `focus` may name what it put there.
|
|
4647
|
+
*
|
|
4648
|
+
* Only a window the READER opened takes it (opened_by_the_reader()).
|
|
4649
|
+
* One the app opens on its own -- the Developer window restored at
|
|
4650
|
+
* start up from the last session -- leaves the focus in the page:
|
|
4651
|
+
* the first Tab of a keyboard reader landed in a window they had
|
|
4652
|
+
* not opened. A modal window takes it all the same: nothing else
|
|
4653
|
+
* can be used while it is up.
|
|
4654
|
+
***************************************************************/
|
|
4655
|
+
function mt_start$20(gobj) {
|
|
4656
|
+
let priv = gobj.priv;
|
|
4657
|
+
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4658
|
+
if (!$container) {
|
|
4659
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: started without a container`);
|
|
4660
|
+
return;
|
|
4661
|
+
}
|
|
4662
|
+
let active = document.activeElement;
|
|
4663
|
+
if (active && active !== document.body && !$container.contains(active)) priv.opener = active;
|
|
4664
|
+
let modal = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal");
|
|
4665
|
+
if (modal && !priv.release_focus) priv.release_focus = activate_focus_trap_on($container);
|
|
4666
|
+
if (modal || opened_by_the_reader()) focus_target(gobj, $container).focus();
|
|
4667
|
+
}
|
|
4668
|
+
/***************************************************************
|
|
4362
4669
|
* Framework Method: Destroy
|
|
4363
4670
|
***************************************************************/
|
|
4364
4671
|
function mt_destroy$21(gobj) {
|
|
4365
4672
|
let priv = gobj.priv;
|
|
4673
|
+
give_focus_back(gobj);
|
|
4366
4674
|
yui_shell_unwatch_changes(gobj);
|
|
4367
4675
|
let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
|
|
4368
|
-
if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
4676
|
+
if (manager && !(0, _yuneta_gobj_js.gobj_is_destroying)(manager)) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
4369
4677
|
let back_overlay = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay");
|
|
4370
4678
|
if (back_overlay) {
|
|
4371
4679
|
if (priv.back_shell) yui_shell_overlay_dismissed(priv.back_shell, back_overlay);
|
|
@@ -4400,9 +4708,12 @@ function ensure_window_style() {
|
|
|
4400
4708
|
.yui-window-title .icon { flex: 0 0 auto; }
|
|
4401
4709
|
.yui-window-title svg { width: 14px; height: 14px; display: block; }
|
|
4402
4710
|
/* Separator between the data half and the translated kind half. CSS,
|
|
4403
|
-
* not a text node: createElement2 trims text nodes and eats the spaces.
|
|
4711
|
+
* not a text node: createElement2 trims text nodes and eats the spaces.
|
|
4712
|
+
* Decorative ("/ ''"): the halves NAME the window, and a reader read
|
|
4713
|
+
* the dot into the kind half ("#1 ·demo window"). */
|
|
4404
4714
|
.WINDOW_TITLE_PREFIX + .WINDOW_TITLE_KIND::before {
|
|
4405
4715
|
content: "·";
|
|
4716
|
+
content: "·" / "";
|
|
4406
4717
|
padding: 0 0.4em;
|
|
4407
4718
|
color: var(--bulma-text-weak);
|
|
4408
4719
|
}
|
|
@@ -4416,6 +4727,13 @@ function ensure_window_style() {
|
|
|
4416
4727
|
.yui-wc svg { width: 15px; height: 15px; display: block; }
|
|
4417
4728
|
.yui-window-resize { color: var(--bulma-text-weak); opacity: 0.55; }
|
|
4418
4729
|
.yui-window-resize:hover { opacity: 1; color: var(--bulma-text); }
|
|
4730
|
+
/* A modal window over its backdrop: the backdrop of a Bulma .modal,
|
|
4731
|
+
* which the shell's dialogs wear (its variable lives on .modal). */
|
|
4732
|
+
.yui-window-lock { position: fixed; inset: 0; }
|
|
4733
|
+
.yui-window-backdrop {
|
|
4734
|
+
position: absolute; inset: 0;
|
|
4735
|
+
background-color: hsla(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-invert-l), 0.86);
|
|
4736
|
+
}
|
|
4419
4737
|
@media (max-width: ${MOBILE_MAX}px) {
|
|
4420
4738
|
.C_YUI_WINDOW.is-mobile-sheet { border-radius: 0 !important; box-shadow: none !important; }
|
|
4421
4739
|
.C_YUI_WINDOW.is-mobile-sheet .yui-window-resize { display: none !important; }
|
|
@@ -4451,12 +4769,19 @@ function ensure_window_style() {
|
|
|
4451
4769
|
* refresh_language() re-translates just that one. The separator is
|
|
4452
4770
|
* CSS (::before), never a text node: createElement2 TRIMS text nodes
|
|
4453
4771
|
* and would eat the spaces around it.
|
|
4772
|
+
*
|
|
4773
|
+
* The same halves NAME the window: aria-labelledby lists them
|
|
4774
|
+
* (`<id>-prefix`, `<id>-kind`), so a reader joins them with a space
|
|
4775
|
+
* and leaves out the CSS separator, and the kind half changes
|
|
4776
|
+
* language. Under a `header` of the caller's the node is still
|
|
4777
|
+
* built, `hidden` (is-sr-only, no icon): a header is a toolbar more
|
|
4778
|
+
* often than a title, and the name of a dialog is its title.
|
|
4454
4779
|
************************************************************/
|
|
4455
|
-
function
|
|
4780
|
+
function build_title_node(gobj, id, hidden) {
|
|
4456
4781
|
let title = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title");
|
|
4457
4782
|
let prefix = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title_prefix");
|
|
4458
4783
|
if ((0, _yuneta_gobj_js.empty_string)(title) && (0, _yuneta_gobj_js.empty_string)(prefix)) return null;
|
|
4459
|
-
let icon = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "icon");
|
|
4784
|
+
let icon = hidden ? "" : (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "icon");
|
|
4460
4785
|
let items = [];
|
|
4461
4786
|
if (!(0, _yuneta_gobj_js.empty_string)(icon)) {
|
|
4462
4787
|
if (icon.charAt(0) === "<") items.push([
|
|
@@ -4472,20 +4797,27 @@ function build_default_header(gobj) {
|
|
|
4472
4797
|
}
|
|
4473
4798
|
if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
|
|
4474
4799
|
"span",
|
|
4475
|
-
{
|
|
4800
|
+
{
|
|
4801
|
+
class: "WINDOW_TITLE_PREFIX has-text-weight-semibold",
|
|
4802
|
+
id: `${id}-prefix`
|
|
4803
|
+
},
|
|
4476
4804
|
text_node(prefix)
|
|
4477
4805
|
]);
|
|
4478
4806
|
if (!(0, _yuneta_gobj_js.empty_string)(title)) items.push([
|
|
4479
4807
|
"span",
|
|
4480
4808
|
{
|
|
4481
4809
|
class: "WINDOW_TITLE_KIND has-text-weight-semibold",
|
|
4810
|
+
id: `${id}-kind`,
|
|
4482
4811
|
i18n: title
|
|
4483
4812
|
},
|
|
4484
4813
|
text_node(title)
|
|
4485
4814
|
]);
|
|
4486
4815
|
return (0, _yuneta_gobj_js.createElement2)([
|
|
4487
4816
|
"span",
|
|
4488
|
-
{
|
|
4817
|
+
{
|
|
4818
|
+
id,
|
|
4819
|
+
class: hidden ? "WINDOW_TITLE is-sr-only" : "WINDOW_TITLE yui-window-title icon-text ml-1"
|
|
4820
|
+
},
|
|
4489
4821
|
items
|
|
4490
4822
|
]);
|
|
4491
4823
|
}
|
|
@@ -4502,6 +4834,106 @@ function composed_title(gobj) {
|
|
|
4502
4834
|
return (0, _yuneta_gobj_js.empty_string)(prefix) ? kind : prefix;
|
|
4503
4835
|
}
|
|
4504
4836
|
/************************************************************
|
|
4837
|
+
* Is the window opening in answer to the reader -- a press, a
|
|
4838
|
+
* key (the browser's user activation)? Not one the app restores
|
|
4839
|
+
* at start up. A browser that cannot say is taken at its word
|
|
4840
|
+
* that the reader asked.
|
|
4841
|
+
************************************************************/
|
|
4842
|
+
function opened_by_the_reader() {
|
|
4843
|
+
let ua = typeof navigator !== "undefined" ? navigator.userActivation : null;
|
|
4844
|
+
if (!ua) return true;
|
|
4845
|
+
return !!ua.isActive;
|
|
4846
|
+
}
|
|
4847
|
+
/************************************************************
|
|
4848
|
+
* What takes the focus when the window starts (`focus`): an
|
|
4849
|
+
* element of the window, a selector looked up in it, or the
|
|
4850
|
+
* n-th control of the body. Null, or one that names nothing
|
|
4851
|
+
* (said): the window itself.
|
|
4852
|
+
************************************************************/
|
|
4853
|
+
function focus_target(gobj, $container) {
|
|
4854
|
+
let focus = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "focus");
|
|
4855
|
+
if (focus === null || focus === void 0) return $container;
|
|
4856
|
+
let $target = null;
|
|
4857
|
+
if (typeof focus === "number") {
|
|
4858
|
+
let $body = $container.querySelector(".WINDOW_BODY");
|
|
4859
|
+
$target = ($body ? $body.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])") : [])[focus] || null;
|
|
4860
|
+
} else if (typeof focus === "string") $target = $container.querySelector(focus);
|
|
4861
|
+
else if (focus && typeof focus.focus === "function" && $container.contains(focus)) $target = focus;
|
|
4862
|
+
if (!$target) {
|
|
4863
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: focus '${String(focus)}' names nothing in the window: the window takes it`);
|
|
4864
|
+
return $container;
|
|
4865
|
+
}
|
|
4866
|
+
return $target;
|
|
4867
|
+
}
|
|
4868
|
+
/************************************************************
|
|
4869
|
+
* The window goes: the focus goes back where it came from --
|
|
4870
|
+
* if it was in the window, or lost with what the window held
|
|
4871
|
+
* (a child torn down first takes its focused element with
|
|
4872
|
+
* it). A focus the reader has put elsewhere stays there. A
|
|
4873
|
+
* modal window's trap gives it back itself.
|
|
4874
|
+
************************************************************/
|
|
4875
|
+
function give_focus_back(gobj) {
|
|
4876
|
+
let priv = gobj.priv;
|
|
4877
|
+
let opener = priv.opener;
|
|
4878
|
+
priv.opener = null;
|
|
4879
|
+
if (priv.release_focus) {
|
|
4880
|
+
let release = priv.release_focus;
|
|
4881
|
+
priv.release_focus = null;
|
|
4882
|
+
release();
|
|
4883
|
+
return;
|
|
4884
|
+
}
|
|
4885
|
+
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4886
|
+
let active = document.activeElement;
|
|
4887
|
+
if (!(!active || active === document.body) && !($container && $container.contains(active))) return;
|
|
4888
|
+
if (opener && opener.isConnected !== false && typeof opener.focus === "function") opener.focus();
|
|
4889
|
+
}
|
|
4890
|
+
/************************************************************
|
|
4891
|
+
* A window that fills the screen -- the sheet of a phone, a
|
|
4892
|
+
* maximized one -- fills it but for the band a floating dock
|
|
4893
|
+
* keeps (DOCK_INSET_*). CSS, so the band moves with the dock
|
|
4894
|
+
* and no one has to tell the window.
|
|
4895
|
+
************************************************************/
|
|
4896
|
+
function fill_work_area($container) {
|
|
4897
|
+
let vw = window.innerWidth || document.documentElement.offsetWidth;
|
|
4898
|
+
let vh = window.innerHeight || document.documentElement.offsetHeight;
|
|
4899
|
+
$container.style.left = "0px";
|
|
4900
|
+
$container.style.top = DOCK_INSET_TOP;
|
|
4901
|
+
$container.style.width = vw + "px";
|
|
4902
|
+
$container.style.height = `calc(${vh}px - ${DOCK_INSET_TOP} - ${DOCK_INSET_BOTTOM})`;
|
|
4903
|
+
return {
|
|
4904
|
+
x: 0,
|
|
4905
|
+
y: 0,
|
|
4906
|
+
width: vw,
|
|
4907
|
+
height: vh
|
|
4908
|
+
};
|
|
4909
|
+
}
|
|
4910
|
+
/************************************************************
|
|
4911
|
+
* What is placed in the DOM, and removed from it: the window,
|
|
4912
|
+
* or the lock that holds a modal one over its backdrop.
|
|
4913
|
+
************************************************************/
|
|
4914
|
+
function window_root(gobj) {
|
|
4915
|
+
return gobj.priv.$lock || (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4916
|
+
}
|
|
4917
|
+
/************************************************************
|
|
4918
|
+
* An Escape typed in the window. The callback only decides
|
|
4919
|
+
* whether the key is the window's -- not when `keyboard` is
|
|
4920
|
+
* off, nor one that what it was typed in took -- and sends
|
|
4921
|
+
* the event: the close is the ✕'s, in the action.
|
|
4922
|
+
************************************************************/
|
|
4923
|
+
function on_escape_key(gobj, evt) {
|
|
4924
|
+
if (evt.key !== "Escape" && evt.keyCode !== 27) return;
|
|
4925
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj) || !(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "keyboard")) return;
|
|
4926
|
+
if (escape_is_taken(evt)) {
|
|
4927
|
+
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4928
|
+
let active = document.activeElement;
|
|
4929
|
+
if (evt.target && evt.target.isConnected === false && $container && (!active || active === document.body)) $container.focus();
|
|
4930
|
+
return;
|
|
4931
|
+
}
|
|
4932
|
+
evt.preventDefault();
|
|
4933
|
+
evt.stopPropagation();
|
|
4934
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", { key: "Escape" }, gobj);
|
|
4935
|
+
}
|
|
4936
|
+
/************************************************************
|
|
4505
4937
|
* Below the mobile breakpoint the window is a full-screen
|
|
4506
4938
|
* sheet (no float / drag / resize).
|
|
4507
4939
|
************************************************************/
|
|
@@ -4543,14 +4975,18 @@ function build_ui$18(gobj) {
|
|
|
4543
4975
|
let mobile = is_mobile$4();
|
|
4544
4976
|
let header = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "header");
|
|
4545
4977
|
if ((0, _yuneta_gobj_js.is_gobj)(header)) header = (0, _yuneta_gobj_js.gobj_read_attr)(header, "$container");
|
|
4546
|
-
|
|
4978
|
+
let title_id = `yui-window-title-${++__title_seq__}`;
|
|
4979
|
+
let $title = build_title_node(gobj, title_id, !!header);
|
|
4980
|
+
let $hidden_title = header ? $title : null;
|
|
4981
|
+
if (!header) header = $title;
|
|
4982
|
+
let modal = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal");
|
|
4547
4983
|
let body = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "body");
|
|
4548
4984
|
if ((0, _yuneta_gobj_js.is_gobj)(body)) body = (0, _yuneta_gobj_js.gobj_read_attr)(body, "$container");
|
|
4549
4985
|
let footer = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "footer");
|
|
4550
4986
|
if ((0, _yuneta_gobj_js.is_gobj)(footer)) footer = (0, _yuneta_gobj_js.gobj_read_attr)(footer, "$container");
|
|
4551
4987
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
|
|
4552
4988
|
if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) {
|
|
4553
|
-
let rect = (0, _yuneta_gobj_js.kw_get_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`);
|
|
4989
|
+
let rect = whole_rect((0, _yuneta_gobj_js.kw_get_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`));
|
|
4554
4990
|
if (rect) {
|
|
4555
4991
|
rect.x = rect.x < 0 ? 0 : rect.x;
|
|
4556
4992
|
rect.y = rect.y < 0 ? 0 : rect.y;
|
|
@@ -4589,12 +5025,21 @@ function build_ui$18(gobj) {
|
|
|
4589
5025
|
};
|
|
4590
5026
|
Object.assign(window_style, (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "window_style"));
|
|
4591
5027
|
let logical = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "logical_class");
|
|
5028
|
+
let dialog_attrs = {
|
|
5029
|
+
role: "dialog",
|
|
5030
|
+
tabindex: "-1"
|
|
5031
|
+
};
|
|
5032
|
+
let label_ids = [];
|
|
5033
|
+
if (!(0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title_prefix"))) label_ids.push(`${title_id}-prefix`);
|
|
5034
|
+
if (!(0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title"))) label_ids.push(`${title_id}-kind`);
|
|
5035
|
+
if (label_ids.length > 0) dialog_attrs["aria-labelledby"] = label_ids.join(" ");
|
|
5036
|
+
if (modal) dialog_attrs["aria-modal"] = "true";
|
|
4592
5037
|
let $container = (0, _yuneta_gobj_js.createElement2)([
|
|
4593
5038
|
"div",
|
|
4594
|
-
{
|
|
5039
|
+
Object.assign({
|
|
4595
5040
|
class: "C_YUI_WINDOW" + (logical ? " " + logical : "") + " strong-shadow is-flex is-flex-direction-column" + (mobile ? " is-mobile-sheet" : ""),
|
|
4596
5041
|
style: window_style
|
|
4597
|
-
},
|
|
5042
|
+
}, dialog_attrs),
|
|
4598
5043
|
[
|
|
4599
5044
|
[
|
|
4600
5045
|
"div",
|
|
@@ -4754,6 +5199,11 @@ function build_ui$18(gobj) {
|
|
|
4754
5199
|
]
|
|
4755
5200
|
]);
|
|
4756
5201
|
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
|
|
5202
|
+
if ($hidden_title) $container.insertBefore($hidden_title, $container.firstChild);
|
|
5203
|
+
$container.addEventListener("keydown", function(evt) {
|
|
5204
|
+
on_escape_key(gobj, evt);
|
|
5205
|
+
});
|
|
5206
|
+
if (mobile) fill_work_area($container);
|
|
4757
5207
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "resizable") && !(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showFooter")) {
|
|
4758
5208
|
let $resizable_btn = (0, _yuneta_gobj_js.createElement2)([
|
|
4759
5209
|
"div",
|
|
@@ -4781,10 +5231,29 @@ function build_ui$18(gobj) {
|
|
|
4781
5231
|
$container.appendChild($resizable_btn);
|
|
4782
5232
|
}
|
|
4783
5233
|
(0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
|
|
5234
|
+
if (modal) {
|
|
5235
|
+
let $lock = (0, _yuneta_gobj_js.createElement2)([
|
|
5236
|
+
"div",
|
|
5237
|
+
{
|
|
5238
|
+
class: "WINDOW_MODAL_LOCK yui-window-lock",
|
|
5239
|
+
style: `z-index:${MODAL_WINDOW_Z};`
|
|
5240
|
+
},
|
|
5241
|
+
[[
|
|
5242
|
+
"div",
|
|
5243
|
+
{ class: "WINDOW_MODAL_BACKDROP yui-window-backdrop" },
|
|
5244
|
+
[],
|
|
5245
|
+
{ mousedown: (evt) => {
|
|
5246
|
+
evt.preventDefault();
|
|
5247
|
+
} }
|
|
5248
|
+
]]
|
|
5249
|
+
]);
|
|
5250
|
+
$lock.appendChild($container);
|
|
5251
|
+
gobj.priv.$lock = $lock;
|
|
5252
|
+
}
|
|
4784
5253
|
let $parent = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$parent");
|
|
4785
5254
|
gobj.priv.placed_by_shell = !$parent;
|
|
4786
5255
|
if (!$parent) $parent = window_place(gobj);
|
|
4787
|
-
$parent.appendChild(
|
|
5256
|
+
$parent.appendChild(window_root(gobj));
|
|
4788
5257
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "openMaximized")) max$2(gobj);
|
|
4789
5258
|
else if (!mobile) {
|
|
4790
5259
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "content_size")) $container.style.height = "auto";
|
|
@@ -4800,11 +5269,10 @@ function build_ui$18(gobj) {
|
|
|
4800
5269
|
* Destroy UI
|
|
4801
5270
|
************************************************************/
|
|
4802
5271
|
function destroy_ui$13(gobj) {
|
|
4803
|
-
let $
|
|
4804
|
-
if ($
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
}
|
|
5272
|
+
let $root = window_root(gobj);
|
|
5273
|
+
if ($root && $root.parentNode) $root.parentNode.removeChild($root);
|
|
5274
|
+
gobj.priv.$lock = null;
|
|
5275
|
+
(0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", null);
|
|
4808
5276
|
}
|
|
4809
5277
|
/************************************************************
|
|
4810
5278
|
* Register this floating window in the shell's overlay history,
|
|
@@ -4895,9 +5363,16 @@ function close_window(gobj) {
|
|
|
4895
5363
|
* The place is the shell's, and a window parented to the app
|
|
4896
5364
|
* outlives it: ac_shell_changed() moves it when a shell goes or
|
|
4897
5365
|
* comes.
|
|
5366
|
+
*
|
|
5367
|
+
* A MODAL window lives in the shell's dialog layer instead, with
|
|
5368
|
+
* its backdrop: it blocks the drawer, the dock and every other
|
|
5369
|
+
* window, and a question it asks (a dialog of the same layer)
|
|
5370
|
+
* opens above it.
|
|
4898
5371
|
************************************************************/
|
|
4899
5372
|
function window_place(gobj) {
|
|
4900
|
-
|
|
5373
|
+
let shell = yui_shell_of(gobj);
|
|
5374
|
+
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal")) return yui_shell_modal_layer(shell) || document.body;
|
|
5375
|
+
return yui_shell_window_layer(shell) || document.body;
|
|
4901
5376
|
}
|
|
4902
5377
|
/************************************************************
|
|
4903
5378
|
*
|
|
@@ -4913,12 +5388,7 @@ function max$2(gobj) {
|
|
|
4913
5388
|
let priv = gobj.priv;
|
|
4914
5389
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
4915
5390
|
priv.prevSize = $container.getBoundingClientRect();
|
|
4916
|
-
let rect =
|
|
4917
|
-
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "center")) rect = do_center(gobj, rect.x, rect.y, rect.width, rect.height);
|
|
4918
|
-
$container.style.left = parseInt(rect.x) + "px";
|
|
4919
|
-
$container.style.top = parseInt(rect.y) + "px";
|
|
4920
|
-
$container.style.width = parseInt(rect.width) + "px";
|
|
4921
|
-
$container.style.height = parseInt(rect.height) + "px";
|
|
5391
|
+
let rect = fill_work_area($container);
|
|
4922
5392
|
(0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "maximized", true);
|
|
4923
5393
|
set_max_icon(gobj, true);
|
|
4924
5394
|
return rect;
|
|
@@ -4956,6 +5426,27 @@ function min$1(gobj) {
|
|
|
4956
5426
|
return rect;
|
|
4957
5427
|
}
|
|
4958
5428
|
/************************************************************
|
|
5429
|
+
* The rect of a window in whole pixels: x, y, width and height
|
|
5430
|
+
* are DTP_INTEGER, and getBoundingClientRect() answers fractions
|
|
5431
|
+
* under a zoom or a device pixel ratio (an integer attr refuses
|
|
5432
|
+
* 2.5, as in C). Also a rect saved with fractions before. null
|
|
5433
|
+
* when it is not a rect of four numbers.
|
|
5434
|
+
************************************************************/
|
|
5435
|
+
function whole_rect(rect) {
|
|
5436
|
+
if (!rect || typeof rect !== "object") return null;
|
|
5437
|
+
let whole = {};
|
|
5438
|
+
for (const key of [
|
|
5439
|
+
"x",
|
|
5440
|
+
"y",
|
|
5441
|
+
"width",
|
|
5442
|
+
"height"
|
|
5443
|
+
]) {
|
|
5444
|
+
if (typeof rect[key] !== "number" || !Number.isFinite(rect[key])) return null;
|
|
5445
|
+
whole[key] = Math.round(rect[key]);
|
|
5446
|
+
}
|
|
5447
|
+
return whole;
|
|
5448
|
+
}
|
|
5449
|
+
/************************************************************
|
|
4959
5450
|
* handlers moving
|
|
4960
5451
|
************************************************************/
|
|
4961
5452
|
function mvStart(gobj, evt) {
|
|
@@ -4990,17 +5481,13 @@ function mvStart(gobj, evt) {
|
|
|
4990
5481
|
$container.style.transition = "none";
|
|
4991
5482
|
$container.style.transform = "translate3d(0px, 0px, 0px)";
|
|
4992
5483
|
let rect = $container.getBoundingClientRect();
|
|
4993
|
-
|
|
4994
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
4995
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
4996
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
5484
|
+
let whole = whole_rect(rect);
|
|
5485
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", whole.x);
|
|
5486
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", whole.y);
|
|
5487
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", whole.width);
|
|
5488
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", whole.height);
|
|
4997
5489
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
|
|
4998
|
-
if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`,
|
|
4999
|
-
x: rect.x,
|
|
5000
|
-
y: rect.y,
|
|
5001
|
-
width: rect.width,
|
|
5002
|
-
height: rect.height
|
|
5003
|
-
});
|
|
5490
|
+
if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, whole);
|
|
5004
5491
|
}
|
|
5005
5492
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_WINDOW_MOVED", { rect });
|
|
5006
5493
|
}
|
|
@@ -5043,17 +5530,13 @@ function rsStart(gobj, evt) {
|
|
|
5043
5530
|
$container.style.width = rect.width + "px";
|
|
5044
5531
|
$container.style.height = rect.height + "px";
|
|
5045
5532
|
}
|
|
5046
|
-
|
|
5047
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
5048
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
5049
|
-
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "
|
|
5533
|
+
let whole = whole_rect(rect);
|
|
5534
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", whole.x);
|
|
5535
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", whole.y);
|
|
5536
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", whole.width);
|
|
5537
|
+
(0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", whole.height);
|
|
5050
5538
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
|
|
5051
|
-
if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`,
|
|
5052
|
-
x: rect.x,
|
|
5053
|
-
y: rect.y,
|
|
5054
|
-
width: rect.width,
|
|
5055
|
-
height: rect.height
|
|
5056
|
-
});
|
|
5539
|
+
if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, whole);
|
|
5057
5540
|
}
|
|
5058
5541
|
(0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_WINDOW_RESIZED", { rect });
|
|
5059
5542
|
}
|
|
@@ -5120,22 +5603,12 @@ function handleResize(gobj) {
|
|
|
5120
5603
|
if (!$container) return;
|
|
5121
5604
|
if (is_mobile$4()) {
|
|
5122
5605
|
$container.classList.add("is-mobile-sheet");
|
|
5123
|
-
|
|
5124
|
-
let vh = window.innerHeight || document.documentElement.offsetHeight;
|
|
5125
|
-
$container.style.left = "0px";
|
|
5126
|
-
$container.style.top = "0px";
|
|
5127
|
-
$container.style.width = vw + "px";
|
|
5128
|
-
$container.style.height = vh + "px";
|
|
5606
|
+
fill_work_area($container);
|
|
5129
5607
|
return;
|
|
5130
5608
|
}
|
|
5131
5609
|
$container.classList.remove("is-mobile-sheet");
|
|
5132
5610
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "maximized") === true) {
|
|
5133
|
-
|
|
5134
|
-
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "center")) r = do_center(gobj, r.x, r.y, r.width, r.height);
|
|
5135
|
-
$container.style.left = parseInt(r.x) + "px";
|
|
5136
|
-
$container.style.top = parseInt(r.y) + "px";
|
|
5137
|
-
$container.style.width = parseInt(r.width) + "px";
|
|
5138
|
-
$container.style.height = parseInt(r.height) + "px";
|
|
5611
|
+
fill_work_area($container);
|
|
5139
5612
|
return;
|
|
5140
5613
|
}
|
|
5141
5614
|
let rect = do_fix_dimension_to_screen(gobj, (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "x"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "y"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "width"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "height"));
|
|
@@ -5226,7 +5699,8 @@ function ac_shell_changed$1(gobj, event, kw, src) {
|
|
|
5226
5699
|
priv.placed_by_shell = true;
|
|
5227
5700
|
}
|
|
5228
5701
|
let $place = window_place(gobj);
|
|
5229
|
-
|
|
5702
|
+
let $root = window_root(gobj);
|
|
5703
|
+
if ($root.parentNode !== $place) $place.appendChild($root);
|
|
5230
5704
|
return 0;
|
|
5231
5705
|
}
|
|
5232
5706
|
/***************************
|
|
@@ -5234,6 +5708,7 @@ function ac_shell_changed$1(gobj, event, kw, src) {
|
|
|
5234
5708
|
***************************/
|
|
5235
5709
|
var gmt$21 = {
|
|
5236
5710
|
mt_create: mt_create$21,
|
|
5711
|
+
mt_start: mt_start$20,
|
|
5237
5712
|
mt_destroy: mt_destroy$21
|
|
5238
5713
|
};
|
|
5239
5714
|
/***************************************************************
|
|
@@ -5321,6 +5796,15 @@ function register_c_yui_window() {
|
|
|
5321
5796
|
* (`responsive_query`) — so on mobile it lives above
|
|
5322
5797
|
* the bottom menu instead of covering it.
|
|
5323
5798
|
*
|
|
5799
|
+
* A FLOATING dock that shows says the band it keeps at the top or
|
|
5800
|
+
* the foot of the viewport: `--yui-dock-inset-top` /
|
|
5801
|
+
* `--yui-dock-inset-bottom` on the root element (publish_dock_band).
|
|
5802
|
+
* A window that fills the screen -- the sheet of a phone, a
|
|
5803
|
+
* maximized one -- leaves that band free. It used to go under the
|
|
5804
|
+
* dock: at a bottom corner the dock covered its foot, at a top
|
|
5805
|
+
* corner its ✕ and its minimize (a 'responsive' dock with no
|
|
5806
|
+
* `inline_selector` floats on a phone too).
|
|
5807
|
+
*
|
|
5324
5808
|
* Copyright (c) 2026, ArtGins.
|
|
5325
5809
|
* All Rights Reserved.
|
|
5326
5810
|
***********************************************************************/
|
|
@@ -5390,6 +5874,7 @@ function mt_destroy$20(gobj) {
|
|
|
5390
5874
|
priv.mql_handler = null;
|
|
5391
5875
|
}
|
|
5392
5876
|
destroy_dock(gobj);
|
|
5877
|
+
publish_dock_band(gobj);
|
|
5393
5878
|
}
|
|
5394
5879
|
/***************************
|
|
5395
5880
|
* Local Methods
|
|
@@ -5494,8 +5979,10 @@ function ensure_dock_style() {
|
|
|
5494
5979
|
.yui-dock-label { flex: 0 0 auto; }
|
|
5495
5980
|
/* Split label halves (prefix = DATA, kind = translatable). The
|
|
5496
5981
|
* separator is CSS, never a text node — same rule as the window
|
|
5497
|
-
* title bar (createElement2 trims text nodes).
|
|
5498
|
-
|
|
5982
|
+
* title bar (createElement2 trims text nodes). Decorative ("/ ''"):
|
|
5983
|
+
* the halves NAME the toggle (aria-labelledby), and a reader read
|
|
5984
|
+
* the dot into the kind half ("#1 ·demo window"). */
|
|
5985
|
+
.yui-dock-label .yui-dock-label-prefix + .yui-dock-label-kind::before { content: " \\00b7 "; content: " \\00b7 " / ""; }
|
|
5499
5986
|
.yui-dock-close {
|
|
5500
5987
|
width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
|
|
5501
5988
|
padding: 0; margin-left: 1px; border: 0; border-radius: 4px;
|
|
@@ -5567,6 +6054,32 @@ function apply_placement(gobj) {
|
|
|
5567
6054
|
]) $dock.classList.toggle(`yui-dock--${c}`, !inline && c === corner);
|
|
5568
6055
|
let target = inline ? $inline : (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$parent") || dock_place(gobj);
|
|
5569
6056
|
if ($dock.parentNode !== target) target.appendChild($dock);
|
|
6057
|
+
publish_dock_band(gobj);
|
|
6058
|
+
}
|
|
6059
|
+
/************************************************************
|
|
6060
|
+
* Say the band the dock keeps over the windows: a FLOATING
|
|
6061
|
+
* dock that shows takes the top or the foot of the viewport,
|
|
6062
|
+
* from its edge to its far side. A window that fills the
|
|
6063
|
+
* screen leaves it free (C_YUI_WINDOW's fill_work_area()). An
|
|
6064
|
+
* inline dock keeps none: it is in the layout. Nor does an
|
|
6065
|
+
* empty one, or one that is not drawn.
|
|
6066
|
+
************************************************************/
|
|
6067
|
+
function publish_dock_band(gobj) {
|
|
6068
|
+
let $dock = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
6069
|
+
let top = 0;
|
|
6070
|
+
let bottom = 0;
|
|
6071
|
+
if ($dock && $dock.parentNode && $dock.classList.contains("yui-dock--floating") && !$dock.classList.contains("is-empty")) {
|
|
6072
|
+
let r = $dock.getBoundingClientRect();
|
|
6073
|
+
if (r.height > 0) {
|
|
6074
|
+
if (((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "dock_corner") || "bottom-left").indexOf("top") === 0) top = Math.ceil(r.bottom);
|
|
6075
|
+
else bottom = Math.ceil((window.innerHeight || 0) - r.top);
|
|
6076
|
+
}
|
|
6077
|
+
}
|
|
6078
|
+
let style = document.documentElement.style;
|
|
6079
|
+
if (top > 0) style.setProperty("--yui-dock-inset-top", `${top}px`);
|
|
6080
|
+
else style.removeProperty("--yui-dock-inset-top");
|
|
6081
|
+
if (bottom > 0) style.setProperty("--yui-dock-inset-bottom", `${bottom}px`);
|
|
6082
|
+
else style.removeProperty("--yui-dock-inset-bottom");
|
|
5570
6083
|
}
|
|
5571
6084
|
/************************************************************
|
|
5572
6085
|
* Where the FLOATING dock lives when the app names no
|
|
@@ -5581,12 +6094,12 @@ function apply_placement(gobj) {
|
|
|
5581
6094
|
* and it covered a toast where they met.
|
|
5582
6095
|
*
|
|
5583
6096
|
* The popup layer, not the window layer: the dock has to stay
|
|
5584
|
-
* above EVERY window, and windows live in
|
|
5585
|
-
*
|
|
5586
|
-
*
|
|
5587
|
-
*
|
|
5588
|
-
* cover. No shell (before the first,
|
|
5589
|
-
* next login): the body.
|
|
6097
|
+
* above EVERY window, and the windows live in the window layer
|
|
6098
|
+
* -- since 7.26.35 the site map and the JSON windows of the
|
|
6099
|
+
* treedb views too, which put theirs in the popup layer until
|
|
6100
|
+
* then. The popup layer is above it; below the dialogs, the
|
|
6101
|
+
* toasts and the loading cover. No shell (before the first,
|
|
6102
|
+
* between a logout and the next login): the body.
|
|
5590
6103
|
************************************************************/
|
|
5591
6104
|
function dock_place(gobj) {
|
|
5592
6105
|
return yui_shell_popup_layer(yui_shell_of(gobj)) || document.body;
|
|
@@ -5656,6 +6169,7 @@ function sync_dock_visibility(gobj) {
|
|
|
5656
6169
|
let priv = gobj.priv;
|
|
5657
6170
|
let $dock = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
5658
6171
|
if ($dock) $dock.classList.toggle("is-empty", priv.windows.length === 0);
|
|
6172
|
+
publish_dock_band(gobj);
|
|
5659
6173
|
}
|
|
5660
6174
|
/************************************************************
|
|
5661
6175
|
* Mark one entry active (raised), the rest inactive.
|
|
@@ -5694,10 +6208,17 @@ function minimize_entry(gobj, entry) {
|
|
|
5694
6208
|
/************************************************************
|
|
5695
6209
|
* Dock chip click: taskbar toggle — restore+focus a
|
|
5696
6210
|
* minimized/inactive window, minimize the active one.
|
|
6211
|
+
*
|
|
6212
|
+
* The window brought back takes the keyboard focus too: the
|
|
6213
|
+
* reader pressed its chip to go there, and a window is heard
|
|
6214
|
+
* (Escape, Tab) only with the focus in it.
|
|
5697
6215
|
************************************************************/
|
|
5698
6216
|
function on_chip_click(gobj, entry) {
|
|
5699
|
-
if (entry.minimized || !entry.$chip.classList.contains("is-active"))
|
|
5700
|
-
|
|
6217
|
+
if (entry.minimized || !entry.$chip.classList.contains("is-active")) {
|
|
6218
|
+
focus_entry(gobj, entry);
|
|
6219
|
+
let $win = (0, _yuneta_gobj_js.gobj_read_attr)(entry.gobj, "$container");
|
|
6220
|
+
if ($win) $win.focus();
|
|
6221
|
+
} else minimize_entry(gobj, entry);
|
|
5701
6222
|
}
|
|
5702
6223
|
/***************************
|
|
5703
6224
|
* Actions
|
|
@@ -5826,7 +6347,13 @@ function ac_minimize_window(gobj, event, kw, src) {
|
|
|
5826
6347
|
let win = window_of(gobj, event, kw, src);
|
|
5827
6348
|
if (!win) return -1;
|
|
5828
6349
|
let entry = find_entry(gobj.priv, win);
|
|
5829
|
-
if (entry)
|
|
6350
|
+
if (entry) {
|
|
6351
|
+
let $win = (0, _yuneta_gobj_js.gobj_read_attr)(win, "$container");
|
|
6352
|
+
let had_focus = !!($win && $win.contains(document.activeElement));
|
|
6353
|
+
minimize_entry(gobj, entry);
|
|
6354
|
+
let $toggle = had_focus && entry.$chip ? entry.$chip.querySelector(".DOCK_CHIP_TOGGLE") : null;
|
|
6355
|
+
if ($toggle) $toggle.focus();
|
|
6356
|
+
}
|
|
5830
6357
|
return 0;
|
|
5831
6358
|
}
|
|
5832
6359
|
/************************************************************
|
|
@@ -7120,6 +7647,10 @@ function register_c_yui_wizard() {
|
|
|
7120
7647
|
*
|
|
7121
7648
|
* yui_tabulator_relocalize(table, t, {device_id: t("device id")});
|
|
7122
7649
|
*
|
|
7650
|
+
* A column GROUP is bound by field too, and Tabulator gives it none:
|
|
7651
|
+
* give it one (`{title, field: "sizes", columns: [...]}`, no row reads
|
|
7652
|
+
* it) and its title goes in the same object. One without is said.
|
|
7653
|
+
*
|
|
7123
7654
|
* Every key carries an English `defaultValue`, so an app that does not
|
|
7124
7655
|
* define it renders exactly what Tabulator rendered before — the
|
|
7125
7656
|
* keys are an OPPORTUNITY to translate, never a requirement.
|
|
@@ -7279,6 +7810,22 @@ function yui_tabulator_name_editor(column_def, name_of) {
|
|
|
7279
7810
|
};
|
|
7280
7811
|
}
|
|
7281
7812
|
/***************************************************************
|
|
7813
|
+
* A column GROUP whose title cannot change language, said.
|
|
7814
|
+
*
|
|
7815
|
+
* Tabulator binds a column's title to the locale by its `field`, and
|
|
7816
|
+
* a group has none: its title stays in the language the table was
|
|
7817
|
+
* built in. Given a `field` (no row reads a group's), a group is
|
|
7818
|
+
* bound like any other column, and its title goes in `titles`.
|
|
7819
|
+
***************************************************************/
|
|
7820
|
+
function say_groups_without_field(columns) {
|
|
7821
|
+
for (let column of columns || []) {
|
|
7822
|
+
let def = column.getDefinition() || {};
|
|
7823
|
+
if (!Array.isArray(def.columns)) continue;
|
|
7824
|
+
if (!def.field) (0, _yuneta_gobj_js.log_warning)(`yui_tabulator_relocalize: column group '${def.title}' has no field: its title stays in the language it was built in`);
|
|
7825
|
+
say_groups_without_field(column.getSubColumns());
|
|
7826
|
+
}
|
|
7827
|
+
}
|
|
7828
|
+
/***************************************************************
|
|
7282
7829
|
* yui_tabulator_relocalize() -- see "Put an EXISTING table in the
|
|
7283
7830
|
* current language" above.
|
|
7284
7831
|
*
|
|
@@ -7287,14 +7834,19 @@ function yui_tabulator_name_editor(column_def, name_of) {
|
|
|
7287
7834
|
* (`columns`), where Tabulator binds each column's title: setLocale()
|
|
7288
7835
|
* draws them again without rebuilding a column -- updateDefinition()
|
|
7289
7836
|
* re-renders every row, and a row whose formatter builds something (a
|
|
7290
|
-
* nested table) builds it anew. A field left out keeps its title.
|
|
7837
|
+
* nested table) builds it anew. A field left out keeps its title. A
|
|
7838
|
+
* column GROUP is bound only if it has a `field` of its own: one
|
|
7839
|
+
* without is said (say_groups_without_field).
|
|
7291
7840
|
***************************************************************/
|
|
7292
7841
|
function yui_tabulator_relocalize(table, t, titles) {
|
|
7293
7842
|
if (!table) return;
|
|
7294
7843
|
try {
|
|
7295
7844
|
let name = next_lang_name();
|
|
7296
7845
|
let strings = tabulator_strings(t);
|
|
7297
|
-
if (titles && typeof titles === "object")
|
|
7846
|
+
if (titles && typeof titles === "object") {
|
|
7847
|
+
strings.columns = Object.assign({}, titles);
|
|
7848
|
+
say_groups_without_field(table.getColumns(true));
|
|
7849
|
+
}
|
|
7298
7850
|
table.options.langs = table.options.langs || {};
|
|
7299
7851
|
table.options.langs[name] = strings;
|
|
7300
7852
|
let localize = table.modules && table.modules.localize;
|
|
@@ -9221,7 +9773,9 @@ function json_editor_value(content) {
|
|
|
9221
9773
|
* Not reached, because the editor gives them no hook: its search
|
|
9222
9774
|
* box, its repair messages, the tip at the foot of the context
|
|
9223
9775
|
* menu, and its modals (sort, transform). They stay in its
|
|
9224
|
-
* English.
|
|
9776
|
+
* English. vanilla-jsoneditor (3.13.0) has no i18n option: they
|
|
9777
|
+
* are literals inside its Svelte components, and the only way to
|
|
9778
|
+
* them would be rewriting its DOM by its English words.
|
|
9225
9779
|
*
|
|
9226
9780
|
* Copyright (c) 2026, ArtGins.
|
|
9227
9781
|
* All Rights Reserved.
|
|
@@ -9863,11 +10417,11 @@ function cell_icon(icon_class, key) {
|
|
|
9863
10417
|
}
|
|
9864
10418
|
/************************************************************
|
|
9865
10419
|
* The identity of a table element, for the kw of
|
|
9866
|
-
* EV_ADD_TABLE_ROW: a kw is plain json,
|
|
9867
|
-
* `.tabulator`, circular) broke the
|
|
9868
|
-
* Given on first use and kept on
|
|
9869
|
-
* it weakly, so a nested table
|
|
9870
|
-
* not kept alive by it.
|
|
10420
|
+
* EV_ADD_TABLE_ROW and EV_LOAD_TABLE_ROWS: a kw is plain json,
|
|
10421
|
+
* and an element (with its `.tabulator`, circular) broke the
|
|
10422
|
+
* `machine` trace that dumps it. Given on first use and kept on
|
|
10423
|
+
* the element; the registry holds it weakly, so a nested table
|
|
10424
|
+
* whose row is gone is not kept alive by it.
|
|
9871
10425
|
************************************************************/
|
|
9872
10426
|
function table_identity(gobj, $table) {
|
|
9873
10427
|
if (!$table.yui_table_id) {
|
|
@@ -9893,6 +10447,53 @@ function find_table(gobj, table_id) {
|
|
|
9893
10447
|
return $table;
|
|
9894
10448
|
}
|
|
9895
10449
|
/************************************************************
|
|
10450
|
+
* Destroy one third-party widget, saying why it could not be.
|
|
10451
|
+
************************************************************/
|
|
10452
|
+
function destroy_widget(gobj, what, widget) {
|
|
10453
|
+
try {
|
|
10454
|
+
let r = widget.destroy();
|
|
10455
|
+
if (r && typeof r.then === "function") r.catch((e) => {
|
|
10456
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
|
|
10457
|
+
});
|
|
10458
|
+
} catch (e) {
|
|
10459
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
|
|
10460
|
+
}
|
|
10461
|
+
}
|
|
10462
|
+
/************************************************************
|
|
10463
|
+
* A table element that is gone: its identity is no table now,
|
|
10464
|
+
* and what was waiting to be loaded in it never will be.
|
|
10465
|
+
************************************************************/
|
|
10466
|
+
function forget_table(gobj, $table) {
|
|
10467
|
+
$table.yui_pending_rows = null;
|
|
10468
|
+
if ($table.yui_table_id && gobj.priv && gobj.priv.tables) gobj.priv.tables.delete($table.yui_table_id);
|
|
10469
|
+
}
|
|
10470
|
+
/************************************************************
|
|
10471
|
+
* Destroy the nested tables a row of a table built (its row
|
|
10472
|
+
* formatter keeps them on the row's element), theirs first.
|
|
10473
|
+
* Tabulator takes the row's DOM away when the row goes -- a
|
|
10474
|
+
* reload, an undo, a deleted row -- and destroys nothing in it:
|
|
10475
|
+
* each nested table stayed in Tabulator's registry, with its
|
|
10476
|
+
* observers, for the life of the page.
|
|
10477
|
+
************************************************************/
|
|
10478
|
+
function destroy_row_tables(gobj, $row) {
|
|
10479
|
+
let nested = $row.yui_nested || [];
|
|
10480
|
+
$row.yui_nested = null;
|
|
10481
|
+
for (let $nested of nested) {
|
|
10482
|
+
if ($nested.tabulator) {
|
|
10483
|
+
destroy_rows_tables(gobj, $nested.tabulator);
|
|
10484
|
+
destroy_widget(gobj, "nested table", $nested.tabulator);
|
|
10485
|
+
$nested.tabulator = null;
|
|
10486
|
+
}
|
|
10487
|
+
forget_table(gobj, $nested);
|
|
10488
|
+
}
|
|
10489
|
+
}
|
|
10490
|
+
/************************************************************
|
|
10491
|
+
* Destroy the nested tables of every row of a table.
|
|
10492
|
+
************************************************************/
|
|
10493
|
+
function destroy_rows_tables(gobj, tabulator) {
|
|
10494
|
+
for (let row of tabulator.getRows()) destroy_row_tables(gobj, row.getElement());
|
|
10495
|
+
}
|
|
10496
|
+
/************************************************************
|
|
9896
10497
|
* Destroy the third-party widgets the form built. Removing
|
|
9897
10498
|
* their DOM is not enough: Tom Select keeps listeners on
|
|
9898
10499
|
* `document` and `window`, the jsoneditor is a live Svelte app
|
|
@@ -9901,40 +10502,21 @@ function find_table(gobj, table_id) {
|
|
|
9901
10502
|
* first: their parent's destroy drops the rows they hang from.
|
|
9902
10503
|
************************************************************/
|
|
9903
10504
|
function destroy_widgets(gobj, $container) {
|
|
9904
|
-
let destroy = (what, widget) => {
|
|
9905
|
-
try {
|
|
9906
|
-
let r = widget.destroy();
|
|
9907
|
-
if (r && typeof r.then === "function") r.catch((e) => {
|
|
9908
|
-
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
|
|
9909
|
-
});
|
|
9910
|
-
} catch (e) {
|
|
9911
|
-
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
|
|
9912
|
-
}
|
|
9913
|
-
};
|
|
9914
|
-
let forget = ($el) => {
|
|
9915
|
-
if ($el.yui_table_id && gobj.priv && gobj.priv.tables) gobj.priv.tables.delete($el.yui_table_id);
|
|
9916
|
-
};
|
|
9917
|
-
$container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
|
|
9918
|
-
if ($el.tabulator) {
|
|
9919
|
-
destroy("nested table", $el.tabulator);
|
|
9920
|
-
$el.tabulator = null;
|
|
9921
|
-
}
|
|
9922
|
-
forget($el);
|
|
9923
|
-
});
|
|
9924
10505
|
$container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
|
|
9925
10506
|
if ($el.tom_select) {
|
|
9926
|
-
|
|
10507
|
+
destroy_widget(gobj, "select", $el.tom_select);
|
|
9927
10508
|
$el.tom_select = null;
|
|
9928
10509
|
}
|
|
9929
10510
|
if ($el.jsoneditor) {
|
|
9930
|
-
|
|
10511
|
+
destroy_widget(gobj, "json editor", $el.jsoneditor);
|
|
9931
10512
|
$el.jsoneditor = null;
|
|
9932
10513
|
}
|
|
9933
10514
|
if ($el.tabulator) {
|
|
9934
|
-
|
|
10515
|
+
destroy_rows_tables(gobj, $el.tabulator);
|
|
10516
|
+
destroy_widget(gobj, "table", $el.tabulator);
|
|
9935
10517
|
$el.tabulator = null;
|
|
10518
|
+
forget_table(gobj, $el);
|
|
9936
10519
|
}
|
|
9937
|
-
forget($el);
|
|
9938
10520
|
});
|
|
9939
10521
|
}
|
|
9940
10522
|
/******************************************************************
|
|
@@ -10614,8 +11196,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
10614
11196
|
}
|
|
10615
11197
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
|
|
10616
11198
|
table_id: table_identity(gobj, $add_table),
|
|
10617
|
-
record: {}
|
|
10618
|
-
loading: false
|
|
11199
|
+
record: {}
|
|
10619
11200
|
}, gobj);
|
|
10620
11201
|
} }
|
|
10621
11202
|
]]
|
|
@@ -11169,6 +11750,19 @@ function create_coordinates(gobj, attrs) {
|
|
|
11169
11750
|
}
|
|
11170
11751
|
/******************************************************************
|
|
11171
11752
|
* Create tabulator
|
|
11753
|
+
*
|
|
11754
|
+
* A row builds its nested tables the first time it is drawn, each
|
|
11755
|
+
* loaded from the row's own data, and keeps them on its element
|
|
11756
|
+
* (`yui_nested`) until the row goes (destroy_row_tables). A row
|
|
11757
|
+
* drawn AGAIN -- a forced redraw, a column rebuilt -- has its
|
|
11758
|
+
* children taken off by Tabulator before its formatter runs: they
|
|
11759
|
+
* are put back as they are. Built anew, they came back empty, and
|
|
11760
|
+
* the old ones stayed alive in Tabulator's registry.
|
|
11761
|
+
*
|
|
11762
|
+
* A load that comes before the table is built waits for its
|
|
11763
|
+
* `tableBuilt`, ONE per table (`yui_pending_rows`): a later load
|
|
11764
|
+
* replaces it, a clear drops it. Each load used to hang a listener
|
|
11765
|
+
* of its own, so two loads before the build drew the rows twice.
|
|
11172
11766
|
******************************************************************/
|
|
11173
11767
|
function create_tabulator$1(gobj, $extend, name, template) {
|
|
11174
11768
|
function get_selectable_state(row) {
|
|
@@ -11188,6 +11782,13 @@ function create_tabulator$1(gobj, $extend, name, template) {
|
|
|
11188
11782
|
let sub_elements = [];
|
|
11189
11783
|
tabulator_settings.columns = template2columns(gobj, columns, template, sub_elements);
|
|
11190
11784
|
if (sub_elements.length > 0) tabulator_settings.rowFormatter = function(row) {
|
|
11785
|
+
let $row = row.getElement();
|
|
11786
|
+
if ($row.yui_nested) {
|
|
11787
|
+
for (let $nested of $row.yui_nested) $row.appendChild($nested);
|
|
11788
|
+
return;
|
|
11789
|
+
}
|
|
11790
|
+
$row.yui_nested = [];
|
|
11791
|
+
let data = row.getData() || {};
|
|
11191
11792
|
for (let sub_element of sub_elements) {
|
|
11192
11793
|
let extend = ["div", {
|
|
11193
11794
|
class: "yui-tabulator-table-nested pl-6 is-bordered is-striped",
|
|
@@ -11195,7 +11796,10 @@ function create_tabulator$1(gobj, $extend, name, template) {
|
|
|
11195
11796
|
}];
|
|
11196
11797
|
let $extend = (0, _yuneta_gobj_js.createElement2)(extend);
|
|
11197
11798
|
$extend.tabulator = create_tabulator$1(gobj, $extend, sub_element.name, sub_element.template);
|
|
11198
|
-
row.
|
|
11799
|
+
$row.appendChild($extend);
|
|
11800
|
+
$row.yui_nested.push($extend);
|
|
11801
|
+
let rows = data[sub_element.name];
|
|
11802
|
+
load_tabulator_data(gobj, $extend, (0, _yuneta_gobj_js.is_array)(rows) ? rows : []);
|
|
11199
11803
|
}
|
|
11200
11804
|
};
|
|
11201
11805
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_delete_row_btn")) columns.push({
|
|
@@ -11227,6 +11831,18 @@ function create_tabulator$1(gobj, $extend, name, template) {
|
|
|
11227
11831
|
if (gobj.priv.loading_rows > 0) return;
|
|
11228
11832
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
|
|
11229
11833
|
});
|
|
11834
|
+
$extend.yui_pending_rows = null;
|
|
11835
|
+
tabulator.on("tableBuilt", function() {
|
|
11836
|
+
let rows = $extend.yui_pending_rows;
|
|
11837
|
+
$extend.yui_pending_rows = null;
|
|
11838
|
+
if (rows && !(0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LOAD_TABLE_ROWS", {
|
|
11839
|
+
table_id: table_identity(gobj, $extend),
|
|
11840
|
+
rows
|
|
11841
|
+
}, gobj);
|
|
11842
|
+
});
|
|
11843
|
+
tabulator.on("rowDeleted", function(row) {
|
|
11844
|
+
destroy_row_tables(gobj, row.getElement());
|
|
11845
|
+
});
|
|
11230
11846
|
tabulator.on("renderComplete", function() {
|
|
11231
11847
|
yui_tabulator_name_row_selects(tabulator, i18next.t);
|
|
11232
11848
|
});
|
|
@@ -11317,8 +11933,7 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
11317
11933
|
}
|
|
11318
11934
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
|
|
11319
11935
|
table_id: table_identity(gobj, $extend),
|
|
11320
|
-
record: {}
|
|
11321
|
-
loading: false
|
|
11936
|
+
record: {}
|
|
11322
11937
|
}, gobj);
|
|
11323
11938
|
}
|
|
11324
11939
|
});
|
|
@@ -11546,6 +12161,21 @@ function getInputValue($input) {
|
|
|
11546
12161
|
else return $input.value;
|
|
11547
12162
|
}
|
|
11548
12163
|
/************************************************************
|
|
12164
|
+
* The rows of a table as the form saves them: copies, each with
|
|
12165
|
+
* the rows of the nested tables its row holds. A row's
|
|
12166
|
+
* getData() is the row's OWN object: handed out in the save, a
|
|
12167
|
+
* later edit wrote into what the host had been given.
|
|
12168
|
+
************************************************************/
|
|
12169
|
+
function table_values(tabulator) {
|
|
12170
|
+
let value = [];
|
|
12171
|
+
for (let row of tabulator.getRows()) {
|
|
12172
|
+
let d = (0, _yuneta_gobj_js.json_deep_copy)(row.getData());
|
|
12173
|
+
for (let $nested of row.getElement().yui_nested || []) if ($nested.tabulator) d[$nested.getAttribute("name")] = table_values($nested.tabulator);
|
|
12174
|
+
value.push(d);
|
|
12175
|
+
}
|
|
12176
|
+
return value;
|
|
12177
|
+
}
|
|
12178
|
+
/************************************************************
|
|
11549
12179
|
* Function to get input value based on its type
|
|
11550
12180
|
************************************************************/
|
|
11551
12181
|
function get_form_values(gobj, $form) {
|
|
@@ -11599,18 +12229,7 @@ function get_form_values(gobj, $form) {
|
|
|
11599
12229
|
break;
|
|
11600
12230
|
case "table":
|
|
11601
12231
|
let template = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "template");
|
|
11602
|
-
if (!(0, _yuneta_gobj_js.empty_string)(name) && (0, _yuneta_gobj_js.kw_has_key)(template, name))
|
|
11603
|
-
value = [];
|
|
11604
|
-
let rows = $input.tabulator.getRows();
|
|
11605
|
-
for (let row of rows) {
|
|
11606
|
-
let d = row.getData();
|
|
11607
|
-
value.push(d);
|
|
11608
|
-
row.getElement().querySelectorAll(".yui-tabulator-table-nested").forEach(($nested) => {
|
|
11609
|
-
let name_n = $nested.getAttribute("name");
|
|
11610
|
-
d[name_n] = $nested.tabulator.getData();
|
|
11611
|
-
});
|
|
11612
|
-
}
|
|
11613
|
-
}
|
|
12232
|
+
if (!(0, _yuneta_gobj_js.empty_string)(name) && (0, _yuneta_gobj_js.kw_has_key)(template, name)) value = table_values($input.tabulator);
|
|
11614
12233
|
break;
|
|
11615
12234
|
case "coordinates":
|
|
11616
12235
|
if ($input.tagName !== "INPUT") $input = $input.querySelector("input");
|
|
@@ -11627,7 +12246,10 @@ function get_form_values(gobj, $form) {
|
|
|
11627
12246
|
return record;
|
|
11628
12247
|
}
|
|
11629
12248
|
/************************************************************
|
|
11630
|
-
*
|
|
12249
|
+
* Empty the form. A table not built yet has no rows to clear
|
|
12250
|
+
* but may have a load waiting for its build: it is dropped too,
|
|
12251
|
+
* or the rows cleared here came back when the table was built.
|
|
12252
|
+
* The nested tables go with the rows that hold them.
|
|
11631
12253
|
************************************************************/
|
|
11632
12254
|
function clear_data(gobj, $form) {
|
|
11633
12255
|
let pkey = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "pkey");
|
|
@@ -11660,10 +12282,11 @@ function clear_data(gobj, $form) {
|
|
|
11660
12282
|
if ($file.yui_file_render) $file.yui_file_render();
|
|
11661
12283
|
});
|
|
11662
12284
|
$form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
|
|
11663
|
-
|
|
11664
|
-
$table.
|
|
11665
|
-
|
|
11666
|
-
|
|
12285
|
+
$table.yui_pending_rows = null;
|
|
12286
|
+
if ($table.tabulator.initialized) {
|
|
12287
|
+
destroy_rows_tables(gobj, $table.tabulator);
|
|
12288
|
+
$table.tabulator.clearData();
|
|
12289
|
+
}
|
|
11667
12290
|
});
|
|
11668
12291
|
}
|
|
11669
12292
|
/************************************************************
|
|
@@ -11788,27 +12411,35 @@ function set_form_values(gobj, template, $form, record) {
|
|
|
11788
12411
|
return modified;
|
|
11789
12412
|
}
|
|
11790
12413
|
/************************************************************
|
|
11791
|
-
*
|
|
11792
|
-
*
|
|
12414
|
+
* Load the rows of a record in a table: all of them at once
|
|
12415
|
+
* (EV_LOAD_TABLE_ROWS), now if the table is built, else when it
|
|
12416
|
+
* is (create_tabulator's `tableBuilt`).
|
|
11793
12417
|
************************************************************/
|
|
11794
12418
|
function load_tabulator_data(gobj, $table, value) {
|
|
11795
|
-
if (!value) {
|
|
12419
|
+
if (!(0, _yuneta_gobj_js.is_array)(value)) {
|
|
11796
12420
|
(0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: no data to load_tabulator_data()", (0, _yuneta_gobj_js.gobj_short_name)(gobj)));
|
|
11797
12421
|
return;
|
|
11798
12422
|
}
|
|
11799
|
-
|
|
11800
|
-
|
|
12423
|
+
if (!$table.tabulator.initialized) {
|
|
12424
|
+
$table.yui_pending_rows = value.length > 0 ? value : null;
|
|
12425
|
+
return;
|
|
12426
|
+
}
|
|
12427
|
+
$table.yui_pending_rows = null;
|
|
12428
|
+
if (value.length === 0) return;
|
|
12429
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LOAD_TABLE_ROWS", {
|
|
11801
12430
|
table_id: table_identity(gobj, $table),
|
|
11802
|
-
|
|
11803
|
-
loading: true
|
|
12431
|
+
rows: value
|
|
11804
12432
|
}, gobj);
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
12433
|
+
}
|
|
12434
|
+
/************************************************************
|
|
12435
|
+
* Redraw a table once what was added to it is drawn: the
|
|
12436
|
+
* "double scrollbar" Tabulator leaves when its rows grow.
|
|
12437
|
+
************************************************************/
|
|
12438
|
+
function redraw_table_later(gobj, $table) {
|
|
12439
|
+
setTimeout(function() {
|
|
12440
|
+
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
12441
|
+
if ($table && $table.tabulator) $table.tabulator.redraw();
|
|
12442
|
+
}, 30);
|
|
11812
12443
|
}
|
|
11813
12444
|
/************************************************************
|
|
11814
12445
|
* Convert a record column value from backend
|
|
@@ -12116,8 +12747,16 @@ function ac_set_file_preview(gobj, event, kw, src) {
|
|
|
12116
12747
|
return 0;
|
|
12117
12748
|
}
|
|
12118
12749
|
/************************************************************
|
|
12119
|
-
* From
|
|
12120
|
-
*
|
|
12750
|
+
* From the add button of a table, outer or nested: the
|
|
12751
|
+
* reader's new row. A change of the reader's (`dataChanged`).
|
|
12752
|
+
* Tabulator keeps the object it is given and writes the
|
|
12753
|
+
* reader's edits into it: it is given a copy. A row added to a
|
|
12754
|
+
* nested table makes the row it lives in grow: the outer table
|
|
12755
|
+
* is the one redrawn.
|
|
12756
|
+
* {
|
|
12757
|
+
* table_id: the table (table_identity())
|
|
12758
|
+
* record: the new row, {} from the button
|
|
12759
|
+
* }
|
|
12121
12760
|
************************************************************/
|
|
12122
12761
|
function ac_add_table_row(gobj, event, kw, src) {
|
|
12123
12762
|
let table_id = kw.table_id;
|
|
@@ -12127,34 +12766,59 @@ function ac_add_table_row(gobj, event, kw, src) {
|
|
|
12127
12766
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
|
|
12128
12767
|
return -1;
|
|
12129
12768
|
}
|
|
12130
|
-
|
|
12131
|
-
|
|
12769
|
+
tabulator.addRow((0, _yuneta_gobj_js.json_deep_copy)((0, _yuneta_gobj_js.is_object)(kw.record) ? kw.record : {})).catch(function(error) {
|
|
12770
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
|
|
12771
|
+
});
|
|
12772
|
+
redraw_table_later(gobj, $table.closest(".yui-tabulator-table"));
|
|
12773
|
+
return 0;
|
|
12774
|
+
}
|
|
12775
|
+
/************************************************************
|
|
12776
|
+
* From load_tabulator_data(): the rows of the record a table
|
|
12777
|
+
* shows, all of them in ONE call and one redraw. A row at a time
|
|
12778
|
+
* redrew every row of the table after each one: 300 rows took
|
|
12779
|
+
* 20 s, 300 with a nested table each 39 s.
|
|
12780
|
+
*
|
|
12781
|
+
* Tabulator keeps the objects it is given (Row.setData() copies
|
|
12782
|
+
* nothing) and a cell edit writes into them: handed the
|
|
12783
|
+
* `record`'s own, an edit wrote into the record, and Undo --
|
|
12784
|
+
* which loads the record again -- loaded the edit. It is given
|
|
12785
|
+
* a copy.
|
|
12786
|
+
*
|
|
12787
|
+
* And it says `dataChanged` INSIDE addData(), synchronously,
|
|
12788
|
+
* once per row: rows the FORM loads are muted there, whenever
|
|
12789
|
+
* they land -- also from a `tableBuilt` that comes after the
|
|
12790
|
+
* load returned, which is why no timer can tell them from the
|
|
12791
|
+
* reader's.
|
|
12792
|
+
* {
|
|
12793
|
+
* table_id: the table (table_identity())
|
|
12794
|
+
* rows: [record, ...]
|
|
12795
|
+
* }
|
|
12796
|
+
************************************************************/
|
|
12797
|
+
function ac_load_table_rows(gobj, event, kw, src) {
|
|
12798
|
+
let table_id = kw.table_id;
|
|
12799
|
+
let $table = find_table(gobj, table_id);
|
|
12800
|
+
let tabulator = $table ? $table.tabulator : null;
|
|
12801
|
+
if (!tabulator) {
|
|
12802
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_LOAD_TABLE_ROWS to a table that is gone: '${table_id}'`);
|
|
12803
|
+
return -1;
|
|
12804
|
+
}
|
|
12805
|
+
if (!(0, _yuneta_gobj_js.is_array)(kw.rows)) {
|
|
12806
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_LOAD_TABLE_ROWS without rows: '${table_id}'`);
|
|
12807
|
+
return -1;
|
|
12808
|
+
}
|
|
12809
|
+
if (kw.rows.length === 0) return 0;
|
|
12810
|
+
let rows = (0, _yuneta_gobj_js.json_deep_copy)(kw.rows);
|
|
12132
12811
|
let added;
|
|
12133
|
-
|
|
12812
|
+
gobj.priv.loading_rows++;
|
|
12134
12813
|
try {
|
|
12135
|
-
added = tabulator.
|
|
12814
|
+
added = tabulator.addData(rows);
|
|
12136
12815
|
} finally {
|
|
12137
|
-
|
|
12138
|
-
}
|
|
12139
|
-
added.
|
|
12140
|
-
|
|
12141
|
-
let template = $table.template;
|
|
12142
|
-
Object.entries(template).forEach(([key, template_value]) => {
|
|
12143
|
-
if ((0, _yuneta_gobj_js.str_in_list)(template_value.flag, "table")) {
|
|
12144
|
-
let $table_nested = row.getElement().querySelector(`.yui-tabulator-table-nested[name="${key}"]`);
|
|
12145
|
-
if ($table_nested) load_tabulator_data(gobj, $table_nested, record[key]);
|
|
12146
|
-
else (0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: nested table not found '%s'", (0, _yuneta_gobj_js.gobj_short_name)(gobj), key));
|
|
12147
|
-
}
|
|
12148
|
-
});
|
|
12149
|
-
}
|
|
12150
|
-
}).catch(function(error) {
|
|
12151
|
-
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
|
|
12816
|
+
gobj.priv.loading_rows--;
|
|
12817
|
+
}
|
|
12818
|
+
added.catch(function(error) {
|
|
12819
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot load the rows of a table: ${error}`);
|
|
12152
12820
|
});
|
|
12153
|
-
|
|
12154
|
-
if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
|
|
12155
|
-
let $target = loading ? $table : $table.closest(".yui-tabulator-table");
|
|
12156
|
-
if ($target && $target.tabulator) $target.tabulator.redraw();
|
|
12157
|
-
}, 30);
|
|
12821
|
+
redraw_table_later(gobj, $table);
|
|
12158
12822
|
return 0;
|
|
12159
12823
|
}
|
|
12160
12824
|
/************************************************************
|
|
@@ -12344,6 +13008,11 @@ function create_gclass$17(gclass_name) {
|
|
|
12344
13008
|
ac_add_table_row,
|
|
12345
13009
|
null
|
|
12346
13010
|
],
|
|
13011
|
+
[
|
|
13012
|
+
"EV_LOAD_TABLE_ROWS",
|
|
13013
|
+
ac_load_table_rows,
|
|
13014
|
+
null
|
|
13015
|
+
],
|
|
12347
13016
|
[
|
|
12348
13017
|
"EV_RECORD_CHANGED",
|
|
12349
13018
|
ac_record_changed,
|
|
@@ -12416,6 +13085,7 @@ function create_gclass$17(gclass_name) {
|
|
|
12416
13085
|
["EV_UNDO_RECORD", 0],
|
|
12417
13086
|
["EV_CLEAR_RECORD", 0],
|
|
12418
13087
|
["EV_ADD_TABLE_ROW", 0],
|
|
13088
|
+
["EV_LOAD_TABLE_ROWS", 0],
|
|
12419
13089
|
["EV_RECORD_CHANGED", 0],
|
|
12420
13090
|
["EV_COPY_RECORD", 0],
|
|
12421
13091
|
["EV_PASTE_RECORD", 0],
|
|
@@ -15026,7 +15696,7 @@ function g6_event_kw(evt) {
|
|
|
15026
15696
|
* g6_canvas_tab_order.js
|
|
15027
15697
|
*
|
|
15028
15698
|
* The canvases of a G6 graph in the page's Tab order: the main
|
|
15029
|
-
* one in its place, the other layers out of it.
|
|
15699
|
+
* one in its place, and NAMED; the other layers out of it.
|
|
15030
15700
|
*
|
|
15031
15701
|
* G6 stacks four canvases (background, main, label, transient)
|
|
15032
15702
|
* and gives each of them `tabIndex = 1` (configCanvasDom, when it
|
|
@@ -15039,6 +15709,24 @@ function g6_event_kw(evt) {
|
|
|
15039
15709
|
* to the graph's toolbars and buttons in DOM order; the other
|
|
15040
15710
|
* layers receive nothing (`pointer-events: none`) and take -1.
|
|
15041
15711
|
*
|
|
15712
|
+
* A canvas in the Tab order is a control, and a control has a
|
|
15713
|
+
* name: the main canvas carries a `title` and an `aria-label`,
|
|
15714
|
+
* through t() and each with its key, that say WHICH graph it is
|
|
15715
|
+
* -- the key is the view's, one per gclass ("json graph",
|
|
15716
|
+
* "schema graph"...). From 7.26.28 to 7.26.41 Tab landed on it
|
|
15717
|
+
* and a reader announced nothing. The keys are what a language
|
|
15718
|
+
* switch reaches (refresh_language()), as on any control. It is
|
|
15719
|
+
* a `region`, as maplibre makes its own canvas: a name on an
|
|
15720
|
+
* element with no role is one ARIA forbids, and a reader is not
|
|
15721
|
+
* bound to say it.
|
|
15722
|
+
*
|
|
15723
|
+
* And it can be SEEN when it has the focus: G6 writes `outline:
|
|
15724
|
+
* none` on its canvases, inline, so a keyboard that Tabbed onto
|
|
15725
|
+
* the graph had no sign of where it was. The main canvas takes
|
|
15726
|
+
* the `G6_MAIN_CANVAS` class, and g6_canvas_tab_order.css --
|
|
15727
|
+
* imported here, so it comes with the module to every view --
|
|
15728
|
+
* draws a ring on it at `:focus-visible`.
|
|
15729
|
+
*
|
|
15042
15730
|
* Every view that creates a G6 Graph calls
|
|
15043
15731
|
* keep_canvas_tab_order() right after `new Graph()`: the order is
|
|
15044
15732
|
* put right each time G6 writes the 1 -- once the canvas is built
|
|
@@ -15051,10 +15739,11 @@ function g6_event_kw(evt) {
|
|
|
15051
15739
|
* All Rights Reserved.
|
|
15052
15740
|
***********************************************************************/
|
|
15053
15741
|
/************************************************************
|
|
15054
|
-
* Main canvas 0,
|
|
15055
|
-
*
|
|
15742
|
+
* Main canvas 0, named by `name_key`, and marked for its
|
|
15743
|
+
* focus ring; every other layer -1. Returns 0, or -1 with the
|
|
15744
|
+
* cause logged.
|
|
15056
15745
|
************************************************************/
|
|
15057
|
-
function set_canvas_tab_order(gobj, graph) {
|
|
15746
|
+
function set_canvas_tab_order(gobj, graph, name_key) {
|
|
15058
15747
|
let canvas = graph ? graph.getCanvas() : null;
|
|
15059
15748
|
if (!canvas || typeof canvas.getLayers !== "function") {
|
|
15060
15749
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: no canvas to set the Tab order of`);
|
|
@@ -15074,17 +15763,27 @@ function set_canvas_tab_order(gobj, graph) {
|
|
|
15074
15763
|
ret = -1;
|
|
15075
15764
|
continue;
|
|
15076
15765
|
}
|
|
15077
|
-
|
|
15766
|
+
if (name !== "main") {
|
|
15767
|
+
$el.tabIndex = -1;
|
|
15768
|
+
continue;
|
|
15769
|
+
}
|
|
15770
|
+
$el.tabIndex = 0;
|
|
15771
|
+
$el.classList.add("G6_MAIN_CANVAS");
|
|
15772
|
+
$el.setAttribute("role", "region");
|
|
15773
|
+
$el.setAttribute("title", (0, i18next.t)(name_key));
|
|
15774
|
+
$el.setAttribute("data-i18n-title", name_key);
|
|
15775
|
+
$el.setAttribute("aria-label", (0, i18next.t)(name_key));
|
|
15776
|
+
$el.setAttribute("data-i18n-aria-label", name_key);
|
|
15078
15777
|
}
|
|
15079
15778
|
return ret;
|
|
15080
15779
|
}
|
|
15081
15780
|
/************************************************************
|
|
15082
|
-
* Keep the order for the life of `graph`: on
|
|
15083
|
-
* writes its own.
|
|
15781
|
+
* Keep the order, and the name, for the life of `graph`: on
|
|
15782
|
+
* every moment G6 writes its own.
|
|
15084
15783
|
************************************************************/
|
|
15085
|
-
function keep_canvas_tab_order(gobj, graph) {
|
|
15784
|
+
function keep_canvas_tab_order(gobj, graph, name_key) {
|
|
15086
15785
|
for (let ev of [_antv_g6.GraphEvent.AFTER_CANVAS_INIT, _antv_g6.GraphEvent.AFTER_RENDERER_CHANGE]) graph.on(ev, () => {
|
|
15087
|
-
set_canvas_tab_order(gobj, graph);
|
|
15786
|
+
set_canvas_tab_order(gobj, graph, name_key);
|
|
15088
15787
|
});
|
|
15089
15788
|
}
|
|
15090
15789
|
//#endregion
|
|
@@ -15593,7 +16292,7 @@ function build_graph$4(gobj) {
|
|
|
15593
16292
|
behaviors: BEHAVIORS_READING$1.slice()
|
|
15594
16293
|
});
|
|
15595
16294
|
if (priv.theme) graph.setTheme(priv.theme);
|
|
15596
|
-
keep_canvas_tab_order(gobj, graph);
|
|
16295
|
+
keep_canvas_tab_order(gobj, graph, "json graph");
|
|
15597
16296
|
graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
|
|
15598
16297
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
|
|
15599
16298
|
});
|
|
@@ -19513,7 +20212,7 @@ function build_graph$3(gobj) {
|
|
|
19513
20212
|
} catch (e) {
|
|
19514
20213
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the theme was refused: ${e}`);
|
|
19515
20214
|
}
|
|
19516
|
-
keep_canvas_tab_order(gobj, priv.graph);
|
|
20215
|
+
keep_canvas_tab_order(gobj, priv.graph, "fsm graph");
|
|
19517
20216
|
priv.graph.on("aftertransform", () => {
|
|
19518
20217
|
yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
|
|
19519
20218
|
});
|
|
@@ -22156,6 +22855,17 @@ function close_gclass_view(handle) {
|
|
|
22156
22855
|
* lands BEHIND its opener whatever number it is given, and
|
|
22157
22856
|
* the button reads as one that did nothing.
|
|
22158
22857
|
*
|
|
22858
|
+
* An opener in the place the shell gives every window -- its
|
|
22859
|
+
* window layer, the body while there is none -- gives the
|
|
22860
|
+
* viewer no `$parent` at all: the viewer takes that place too,
|
|
22861
|
+
* and FOLLOWS the shell with its opener (C_YUI_WINDOW's
|
|
22862
|
+
* ac_shell_changed). Up to 7.26.41 it was handed that element
|
|
22863
|
+
* by name, and a name is a choice its host made: a viewer
|
|
22864
|
+
* opened from the developer window between a logout and the
|
|
22865
|
+
* next login was told "the body", and stayed there after the
|
|
22866
|
+
* login -- above the new shell's dialogs -- while its opener
|
|
22867
|
+
* moved into the shell.
|
|
22868
|
+
*
|
|
22159
22869
|
* Opened from no window: null -- the window layer of the
|
|
22160
22870
|
* shell, where every window lives (the legacy '#top-layer'
|
|
22161
22871
|
* when a page has one). It was the shell's popup layer: above
|
|
@@ -22165,7 +22875,11 @@ function window_layer_of(host) {
|
|
|
22165
22875
|
let $c = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(host, "$container");
|
|
22166
22876
|
if ($c && typeof $c.closest === "function") {
|
|
22167
22877
|
let $win = $c.closest(".C_YUI_WINDOW");
|
|
22168
|
-
if ($win && $win.parentNode)
|
|
22878
|
+
if ($win && $win.parentNode) {
|
|
22879
|
+
let $shell_place = yui_shell_window_layer(yui_shell_of(host)) || document.body;
|
|
22880
|
+
if ($win.parentNode === $shell_place) return null;
|
|
22881
|
+
return $win.parentNode;
|
|
22882
|
+
}
|
|
22169
22883
|
}
|
|
22170
22884
|
return typeof document !== "undefined" && document.getElementById("top-layer") || null;
|
|
22171
22885
|
}
|
|
@@ -23026,7 +23740,7 @@ function build_graph$2(gobj) {
|
|
|
23026
23740
|
behaviors: BEHAVIORS_READING.slice()
|
|
23027
23741
|
});
|
|
23028
23742
|
if (priv.theme) graph.setTheme(priv.theme);
|
|
23029
|
-
keep_canvas_tab_order(gobj, graph);
|
|
23743
|
+
keep_canvas_tab_order(gobj, graph, "gobj tree graph");
|
|
23030
23744
|
graph.on("aftertransform", () => {
|
|
23031
23745
|
yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
|
|
23032
23746
|
let z = priv.last_zoom;
|
|
@@ -24614,16 +25328,17 @@ function card_descriptor(it, show_label, badge_of) {
|
|
|
24614
25328
|
text_node(label)
|
|
24615
25329
|
]);
|
|
24616
25330
|
if (badge && !pinned) children.push(badge);
|
|
25331
|
+
let name_key = label || it.aria_label || it.id || "";
|
|
24617
25332
|
let a_attrs = {
|
|
24618
25333
|
class: "yui-nav-item yui-nav-card",
|
|
24619
25334
|
href: it.route ? "#" + it.route : "#",
|
|
24620
25335
|
"data-item-id": it.id,
|
|
24621
25336
|
"data-route": it.route || "",
|
|
24622
25337
|
"data-disabled": it.disabled ? "1" : "0",
|
|
24623
|
-
"aria-label":
|
|
25338
|
+
"aria-label": name_key
|
|
24624
25339
|
};
|
|
24625
|
-
if (
|
|
24626
|
-
let tip = it.tooltip || it.aria_label ||
|
|
25340
|
+
if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
|
|
25341
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
24627
25342
|
if (tip) {
|
|
24628
25343
|
a_attrs.title = tip;
|
|
24629
25344
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -25022,15 +25737,15 @@ function render_tabs(gobj, items) {
|
|
|
25022
25737
|
"aria-hidden": "true"
|
|
25023
25738
|
}]
|
|
25024
25739
|
]);
|
|
25025
|
-
let
|
|
25740
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
25026
25741
|
let a_attrs = {
|
|
25027
25742
|
href: it.route ? "#" + it.route : "#",
|
|
25028
25743
|
"data-item-id": it.id,
|
|
25029
25744
|
"data-route": it.route || "",
|
|
25030
|
-
"aria-label":
|
|
25745
|
+
"aria-label": name_key
|
|
25031
25746
|
};
|
|
25032
|
-
if (
|
|
25033
|
-
let tip = it.tooltip || it.aria_label ||
|
|
25747
|
+
if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
|
|
25748
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
25034
25749
|
if (tip) {
|
|
25035
25750
|
a_attrs.title = tip;
|
|
25036
25751
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -25110,16 +25825,17 @@ function render_breadcrumb(gobj, items) {
|
|
|
25110
25825
|
text_node(label)
|
|
25111
25826
|
]);
|
|
25112
25827
|
}
|
|
25828
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
25113
25829
|
let a_attrs = {
|
|
25114
25830
|
class: "yui-nav-item yui-nav-crumb",
|
|
25115
25831
|
href: it.route ? "#" + it.route : "#",
|
|
25116
25832
|
"data-item-id": it.id,
|
|
25117
25833
|
"data-route": it.route || "",
|
|
25118
25834
|
"data-disabled": it.disabled ? "1" : "0",
|
|
25119
|
-
"aria-label":
|
|
25835
|
+
"aria-label": name_key
|
|
25120
25836
|
};
|
|
25121
|
-
if (
|
|
25122
|
-
let tip = it.tooltip || it.aria_label ||
|
|
25837
|
+
if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
|
|
25838
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
25123
25839
|
if (tip) {
|
|
25124
25840
|
a_attrs.title = tip;
|
|
25125
25841
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -25256,12 +25972,14 @@ function render_accordion(gobj, items) {
|
|
|
25256
25972
|
"aria-controls": body_id
|
|
25257
25973
|
};
|
|
25258
25974
|
let head_badge = item_badge_node(gobj, it, false);
|
|
25259
|
-
if (!(0, _yuneta_gobj_js.empty_string)(head_text))
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
head_attrs
|
|
25264
|
-
head_attrs["data-i18n-
|
|
25975
|
+
if (!(0, _yuneta_gobj_js.empty_string)(head_text)) head_attrs.i18n = head_text;
|
|
25976
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
25977
|
+
if (!(0, _yuneta_gobj_js.empty_string)(name_key)) {
|
|
25978
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
25979
|
+
head_attrs.title = tip;
|
|
25980
|
+
head_attrs["data-i18n-title"] = tip;
|
|
25981
|
+
head_attrs["aria-label"] = name_key;
|
|
25982
|
+
head_attrs["data-i18n-aria-label"] = name_key;
|
|
25265
25983
|
name_control_with_badge(head_attrs, head_badge);
|
|
25266
25984
|
}
|
|
25267
25985
|
let $hdr = (0, _yuneta_gobj_js.createElement2)([
|
|
@@ -25337,17 +26055,17 @@ function item_li(gobj, it, opts) {
|
|
|
25337
26055
|
if (label_el) children.push(label_el);
|
|
25338
26056
|
if (!pinned) children.push(badge_el);
|
|
25339
26057
|
}
|
|
25340
|
-
let
|
|
26058
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
25341
26059
|
let a_attrs = {
|
|
25342
26060
|
class: a_class,
|
|
25343
26061
|
href: it.route ? "#" + it.route : "#",
|
|
25344
26062
|
"data-item-id": it.id,
|
|
25345
26063
|
"data-route": it.route || "",
|
|
25346
26064
|
"data-disabled": it.disabled ? "1" : "0",
|
|
25347
|
-
"aria-label":
|
|
26065
|
+
"aria-label": name_key
|
|
25348
26066
|
};
|
|
25349
|
-
if (
|
|
25350
|
-
let tip = it.tooltip || it.aria_label ||
|
|
26067
|
+
if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
|
|
26068
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
25351
26069
|
if (tip) {
|
|
25352
26070
|
a_attrs.title = tip;
|
|
25353
26071
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -25390,15 +26108,16 @@ function item_iconbar(gobj, it, opts) {
|
|
|
25390
26108
|
if (label_el) children.push(label_el);
|
|
25391
26109
|
}
|
|
25392
26110
|
if (!pinned) children.push(badge_el);
|
|
26111
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
25393
26112
|
let a_attrs = {
|
|
25394
26113
|
class: "yui-nav-item yui-nav-stacked",
|
|
25395
26114
|
href: it.route ? "#" + it.route : "#",
|
|
25396
26115
|
"data-item-id": it.id,
|
|
25397
26116
|
"data-route": it.route || "",
|
|
25398
|
-
"aria-label":
|
|
26117
|
+
"aria-label": name_key
|
|
25399
26118
|
};
|
|
25400
|
-
if (
|
|
25401
|
-
let tip = it.tooltip || it.aria_label ||
|
|
26119
|
+
if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
|
|
26120
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
25402
26121
|
if (tip) {
|
|
25403
26122
|
a_attrs.title = tip;
|
|
25404
26123
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -25666,7 +26385,12 @@ function render_node(node) {
|
|
|
25666
26385
|
"aria-hidden": "true"
|
|
25667
26386
|
}]]
|
|
25668
26387
|
]);
|
|
25669
|
-
row.push([
|
|
26388
|
+
if (node.label && node.data_label) row.push([
|
|
26389
|
+
"span",
|
|
26390
|
+
{ class: "ROUTEMAP_NAME" },
|
|
26391
|
+
text_node(node.label)
|
|
26392
|
+
]);
|
|
26393
|
+
else if (node.label) row.push([
|
|
25670
26394
|
"span",
|
|
25671
26395
|
{
|
|
25672
26396
|
class: "ROUTEMAP_NAME",
|
|
@@ -25719,10 +26443,10 @@ function render_node(node) {
|
|
|
25719
26443
|
href: "#" + node.route,
|
|
25720
26444
|
title: node.route
|
|
25721
26445
|
};
|
|
25722
|
-
if (node.label) {
|
|
26446
|
+
if (node.label && !node.data_label) {
|
|
25723
26447
|
a_attrs["aria-label"] = node.label;
|
|
25724
26448
|
a_attrs["data-i18n-aria-label"] = node.label;
|
|
25725
|
-
}
|
|
26449
|
+
} else a_attrs["aria-label"] = node.label || node.route;
|
|
25726
26450
|
if (node.current) a_attrs["aria-current"] = "page";
|
|
25727
26451
|
$row = (0, _yuneta_gobj_js.createElement2)([
|
|
25728
26452
|
"a",
|
|
@@ -62883,7 +63607,7 @@ function build_graph$1(gobj) {
|
|
|
62883
63607
|
plugins: []
|
|
62884
63608
|
});
|
|
62885
63609
|
graph.setTheme(priv.theme);
|
|
62886
|
-
keep_canvas_tab_order(gobj, graph);
|
|
63610
|
+
keep_canvas_tab_order(gobj, graph, "treedb graph");
|
|
62887
63611
|
priv._unforward_wheel = yui_graph_forward_wheel(graph, priv.$container, { selector: ".TREEDB_CARD, .TREEDB_PILLS" });
|
|
62888
63612
|
graph.setLayout(layout);
|
|
62889
63613
|
priv.graph_rendered = false;
|
|
@@ -74572,7 +75296,7 @@ function build_graph(gobj) {
|
|
|
74572
75296
|
}
|
|
74573
75297
|
priv.graph = graph;
|
|
74574
75298
|
graph.setTheme(dark ? "dark" : "light");
|
|
74575
|
-
keep_canvas_tab_order(gobj, graph);
|
|
75299
|
+
keep_canvas_tab_order(gobj, graph, "schema graph");
|
|
74576
75300
|
graph.on("aftertransform", () => {
|
|
74577
75301
|
yui_graph_update_zoom($container, priv.graph);
|
|
74578
75302
|
});
|
|
@@ -76665,6 +77389,7 @@ var PRIVATE_DATA$1 = {
|
|
|
76665
77389
|
host_ids: null,
|
|
76666
77390
|
order_undo: null,
|
|
76667
77391
|
diagram_gobj: null,
|
|
77392
|
+
retired_diagrams: null,
|
|
76668
77393
|
dialog: null,
|
|
76669
77394
|
dialog_gen: 0,
|
|
76670
77395
|
dialog_kind: "",
|
|
@@ -76687,6 +77412,7 @@ var PRIVATE_DATA$1 = {
|
|
|
76687
77412
|
export_view: null
|
|
76688
77413
|
};
|
|
76689
77414
|
var __gclass__$1 = null;
|
|
77415
|
+
var __described_seq__ = 0;
|
|
76690
77416
|
/******************************
|
|
76691
77417
|
* Framework Methods
|
|
76692
77418
|
******************************/
|
|
@@ -76700,6 +77426,7 @@ function mt_create$1(gobj) {
|
|
|
76700
77426
|
priv.host_drafts = {};
|
|
76701
77427
|
priv.host_ids = {};
|
|
76702
77428
|
priv.save_queue = [];
|
|
77429
|
+
priv.retired_diagrams = [];
|
|
76703
77430
|
build_ui$1(gobj);
|
|
76704
77431
|
let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
|
|
76705
77432
|
if (!subscriber) subscriber = (0, _yuneta_gobj_js.gobj_parent)(gobj);
|
|
@@ -76721,6 +77448,7 @@ function mt_stop$1(gobj) {
|
|
|
76721
77448
|
if (shell) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
76722
77449
|
close_dialog(gobj);
|
|
76723
77450
|
destroy_diagram(gobj);
|
|
77451
|
+
destroy_retired_diagrams(gobj);
|
|
76724
77452
|
}
|
|
76725
77453
|
/***************************************************************
|
|
76726
77454
|
* Framework Method: Destroy
|
|
@@ -77487,6 +78215,15 @@ function render(gobj) {
|
|
|
77487
78215
|
* A card that opens something, with its own logical name. The
|
|
77488
78216
|
* cards grid is the shell's, so a schema card and a nav card
|
|
77489
78217
|
* look alike on purpose.
|
|
78218
|
+
*
|
|
78219
|
+
* `title` is the card's name: `{i18n: key}`, or `{text: data}` for
|
|
78220
|
+
* a name no locale holds (a treedb's id). The card is a control --
|
|
78221
|
+
* a role=button that Enter and Space press -- and a control is
|
|
78222
|
+
* NAMED: a title and an aria-label, with their keys when the name
|
|
78223
|
+
* is one, and its tags (the counts) as its description, which an
|
|
78224
|
+
* aria-label alone would hide from a reader. Up to 7.26.41 it had
|
|
78225
|
+
* neither, and the orphans card was handed its name translated,
|
|
78226
|
+
* in the language it was drawn in for good.
|
|
77490
78227
|
***************************************************************/
|
|
77491
78228
|
function open_card(gobj, logical, title, icon, tags, event, kw) {
|
|
77492
78229
|
let $tags = tags.map((tag) => {
|
|
@@ -77504,13 +78241,36 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
|
|
|
77504
78241
|
]] : `${tag.text}`
|
|
77505
78242
|
];
|
|
77506
78243
|
});
|
|
78244
|
+
let tags_id = `yui-schema-described-${++__described_seq__}`;
|
|
78245
|
+
let card_attrs = {
|
|
78246
|
+
class: `${logical} yui-nav-card card`,
|
|
78247
|
+
role: "button",
|
|
78248
|
+
tabindex: "0",
|
|
78249
|
+
"aria-describedby": tags_id
|
|
78250
|
+
};
|
|
78251
|
+
let $name;
|
|
78252
|
+
if (title.i18n) {
|
|
78253
|
+
Object.assign(card_attrs, name_attrs(title.i18n, {}));
|
|
78254
|
+
$name = [
|
|
78255
|
+
"span",
|
|
78256
|
+
{
|
|
78257
|
+
class: `${logical}_NAME has-text-weight-semibold`,
|
|
78258
|
+
i18n: title.i18n
|
|
78259
|
+
},
|
|
78260
|
+
(0, i18next.t)(title.i18n)
|
|
78261
|
+
];
|
|
78262
|
+
} else {
|
|
78263
|
+
card_attrs.title = String(title.text);
|
|
78264
|
+
card_attrs["aria-label"] = String(title.text);
|
|
78265
|
+
$name = [
|
|
78266
|
+
"span",
|
|
78267
|
+
{ class: `${logical}_NAME has-text-weight-semibold` },
|
|
78268
|
+
text_node(title.text)
|
|
78269
|
+
];
|
|
78270
|
+
}
|
|
77507
78271
|
return [
|
|
77508
78272
|
"div",
|
|
77509
|
-
|
|
77510
|
-
class: `${logical} yui-nav-card card`,
|
|
77511
|
-
role: "button",
|
|
77512
|
-
tabindex: "0"
|
|
77513
|
-
},
|
|
78273
|
+
card_attrs,
|
|
77514
78274
|
[[
|
|
77515
78275
|
"div",
|
|
77516
78276
|
{ class: `${logical}_BODY card-content p-3` },
|
|
@@ -77523,16 +78283,16 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
|
|
|
77523
78283
|
[[
|
|
77524
78284
|
"span",
|
|
77525
78285
|
{ class: "icon" },
|
|
77526
|
-
[["i", {
|
|
77527
|
-
|
|
77528
|
-
|
|
77529
|
-
|
|
77530
|
-
|
|
77531
|
-
]]
|
|
78286
|
+
[["i", {
|
|
78287
|
+
class: icon,
|
|
78288
|
+
"aria-hidden": "true"
|
|
78289
|
+
}]]
|
|
78290
|
+
], $name]
|
|
77532
78291
|
], [
|
|
77533
78292
|
"div",
|
|
77534
78293
|
{
|
|
77535
78294
|
class: `${logical}_TAGS tags mt-2`,
|
|
78295
|
+
id: tags_id,
|
|
77536
78296
|
style: "gap:.25rem;"
|
|
77537
78297
|
},
|
|
77538
78298
|
$tags
|
|
@@ -77580,9 +78340,9 @@ function render_treedbs(gobj, $body) {
|
|
|
77580
78340
|
style: "is-warning is-light"
|
|
77581
78341
|
}] : []
|
|
77582
78342
|
];
|
|
77583
|
-
$cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", treedb.id, "yi-database", tags, "EV_SELECT_TREEDB", { treedb: treedb.id }));
|
|
78343
|
+
$cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", { text: treedb.id }, "yi-database", tags, "EV_SELECT_TREEDB", { treedb: treedb.id }));
|
|
77584
78344
|
}
|
|
77585
|
-
if (priv.model.orphan_topics.length > 0 || priv.model.orphan_cols.length > 0) $cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD",
|
|
78345
|
+
if (priv.model.orphan_topics.length > 0 || priv.model.orphan_cols.length > 0) $cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD", { i18n: "orphans" }, "yi-triangle-exclamation", [{
|
|
77586
78346
|
i18n: "topics",
|
|
77587
78347
|
text: priv.model.orphan_topics.length
|
|
77588
78348
|
}, {
|
|
@@ -77623,22 +78383,33 @@ function render_topics(gobj, $body) {
|
|
|
77623
78383
|
$actions.push(row_icon(gobj, "SCHEMA_TOPIC_EDIT", "yi-pen", "edit topic", "EV_EDIT_TOPIC", { topic: address }));
|
|
77624
78384
|
$actions.push(row_icon(gobj, "SCHEMA_TOPIC_DELETE", "yi-trash", "delete topic", "EV_DELETE_TOPIC", { topic: address }));
|
|
77625
78385
|
}
|
|
78386
|
+
let open_attrs = {
|
|
78387
|
+
class: "SCHEMA_TOPIC_OPEN has-text-weight-semibold",
|
|
78388
|
+
type: "button",
|
|
78389
|
+
title: topic.name,
|
|
78390
|
+
"aria-label": topic.name
|
|
78391
|
+
};
|
|
78392
|
+
let id_attrs = { class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet" };
|
|
78393
|
+
if (ambiguous) {
|
|
78394
|
+
id_attrs.id = `yui-schema-described-${++__described_seq__}`;
|
|
78395
|
+
open_attrs["aria-describedby"] = id_attrs.id;
|
|
78396
|
+
}
|
|
77626
78397
|
$rows.push([
|
|
77627
78398
|
"tr",
|
|
77628
|
-
{
|
|
77629
|
-
class: "SCHEMA_TOPIC_ROW",
|
|
77630
|
-
role: "button",
|
|
77631
|
-
tabindex: "0"
|
|
77632
|
-
},
|
|
78399
|
+
{ class: "SCHEMA_TOPIC_ROW" },
|
|
77633
78400
|
[
|
|
77634
78401
|
[
|
|
77635
78402
|
"td",
|
|
77636
78403
|
{ class: "SCHEMA_TOPIC_NAME" },
|
|
77637
78404
|
[
|
|
77638
78405
|
[
|
|
77639
|
-
"
|
|
77640
|
-
|
|
77641
|
-
text_node(topic.name)
|
|
78406
|
+
"button",
|
|
78407
|
+
open_attrs,
|
|
78408
|
+
text_node(topic.name),
|
|
78409
|
+
{ click: (evt) => {
|
|
78410
|
+
evt.stopPropagation();
|
|
78411
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
|
|
78412
|
+
} }
|
|
77642
78413
|
],
|
|
77643
78414
|
topic.system_topic ? [
|
|
77644
78415
|
"span",
|
|
@@ -77668,7 +78439,7 @@ function render_topics(gobj, $body) {
|
|
|
77668
78439
|
],
|
|
77669
78440
|
ambiguous ? [
|
|
77670
78441
|
"div",
|
|
77671
|
-
|
|
78442
|
+
id_attrs,
|
|
77672
78443
|
[[
|
|
77673
78444
|
"code",
|
|
77674
78445
|
{},
|
|
@@ -77710,17 +78481,10 @@ function render_topics(gobj, $body) {
|
|
|
77710
78481
|
$actions
|
|
77711
78482
|
]
|
|
77712
78483
|
],
|
|
77713
|
-
{
|
|
77714
|
-
|
|
77715
|
-
|
|
77716
|
-
|
|
77717
|
-
},
|
|
77718
|
-
keydown: (evt) => {
|
|
77719
|
-
if (evt.key !== "Enter" && evt.key !== " ") return;
|
|
77720
|
-
evt.preventDefault();
|
|
77721
|
-
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
|
|
77722
|
-
}
|
|
77723
|
-
}
|
|
78484
|
+
{ click: (evt) => {
|
|
78485
|
+
if (evt.target.closest(".SCHEMA_TOPIC_ACTIONS")) return;
|
|
78486
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
|
|
78487
|
+
} }
|
|
77724
78488
|
]);
|
|
77725
78489
|
}
|
|
77726
78490
|
let $table = (0, _yuneta_gobj_js.createElement2)([
|
|
@@ -78200,12 +78964,29 @@ function render_diagram(gobj) {
|
|
|
78200
78964
|
(0, _yuneta_gobj_js.gobj_start)(diagram);
|
|
78201
78965
|
(0, _yuneta_gobj_js.gobj_send_event)(diagram, "EV_SHOW", {}, gobj);
|
|
78202
78966
|
}
|
|
78967
|
+
/***************************************************************
|
|
78968
|
+
* The drawing leaves the screen at once and is destroyed on the
|
|
78969
|
+
* next turn (EV_DESTROY_DIAGRAMS). It can be leaving because of
|
|
78970
|
+
* its own node click, which it publishes from inside G6's dispatch
|
|
78971
|
+
* of that click: stopped there, the gobj went from under its own
|
|
78972
|
+
* publication and the G6 graph from under its own event.
|
|
78973
|
+
***************************************************************/
|
|
78203
78974
|
function destroy_diagram(gobj) {
|
|
78204
78975
|
let priv = gobj.priv;
|
|
78205
78976
|
if (!priv.diagram_gobj) return;
|
|
78206
|
-
|
|
78207
|
-
(0, _yuneta_gobj_js.gobj_destroy)(priv.diagram_gobj);
|
|
78977
|
+
let diagram = priv.diagram_gobj;
|
|
78208
78978
|
priv.diagram_gobj = null;
|
|
78979
|
+
let $d = (0, _yuneta_gobj_js.gobj_read_attr)(diagram, "$container");
|
|
78980
|
+
if ($d && $d.parentNode) $d.parentNode.removeChild($d);
|
|
78981
|
+
priv.retired_diagrams.push(diagram);
|
|
78982
|
+
if (priv.retired_diagrams.length === 1) (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_DESTROY_DIAGRAMS", {}, gobj);
|
|
78983
|
+
}
|
|
78984
|
+
function destroy_retired_diagrams(gobj) {
|
|
78985
|
+
let priv = gobj.priv;
|
|
78986
|
+
for (let diagram of priv.retired_diagrams.splice(0)) {
|
|
78987
|
+
if ((0, _yuneta_gobj_js.gobj_is_running)(diagram)) (0, _yuneta_gobj_js.gobj_stop)(diagram);
|
|
78988
|
+
(0, _yuneta_gobj_js.gobj_destroy)(diagram);
|
|
78989
|
+
}
|
|
78209
78990
|
}
|
|
78210
78991
|
/***************************
|
|
78211
78992
|
* The forms
|
|
@@ -80194,6 +80975,13 @@ function ac_node_click(gobj, event, kw, src) {
|
|
|
80194
80975
|
go(gobj, gobj.priv.treedb_id, topic, false, true);
|
|
80195
80976
|
return reload_after_move(gobj);
|
|
80196
80977
|
}
|
|
80978
|
+
/***************************************************************
|
|
80979
|
+
* The drawings left on the previous turn (destroy_diagram()).
|
|
80980
|
+
***************************************************************/
|
|
80981
|
+
function ac_destroy_diagrams(gobj, event, kw, src) {
|
|
80982
|
+
destroy_retired_diagrams(gobj);
|
|
80983
|
+
return 0;
|
|
80984
|
+
}
|
|
80197
80985
|
function ac_show_orphans(gobj, event, kw, src) {
|
|
80198
80986
|
if (reload_first(gobj, event)) return -1;
|
|
80199
80987
|
open_orphans(gobj);
|
|
@@ -80838,6 +81626,11 @@ function create_gclass$1(gclass_name) {
|
|
|
80838
81626
|
"EV_EXPORT_VIEW",
|
|
80839
81627
|
ac_export_view,
|
|
80840
81628
|
null
|
|
81629
|
+
],
|
|
81630
|
+
[
|
|
81631
|
+
"EV_DESTROY_DIAGRAMS",
|
|
81632
|
+
ac_destroy_diagrams,
|
|
81633
|
+
null
|
|
80841
81634
|
]
|
|
80842
81635
|
];
|
|
80843
81636
|
const TREEDB_WIDE = [
|
|
@@ -81055,6 +81848,7 @@ function create_gclass$1(gclass_name) {
|
|
|
81055
81848
|
["EV_APPLY_IMPORT", 0],
|
|
81056
81849
|
["EV_CONFIRMED", 0],
|
|
81057
81850
|
["EV_NODE_CLICK", 0],
|
|
81851
|
+
["EV_DESTROY_DIAGRAMS", 0],
|
|
81058
81852
|
["EV_POSITION_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
81059
81853
|
["EV_RECORD_WRITTEN", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
81060
81854
|
["EV_SCHEMA_CHECKED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS]
|