@yuneta/gobj-ui 7.26.48 → 7.26.49
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 +133 -31
- package/dist/gobj-ui.cjs.js +288 -14
- package/dist/gobj-ui.es.js +288 -14
- package/package.json +2 -2
- package/scripts/validate-locales.mjs +734 -76
- package/src/c_yui_form.js +63 -5
- package/src/c_yui_gobj_tree_js.js +37 -4
- package/src/c_yui_shell.js +311 -0
- package/src/form_table_rows.wiring.test.js +32 -0
- package/src/form_time_cell_editor.js +20 -5
- package/src/form_time_cell_editor.test.js +73 -0
- package/src/form_time_field.wiring.test.js +71 -0
- package/src/gobj_tree_camera.wiring.test.js +185 -0
- package/src/overlay_marker_after_back.wiring.test.js +3 -0
- package/src/shell_focus_trap.js +21 -0
- package/src/shell_focus_trap.test.js +52 -0
- package/src/shell_history_debt.wiring.test.js +456 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -148,6 +148,10 @@ function yui_tint(colour) {
|
|
|
148
148
|
* stack, which was for good: a panel that only moved (taken out
|
|
149
149
|
* and put back, its trap never released) lost its trap. It is
|
|
150
150
|
* skipped now, and leaves the stack only by its release().
|
|
151
|
+
* The first time a trap is skipped it is said, once: a panel out
|
|
152
|
+
* of the document whose owner is gone keeps its keydown listener
|
|
153
|
+
* until a release() that will never come, and up to gobj-ui
|
|
154
|
+
* 7.26.48 nothing said so (twenty such panels, twenty listeners).
|
|
151
155
|
*
|
|
152
156
|
* No gobj dependency: only gobj-js's logger. The optional
|
|
153
157
|
* second argument lets callers inject a mock document object
|
|
@@ -162,9 +166,16 @@ function top_trap() {
|
|
|
162
166
|
for (let i = __trap_stack__.length - 1; i >= 0; i--) {
|
|
163
167
|
let trap = __trap_stack__[i];
|
|
164
168
|
if (trap.$panel.isConnected !== false) return trap;
|
|
169
|
+
if (!trap.said_skipped) {
|
|
170
|
+
trap.said_skipped = true;
|
|
171
|
+
(0, _yuneta_gobj_js.log_warning)(`focus trap: its panel (${panel_name(trap.$panel)}) is out of the document and the trap was not released; it is skipped, and its listener stays until its release() (an owner torn down with it open?)`);
|
|
172
|
+
}
|
|
165
173
|
}
|
|
166
174
|
return null;
|
|
167
175
|
}
|
|
176
|
+
function panel_name($panel) {
|
|
177
|
+
return (typeof $panel.className === "string" ? $panel.className.trim() : "") || "a panel with no class";
|
|
178
|
+
}
|
|
168
179
|
function is_drawn(el) {
|
|
169
180
|
if (typeof el.checkVisibility === "function") return el.checkVisibility();
|
|
170
181
|
if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
|
|
@@ -1216,6 +1227,8 @@ function secondary_nav_renders(item, layout) {
|
|
|
1216
1227
|
var GCLASS_NAME$22 = "C_YUI_SHELL";
|
|
1217
1228
|
var __live_shells__ = [];
|
|
1218
1229
|
var __retiring_shell__ = null;
|
|
1230
|
+
var __dead_entries__ = /* @__PURE__ */ new Set();
|
|
1231
|
+
var __orphan_back__ = null;
|
|
1219
1232
|
var __shell_watchers__ = [];
|
|
1220
1233
|
var __window_z__ = 10;
|
|
1221
1234
|
var ZONE_IDS = [
|
|
@@ -1281,6 +1294,7 @@ var PRIVATE_DATA$22 = {
|
|
|
1281
1294
|
deferred_timer: null,
|
|
1282
1295
|
expected_pop_ids: [],
|
|
1283
1296
|
given_up: null,
|
|
1297
|
+
own_entries: [],
|
|
1284
1298
|
popstate_handler: null,
|
|
1285
1299
|
avatar_provider: null,
|
|
1286
1300
|
avatar_nodes: [],
|
|
@@ -1381,6 +1395,7 @@ function mt_start$21(gobj) {
|
|
|
1381
1395
|
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
|
|
1382
1396
|
}
|
|
1383
1397
|
p.restore_hash = "";
|
|
1398
|
+
if (retire_dead_entries(gobj)) return;
|
|
1384
1399
|
push_pending_markers(gobj);
|
|
1385
1400
|
}
|
|
1386
1401
|
return;
|
|
@@ -1406,6 +1421,8 @@ function mt_start$21(gobj) {
|
|
|
1406
1421
|
}
|
|
1407
1422
|
};
|
|
1408
1423
|
window.addEventListener("popstate", priv.popstate_handler);
|
|
1424
|
+
keep_dead_entries_across_reload();
|
|
1425
|
+
adopt_orphan_back(gobj);
|
|
1409
1426
|
}
|
|
1410
1427
|
priv.keydown_handler = (ev) => {
|
|
1411
1428
|
if (ev.key !== "Escape" && ev.keyCode !== 27) return;
|
|
@@ -1427,6 +1444,7 @@ function mt_start$21(gobj) {
|
|
|
1427
1444
|
show_stage_placeholder(gobj, "main", "C_YUI_SHELL: no route to display (empty hash, no default_route, no stages.main.default_route)");
|
|
1428
1445
|
(0, _yuneta_gobj_js.log_error)("C_YUI_SHELL: no initial route — set default_route, shell.stages.<name>.default_route, or navigate via hash");
|
|
1429
1446
|
}
|
|
1447
|
+
if (priv.popstate_handler) retire_dead_entries(gobj);
|
|
1430
1448
|
}
|
|
1431
1449
|
/***************************************************************
|
|
1432
1450
|
* Framework Method: Stop
|
|
@@ -1436,6 +1454,7 @@ function mt_stop$20(gobj) {
|
|
|
1436
1454
|
if (!priv) return 0;
|
|
1437
1455
|
retire_overlays(gobj);
|
|
1438
1456
|
close_toolbar_dropdown(gobj);
|
|
1457
|
+
if (priv.popstate_handler) hand_over_history(gobj);
|
|
1439
1458
|
if (priv.hash_handler) {
|
|
1440
1459
|
window.removeEventListener("hashchange", priv.hash_handler);
|
|
1441
1460
|
priv.hash_handler = null;
|
|
@@ -1996,6 +2015,8 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
1996
2015
|
if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash")) {
|
|
1997
2016
|
if (!!!(priv.stages && priv.stages.main && priv.stages.main.active_route) && prev && prev !== route) {
|
|
1998
2017
|
navigate_to(gobj, prev, depth + 1, true);
|
|
2018
|
+
let key = current_entry_key();
|
|
2019
|
+
if (key) __dead_entries__.delete(key);
|
|
1999
2020
|
let h = route_to_hash(route);
|
|
2000
2021
|
try {
|
|
2001
2022
|
window.history.pushState(null, "", h);
|
|
@@ -2003,6 +2024,7 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
2003
2024
|
window.location.hash = h;
|
|
2004
2025
|
}
|
|
2005
2026
|
}
|
|
2027
|
+
if (window.location.hash === route_to_hash(route)) note_own_entry(gobj);
|
|
2006
2028
|
}
|
|
2007
2029
|
publish_action();
|
|
2008
2030
|
return;
|
|
@@ -2823,6 +2845,193 @@ function retire_overlays(gobj) {
|
|
|
2823
2845
|
__retiring_shell__ = outer;
|
|
2824
2846
|
}
|
|
2825
2847
|
}
|
|
2848
|
+
/************************************************************
|
|
2849
|
+
* The history a shell that stops leaves to the next one.
|
|
2850
|
+
*
|
|
2851
|
+
* Its markers and the action entries of its `stay` routes
|
|
2852
|
+
* are dead now: a Back onto one closes nothing (up to gobj-ui
|
|
2853
|
+
* 7.26.48 they stayed, one more dead Back per overlay and per
|
|
2854
|
+
* logout, accumulating). It cannot take them off itself: a
|
|
2855
|
+
* back() is asynchronous and it no longer hears where it
|
|
2856
|
+
* lands. They go to __dead_entries__, and the next shell takes
|
|
2857
|
+
* them off at its start (retire_dead_entries()). A back() of
|
|
2858
|
+
* its own still in flight goes to __orphan_back__, which a
|
|
2859
|
+
* shell started before it lands adopts.
|
|
2860
|
+
*
|
|
2861
|
+
* A page with no next shell keeps them: with no router on the
|
|
2862
|
+
* page, a Back over the app's own entries changes nothing on
|
|
2863
|
+
* screen anyway, and the next shell retires them all the same.
|
|
2864
|
+
************************************************************/
|
|
2865
|
+
function hand_over_history(gobj) {
|
|
2866
|
+
let priv = gobj.priv;
|
|
2867
|
+
for (let key of priv.own_entries) __dead_entries__.add(key);
|
|
2868
|
+
priv.own_entries = [];
|
|
2869
|
+
if (priv.expected_pops > 0) {
|
|
2870
|
+
if (__orphan_back__) drop_orphan_back("another shell stopped with a back() in flight");
|
|
2871
|
+
let orphan = {
|
|
2872
|
+
pops: priv.expected_pops,
|
|
2873
|
+
hash: priv.expected_pop_hash,
|
|
2874
|
+
restore_hash: priv.restore_hash,
|
|
2875
|
+
ids: priv.expected_pop_ids.slice(),
|
|
2876
|
+
since: performance.now(),
|
|
2877
|
+
listener: null
|
|
2878
|
+
};
|
|
2879
|
+
orphan.listener = () => {
|
|
2880
|
+
orphan.pops--;
|
|
2881
|
+
if (orphan.pops > 0) return;
|
|
2882
|
+
if (orphan.restore_hash && window.location.hash !== orphan.restore_hash) try {
|
|
2883
|
+
window.history.replaceState(window.history.state, "", orphan.restore_hash);
|
|
2884
|
+
} catch (e) {
|
|
2885
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${orphan.restore_hash}' failed: ${e}`);
|
|
2886
|
+
}
|
|
2887
|
+
drop_orphan_back(null);
|
|
2888
|
+
};
|
|
2889
|
+
window.addEventListener("popstate", orphan.listener);
|
|
2890
|
+
__orphan_back__ = orphan;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
function drop_orphan_back(reason) {
|
|
2894
|
+
let orphan = __orphan_back__;
|
|
2895
|
+
if (!orphan) return;
|
|
2896
|
+
__orphan_back__ = null;
|
|
2897
|
+
window.removeEventListener("popstate", orphan.listener);
|
|
2898
|
+
if (reason) (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: a back() of a stopped shell is no longer waited for: ${reason}`);
|
|
2899
|
+
}
|
|
2900
|
+
/************************************************************
|
|
2901
|
+
* A shell that starts while a back() of a stopped one is in
|
|
2902
|
+
* flight waits for it as for one of its own: an overlay it
|
|
2903
|
+
* opens meanwhile gets its marker after the landing, and a
|
|
2904
|
+
* route it pushes runs after it. Pushed before, Chromium runs
|
|
2905
|
+
* the traversal from the new entry and Firefox drops it.
|
|
2906
|
+
************************************************************/
|
|
2907
|
+
function adopt_orphan_back(gobj) {
|
|
2908
|
+
let orphan = __orphan_back__;
|
|
2909
|
+
if (!orphan) return;
|
|
2910
|
+
if (performance.now() - orphan.since > DEFERRED_ROUTE_WAIT_MS) {
|
|
2911
|
+
drop_orphan_back(`it did not land in ${DEFERRED_ROUTE_WAIT_MS} ms`);
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
__orphan_back__ = null;
|
|
2915
|
+
window.removeEventListener("popstate", orphan.listener);
|
|
2916
|
+
let priv = gobj.priv;
|
|
2917
|
+
priv.expected_pops = orphan.pops;
|
|
2918
|
+
priv.expected_pop_hash = orphan.hash;
|
|
2919
|
+
priv.restore_hash = orphan.restore_hash;
|
|
2920
|
+
priv.expected_pop_ids = orphan.ids;
|
|
2921
|
+
arm_back_wait(gobj);
|
|
2922
|
+
}
|
|
2923
|
+
/************************************************************
|
|
2924
|
+
* A reload is a shell going away with its overlays up, and
|
|
2925
|
+
* no stop: the entries it made stay in the session history,
|
|
2926
|
+
* and they are entries of the new document too (a Back onto
|
|
2927
|
+
* one is a popstate, not a load). Their keys are kept in the
|
|
2928
|
+
* tab's sessionStorage when the page goes, and the first
|
|
2929
|
+
* shell of the new document takes them off as a stop's.
|
|
2930
|
+
************************************************************/
|
|
2931
|
+
var DEAD_ENTRIES_STORAGE_KEY = "yui_shell_dead_entries";
|
|
2932
|
+
var __dead_entries_kept__ = false;
|
|
2933
|
+
function keep_dead_entries_across_reload() {
|
|
2934
|
+
if (__dead_entries_kept__) return;
|
|
2935
|
+
__dead_entries_kept__ = true;
|
|
2936
|
+
let storage = null;
|
|
2937
|
+
try {
|
|
2938
|
+
storage = window.sessionStorage;
|
|
2939
|
+
} catch (e) {
|
|
2940
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: no sessionStorage, a reload keeps its dead history entries: ${e}`);
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
if (!storage) return;
|
|
2944
|
+
let raw = null;
|
|
2945
|
+
try {
|
|
2946
|
+
raw = storage.getItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2947
|
+
storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2948
|
+
} catch (e) {
|
|
2949
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: reading the dead history entries of the last load failed: ${e}`);
|
|
2950
|
+
}
|
|
2951
|
+
if (raw) {
|
|
2952
|
+
let keys = null;
|
|
2953
|
+
try {
|
|
2954
|
+
keys = JSON.parse(raw);
|
|
2955
|
+
} catch (e) {
|
|
2956
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: the dead history entries of the last load are not json: ${e}`);
|
|
2957
|
+
}
|
|
2958
|
+
if (Array.isArray(keys)) {
|
|
2959
|
+
for (let key of keys) if (typeof key === "string") __dead_entries__.add(key);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
window.addEventListener("pagehide", () => {
|
|
2963
|
+
let keys = new Set(__dead_entries__);
|
|
2964
|
+
for (let shell of __live_shells__) for (let key of shell.priv && shell.priv.own_entries || []) keys.add(key);
|
|
2965
|
+
try {
|
|
2966
|
+
if (keys.size > 0) storage.setItem(DEAD_ENTRIES_STORAGE_KEY, JSON.stringify([...keys]));
|
|
2967
|
+
else storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2968
|
+
} catch (e) {
|
|
2969
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: keeping the dead history entries for the next load failed: ${e}`);
|
|
2970
|
+
}
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
function current_entry_key() {
|
|
2974
|
+
let nav = window.navigation;
|
|
2975
|
+
if (!nav || !nav.currentEntry || typeof nav.entries !== "function") return null;
|
|
2976
|
+
return nav.currentEntry.key || null;
|
|
2977
|
+
}
|
|
2978
|
+
var OWN_ENTRIES_PRUNE_AT = 64;
|
|
2979
|
+
function note_own_entry(gobj) {
|
|
2980
|
+
let priv = gobj.priv;
|
|
2981
|
+
let key = current_entry_key();
|
|
2982
|
+
if (!key || priv.own_entries.includes(key)) return;
|
|
2983
|
+
priv.own_entries.push(key);
|
|
2984
|
+
if (priv.own_entries.length > OWN_ENTRIES_PRUNE_AT) {
|
|
2985
|
+
let alive = new Set(window.navigation.entries().map((e) => e.key));
|
|
2986
|
+
priv.own_entries = priv.own_entries.filter((k) => alive.has(k));
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
/************************************************************
|
|
2990
|
+
* Take off, with ONE history.go(-n), the dead entries a
|
|
2991
|
+
* stopped shell left under the current one (hand_over_history).
|
|
2992
|
+
* The walk stops at the first entry that is not dead, so it
|
|
2993
|
+
* never goes past an entry of the reader's. The traversal is
|
|
2994
|
+
* this shell's own (expected_pops): its overlays' markers and
|
|
2995
|
+
* the routes it pushes wait for the landing, and a position
|
|
2996
|
+
* the URL holds is put back on the entry it lands on, as for
|
|
2997
|
+
* any back() of ours (restore_hash). Returns true when it
|
|
2998
|
+
* went.
|
|
2999
|
+
************************************************************/
|
|
3000
|
+
function retire_dead_entries(gobj) {
|
|
3001
|
+
let priv = gobj.priv;
|
|
3002
|
+
if (__dead_entries__.size === 0 || priv.expected_pops > 0 || !priv.popstate_handler || !current_entry_key()) return false;
|
|
3003
|
+
let nav = window.navigation;
|
|
3004
|
+
let entries = nav.entries();
|
|
3005
|
+
let index = nav.currentEntry.index;
|
|
3006
|
+
let alive = new Set(entries.map((e) => e.key));
|
|
3007
|
+
for (let key of __dead_entries__) if (!alive.has(key)) __dead_entries__.delete(key);
|
|
3008
|
+
let landing = index;
|
|
3009
|
+
while (landing > 0 && __dead_entries__.has(entries[landing].key)) landing--;
|
|
3010
|
+
let steps = index - landing;
|
|
3011
|
+
if (steps === 0) return false;
|
|
3012
|
+
let landing_hash = "";
|
|
3013
|
+
try {
|
|
3014
|
+
landing_hash = new URL(entries[landing].url).hash;
|
|
3015
|
+
} catch (e) {
|
|
3016
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: the entry under the dead ones has no url: ${e}`);
|
|
3017
|
+
return false;
|
|
3018
|
+
}
|
|
3019
|
+
for (let i = landing + 1; i <= index; i++) __dead_entries__.delete(entries[i].key);
|
|
3020
|
+
priv.expected_pops++;
|
|
3021
|
+
priv.expected_pop_hash = landing_hash;
|
|
3022
|
+
priv.restore_hash = window.location.hash !== landing_hash ? window.location.hash : "";
|
|
3023
|
+
try {
|
|
3024
|
+
window.history.go(-steps);
|
|
3025
|
+
} catch (e) {
|
|
3026
|
+
priv.expected_pops--;
|
|
3027
|
+
priv.restore_hash = "";
|
|
3028
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: retiring ${steps} dead history entries failed: ${e}`);
|
|
3029
|
+
return false;
|
|
3030
|
+
}
|
|
3031
|
+
clear_deferred_timer(gobj);
|
|
3032
|
+
arm_back_wait(gobj);
|
|
3033
|
+
return true;
|
|
3034
|
+
}
|
|
2826
3035
|
function pop_escape(gobj, handler) {
|
|
2827
3036
|
let priv = gobj.priv;
|
|
2828
3037
|
if (!priv || !priv.escape_stack) return;
|
|
@@ -2934,6 +3143,7 @@ function push_overlay_marker(gobj, entry) {
|
|
|
2934
3143
|
}
|
|
2935
3144
|
try {
|
|
2936
3145
|
window.history.pushState({ __yui_overlay__: entry.id }, "");
|
|
3146
|
+
note_own_entry(gobj);
|
|
2937
3147
|
} catch (e) {
|
|
2938
3148
|
let idx = priv.overlay_stack.indexOf(entry);
|
|
2939
3149
|
if (idx >= 0) priv.overlay_stack.splice(idx, 1);
|
|
@@ -2961,6 +3171,10 @@ function defer_route(gobj, route) {
|
|
|
2961
3171
|
let priv = gobj.priv;
|
|
2962
3172
|
if (priv.deferred_route && priv.deferred_route !== route) (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: route '${priv.deferred_route}' waiting for a back() of ours is replaced by '${route}'`);
|
|
2963
3173
|
priv.deferred_route = route;
|
|
3174
|
+
arm_back_wait(gobj);
|
|
3175
|
+
}
|
|
3176
|
+
function arm_back_wait(gobj) {
|
|
3177
|
+
let priv = gobj.priv;
|
|
2964
3178
|
if (!priv.deferred_timer) priv.deferred_timer = window.setTimeout(() => {
|
|
2965
3179
|
if (!gobj.priv) return;
|
|
2966
3180
|
gobj.priv.deferred_timer = null;
|
|
@@ -9881,8 +10095,10 @@ function time_value_to_text(value, real_type) {
|
|
|
9881
10095
|
* it had. Up to gobj-ui 7.26.46 both committed null: one
|
|
9882
10096
|
* Backspace and Enter erased the stored time. To clear a time
|
|
9883
10097
|
* on purpose, clear EVERY part of the box: an empty box
|
|
9884
|
-
* commits null.
|
|
9885
|
-
*
|
|
10098
|
+
* commits null. Inside the box the Left and Right arrows move
|
|
10099
|
+
* between its parts; Tab is the table's (Tabulator's navNext):
|
|
10100
|
+
* it leaves the cell and opens the editor of the next one, in
|
|
10101
|
+
* Chromium and Firefox alike.
|
|
9886
10102
|
*
|
|
9887
10103
|
* Copyright (c) 2026, ArtGins.
|
|
9888
10104
|
* All Rights Reserved.
|
|
@@ -9918,6 +10134,7 @@ function form_time_cell_editor(real_type) {
|
|
|
9918
10134
|
let attrs = params.elementAttributes;
|
|
9919
10135
|
if (attrs && typeof attrs === "object") for (let key of Object.keys(attrs)) input.setAttribute(key, attrs[key]);
|
|
9920
10136
|
input.value = original_text;
|
|
10137
|
+
let shown_text = input.value;
|
|
9921
10138
|
onRendered(function() {
|
|
9922
10139
|
if (cell.getType() === "cell") {
|
|
9923
10140
|
input.focus({ preventScroll: true });
|
|
@@ -9933,7 +10150,7 @@ function form_time_cell_editor(real_type) {
|
|
|
9933
10150
|
else input.setAttribute("aria-invalid", "true");
|
|
9934
10151
|
return;
|
|
9935
10152
|
}
|
|
9936
|
-
if (input.value ===
|
|
10153
|
+
if (input.value === shown_text) {
|
|
9937
10154
|
cancel();
|
|
9938
10155
|
return;
|
|
9939
10156
|
}
|
|
@@ -9947,9 +10164,11 @@ function form_time_cell_editor(real_type) {
|
|
|
9947
10164
|
input.addEventListener("blur", function(e) {
|
|
9948
10165
|
if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit(true);
|
|
9949
10166
|
});
|
|
9950
|
-
|
|
10167
|
+
let recheck = function() {
|
|
9951
10168
|
if (!incomplete()) input.removeAttribute("aria-invalid");
|
|
9952
|
-
}
|
|
10169
|
+
};
|
|
10170
|
+
input.addEventListener("input", recheck);
|
|
10171
|
+
input.addEventListener("keyup", recheck);
|
|
9953
10172
|
input.addEventListener("keydown", function(e) {
|
|
9954
10173
|
switch (e.key) {
|
|
9955
10174
|
case "Enter":
|
|
@@ -10447,7 +10666,11 @@ function mt_writing$2(gobj, path) {
|
|
|
10447
10666
|
if (path === "selectable") {
|
|
10448
10667
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
10449
10668
|
if (!$container) return;
|
|
10450
|
-
|
|
10669
|
+
let selectable = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable");
|
|
10670
|
+
for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) if ($table.tabulator) {
|
|
10671
|
+
show_row_selection(gobj, $table.tabulator);
|
|
10672
|
+
if (!selectable && $table.tabulator.initialized) $table.tabulator.deselectRow();
|
|
10673
|
+
}
|
|
10451
10674
|
}
|
|
10452
10675
|
}
|
|
10453
10676
|
/************************************************************
|
|
@@ -11073,7 +11296,7 @@ function build_form(gobj) {
|
|
|
11073
11296
|
******************************************************************/
|
|
11074
11297
|
function build_html_form(gobj, $form, prefix, template) {
|
|
11075
11298
|
Object.entries(template).forEach(([key, value]) => {
|
|
11076
|
-
const field_desc = (
|
|
11299
|
+
const field_desc = form_template_field_desc(key, value);
|
|
11077
11300
|
if (!prefix && yui_icons_is_svg_field((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"), field_desc.name)) field_desc.type = "svg";
|
|
11078
11301
|
let html_field_conf = build_form_field_conf(gobj, field_desc);
|
|
11079
11302
|
html_field_conf.name = field_desc.name;
|
|
@@ -12076,6 +12299,7 @@ function create_coordinates(gobj, attrs) {
|
|
|
12076
12299
|
const latitude = position.coords.latitude;
|
|
12077
12300
|
$input.value = `${position.coords.longitude}, ${latitude}`;
|
|
12078
12301
|
$input.classList.remove("is-danger");
|
|
12302
|
+
$input.removeAttribute("aria-invalid");
|
|
12079
12303
|
let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
|
|
12080
12304
|
$h.textContent = "";
|
|
12081
12305
|
$h.style.display = "none";
|
|
@@ -12096,7 +12320,9 @@ function create_coordinates(gobj, attrs) {
|
|
|
12096
12320
|
default: errorMsg = (0, i18next.t)("unknown error");
|
|
12097
12321
|
}
|
|
12098
12322
|
$input.classList.add("is-danger");
|
|
12323
|
+
$input.setAttribute("aria-invalid", "true");
|
|
12099
12324
|
let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
|
|
12325
|
+
describe_by_help($input, $h);
|
|
12100
12326
|
$h.textContent = errorMsg;
|
|
12101
12327
|
$h.style.display = "block";
|
|
12102
12328
|
}
|
|
@@ -12332,7 +12558,7 @@ function column_title(field_desc) {
|
|
|
12332
12558
|
function table_column_titles(template) {
|
|
12333
12559
|
let titles = {};
|
|
12334
12560
|
Object.entries(template || {}).forEach(([key, value]) => {
|
|
12335
|
-
const field_desc = (
|
|
12561
|
+
const field_desc = form_template_field_desc(key, value);
|
|
12336
12562
|
titles[field_desc.name] = column_title(field_desc);
|
|
12337
12563
|
});
|
|
12338
12564
|
return titles;
|
|
@@ -12345,7 +12571,7 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
12345
12571
|
return (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "editable");
|
|
12346
12572
|
}
|
|
12347
12573
|
Object.entries(template).forEach(([key, value]) => {
|
|
12348
|
-
const field_desc = (
|
|
12574
|
+
const field_desc = form_template_field_desc(key, value);
|
|
12349
12575
|
let readonly = !field_desc.is_writable;
|
|
12350
12576
|
let validator = [];
|
|
12351
12577
|
let column = {
|
|
@@ -12515,6 +12741,21 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
12515
12741
|
return columns;
|
|
12516
12742
|
}
|
|
12517
12743
|
/************************************************************
|
|
12744
|
+
* A field of the template. A dot-token spec that names a
|
|
12745
|
+
* `time` / `now` type and no real type ("time.writable") is
|
|
12746
|
+
* an epoch, as the real type of a treedb time column is
|
|
12747
|
+
* integer: template_get_field_desc() (gobj-js) gives every
|
|
12748
|
+
* spec without one `string`, and a `string` time column is
|
|
12749
|
+
* an ISO text (form_time_value.js). Since gobj-ui 7.26.47
|
|
12750
|
+
* such a field showed its epoch as no time, and a save of
|
|
12751
|
+
* any field wrote null over it.
|
|
12752
|
+
************************************************************/
|
|
12753
|
+
function form_template_field_desc(key, value) {
|
|
12754
|
+
let field_desc = (0, _yuneta_gobj_js.template_get_field_desc)(key, value);
|
|
12755
|
+
if ((0, _yuneta_gobj_js.is_string)(value) && (field_desc.type === "time" || field_desc.type === "now") && !value.split(".").includes(field_desc.real_type)) field_desc.real_type = "integer";
|
|
12756
|
+
return field_desc;
|
|
12757
|
+
}
|
|
12758
|
+
/************************************************************
|
|
12518
12759
|
* What is wrong with a field, in the APP's language.
|
|
12519
12760
|
*
|
|
12520
12761
|
* `input.validationMessage` is the BROWSER's sentence in the BROWSER's
|
|
@@ -12550,6 +12791,7 @@ function mark_field_validity($input) {
|
|
|
12550
12791
|
let v = $input.validity;
|
|
12551
12792
|
if ((!v || v.valid) && !$input.yui_json_error) {
|
|
12552
12793
|
$input.classList.remove("is-danger");
|
|
12794
|
+
$input.removeAttribute("aria-invalid");
|
|
12553
12795
|
if ($h) {
|
|
12554
12796
|
$h.textContent = "";
|
|
12555
12797
|
$h.removeAttribute("data-i18n");
|
|
@@ -12558,7 +12800,9 @@ function mark_field_validity($input) {
|
|
|
12558
12800
|
return true;
|
|
12559
12801
|
}
|
|
12560
12802
|
$input.classList.add("is-danger");
|
|
12803
|
+
$input.setAttribute("aria-invalid", "true");
|
|
12561
12804
|
if ($h) {
|
|
12805
|
+
describe_by_help($input, $h);
|
|
12562
12806
|
let key = field_validation_key($input);
|
|
12563
12807
|
if (key) $h.setAttribute("data-i18n", key);
|
|
12564
12808
|
else $h.removeAttribute("data-i18n");
|
|
@@ -12567,6 +12811,15 @@ function mark_field_validity($input) {
|
|
|
12567
12811
|
}
|
|
12568
12812
|
return false;
|
|
12569
12813
|
}
|
|
12814
|
+
var __help_seq__ = 0;
|
|
12815
|
+
function describe_by_help($input, $h) {
|
|
12816
|
+
if (!$h.id) $h.id = `yui-form-help-${++__help_seq__}`;
|
|
12817
|
+
let ids = ($input.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean);
|
|
12818
|
+
if (!ids.includes($h.id)) {
|
|
12819
|
+
ids.push($h.id);
|
|
12820
|
+
$input.setAttribute("aria-describedby", ids.join(" "));
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12570
12823
|
/************************************************************
|
|
12571
12824
|
*
|
|
12572
12825
|
************************************************************/
|
|
@@ -12752,11 +13005,13 @@ function clear_data(gobj, $form) {
|
|
|
12752
13005
|
*
|
|
12753
13006
|
************************************************************/
|
|
12754
13007
|
function clear_validation(gobj, $form) {
|
|
12755
|
-
$form.querySelectorAll("input").forEach(($input) => {
|
|
13008
|
+
$form.querySelectorAll("input, .yui-form-data-input").forEach(($input) => {
|
|
12756
13009
|
$input.classList.remove("is-danger");
|
|
13010
|
+
$input.removeAttribute("aria-invalid");
|
|
12757
13011
|
});
|
|
12758
13012
|
$form.querySelectorAll(".help").forEach(($input) => {
|
|
12759
13013
|
$input.textContent = "";
|
|
13014
|
+
$input.removeAttribute("data-i18n");
|
|
12760
13015
|
$input.style.display = "none";
|
|
12761
13016
|
});
|
|
12762
13017
|
$form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
|
|
@@ -23453,12 +23708,12 @@ function restore_view_state(gobj) {
|
|
|
23453
23708
|
let done = false;
|
|
23454
23709
|
priv.restoring = true;
|
|
23455
23710
|
try {
|
|
23456
|
-
if (
|
|
23711
|
+
if (Number.isFinite(state.zoom) && state.zoom > 0) {
|
|
23457
23712
|
graph.zoomTo(state.zoom);
|
|
23458
23713
|
priv.last_zoom = state.zoom;
|
|
23459
23714
|
done = true;
|
|
23460
23715
|
}
|
|
23461
|
-
if (Array.isArray(state.position) && state.position.length >= 2) {
|
|
23716
|
+
if (Array.isArray(state.position) && state.position.length >= 2 && Number.isFinite(state.position[0]) && Number.isFinite(state.position[1])) {
|
|
23462
23717
|
graph.translateTo([state.position[0], state.position[1]]);
|
|
23463
23718
|
done = true;
|
|
23464
23719
|
}
|
|
@@ -23486,12 +23741,31 @@ function save_view_state(gobj) {
|
|
|
23486
23741
|
collapsed: priv.collapse_state || {},
|
|
23487
23742
|
anchor: priv.anchor_state === "on" ? priv.anchor_name : ""
|
|
23488
23743
|
};
|
|
23744
|
+
let camera = null;
|
|
23489
23745
|
try {
|
|
23490
|
-
|
|
23491
|
-
state.position = graph.getPosition();
|
|
23746
|
+
camera = camera_of(graph.getZoom(), graph.getPosition());
|
|
23492
23747
|
} catch (e) {}
|
|
23748
|
+
if (!camera) {
|
|
23749
|
+
let old = load_view_state(gobj);
|
|
23750
|
+
camera = old ? camera_of(old.zoom, old.position) : null;
|
|
23751
|
+
}
|
|
23752
|
+
if (camera) {
|
|
23753
|
+
state.zoom = camera.zoom;
|
|
23754
|
+
state.position = camera.position;
|
|
23755
|
+
}
|
|
23493
23756
|
(0, _yuneta_gobj_js.kw_set_local_storage_value)(view_store_key(gobj), state);
|
|
23494
23757
|
}
|
|
23758
|
+
function camera_of(zoom, position) {
|
|
23759
|
+
if (!(Number.isFinite(zoom) && zoom > 0)) return null;
|
|
23760
|
+
if (!position || typeof position.length !== "number" || position.length < 2) return null;
|
|
23761
|
+
let x = position[0];
|
|
23762
|
+
let y = position[1];
|
|
23763
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
|
|
23764
|
+
return {
|
|
23765
|
+
zoom,
|
|
23766
|
+
position: [x, y]
|
|
23767
|
+
};
|
|
23768
|
+
}
|
|
23495
23769
|
function load_view_state(gobj) {
|
|
23496
23770
|
let state = (0, _yuneta_gobj_js.kw_get_local_storage_value)(view_store_key(gobj), null, false);
|
|
23497
23771
|
return state && typeof state === "object" ? state : null;
|