@yuneta/gobj-ui 7.26.6 → 7.26.7
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 +74 -25
- package/dist/gobj-ui.cjs.js +635 -242
- package/dist/gobj-ui.es.js +635 -242
- package/index.js +5 -1
- package/package.json +2 -2
- package/src/c_g6_nodes_tree.js +41 -0
- package/src/c_yui_form.js +140 -83
- package/src/c_yui_gclass.js +6 -2
- package/src/c_yui_gobj_tree_js.js +15 -4
- package/src/c_yui_json_graph.js +40 -13
- package/src/c_yui_map.js +115 -75
- package/src/c_yui_nav.js +53 -14
- package/src/c_yui_pager.js +14 -9
- package/src/c_yui_period.js +16 -6
- package/src/c_yui_shell.js +89 -31
- package/src/c_yui_treedb_topic_with_form.js +33 -44
- package/src/c_yui_uplot.js +1 -1
- package/src/c_yui_window.js +70 -24
- package/src/c_yui_window_manager.js +7 -3
- package/src/c_yui_wizard.js +23 -8
- package/src/delete_impact.js +5 -3
- package/src/form_json_field.js +116 -0
- package/src/form_json_field.test.js +43 -0
- package/src/form_json_field.wiring.test.js +137 -0
- package/src/schema_to_c.js +17 -1
- package/src/schema_to_c.test.js +7 -0
- package/src/shell_route_map.js +6 -0
- package/src/treedb_topics_transport.wiring.test.js +9 -1
- package/src/window_veto_back.wiring.test.js +101 -0
- package/src/wizard_chrome.wiring.test.js +87 -0
- package/src/yui_dev.js +10 -3
- package/src/yui_table_filter_clear.js +44 -44
- package/vite-plugin-yuneta-html.js +28 -6
package/src/c_yui_map.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Map Manager
|
|
5
5
|
*
|
|
6
|
-
* Copyright (c) 2025, ArtGins.
|
|
6
|
+
* Copyright (c) 2025-2026, ArtGins.
|
|
7
7
|
* All Rights Reserved.
|
|
8
8
|
***********************************************************************/
|
|
9
9
|
import {
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
gobj_start,
|
|
31
31
|
gobj_name,
|
|
32
32
|
gobj_unsubscribe_event,
|
|
33
|
+
gobj_stop_children,
|
|
33
34
|
} from "@yuneta/gobj-js";
|
|
34
35
|
|
|
35
36
|
import "maplibre-gl/dist/maplibre-gl.css"; // Import MapLibre styles
|
|
@@ -308,6 +309,8 @@ function mt_stop(gobj)
|
|
|
308
309
|
if(shell) {
|
|
309
310
|
gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
310
311
|
}
|
|
312
|
+
/* The marker windows are children of the map: they stop with it. */
|
|
313
|
+
gobj_stop_children(gobj);
|
|
311
314
|
return 0;
|
|
312
315
|
}
|
|
313
316
|
|
|
@@ -710,84 +713,25 @@ function find_device(gobj, id)
|
|
|
710
713
|
}
|
|
711
714
|
|
|
712
715
|
/************************************************************
|
|
713
|
-
* Event handler for click
|
|
716
|
+
* Event handler for click: maplibre's callback only turns the
|
|
717
|
+
* click into an event; the work is ac_marker_clicked().
|
|
718
|
+
* Plain json: the marker's identity and where it is.
|
|
714
719
|
************************************************************/
|
|
715
720
|
function onClick(gobj, e)
|
|
716
721
|
{
|
|
717
|
-
let
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
// Get feature properties and coordinates
|
|
722
|
-
const coordinates = e.features[0].geometry.coordinates.slice();
|
|
723
|
-
const properties = e.features[0].properties;
|
|
724
|
-
|
|
725
|
-
/* A marker may or may not be backed by a gobj service. Only look it up
|
|
726
|
-
* when the feature carries a name (verbose=false: a marker without a
|
|
727
|
-
* service is a normal case handled by the popup branch below, not an
|
|
728
|
-
* error). gobj_find_service() would otherwise crash on undefined. */
|
|
729
|
-
const gobj_service = properties.gobj_service_name
|
|
730
|
-
? gobj_find_service(properties.gobj_service_name, false)
|
|
731
|
-
: null;
|
|
732
|
-
if(gobj_service) {
|
|
733
|
-
let name = clean_name(gobj_name(gobj_service));
|
|
734
|
-
let window_service_name = `window-map-${name}`;
|
|
735
|
-
|
|
736
|
-
let popupContent = createElement2(
|
|
737
|
-
['div',
|
|
738
|
-
{
|
|
739
|
-
class: 'xmap columns m-0 p-0 is-flex-wrap-wrap',
|
|
740
|
-
},
|
|
741
|
-
gobj_read_attr(gobj_service, "$container")
|
|
742
|
-
]
|
|
743
|
-
);
|
|
744
|
-
|
|
745
|
-
let gobj_window = gobj_create_service(
|
|
746
|
-
window_service_name,
|
|
747
|
-
"C_YUI_WINDOW",
|
|
748
|
-
{
|
|
749
|
-
$parent: document.getElementById('top-layer'),
|
|
750
|
-
width: 700,
|
|
751
|
-
height: 500,
|
|
752
|
-
auto_save_size_and_position: false,
|
|
753
|
-
center: true,
|
|
754
|
-
showMax: false,
|
|
755
|
-
content_size: true,
|
|
756
|
-
/* The marker's own name: this window is one marker's
|
|
757
|
-
* detail, and several can be open at once, so the bar
|
|
758
|
-
* must say WHICH. It is DATA, so it travels in
|
|
759
|
-
* title_prefix (never translated) — in `title` it
|
|
760
|
-
* would get a data-i18n and a marker named like a
|
|
761
|
-
* locale key ("status") would render translated. */
|
|
762
|
-
title_prefix: gobj_name(gobj_service),
|
|
763
|
-
title: "",
|
|
764
|
-
icon: "yi-location-dot",
|
|
765
|
-
logical_class: "MAP_MARKER_WINDOW",
|
|
766
|
-
body: popupContent
|
|
767
|
-
},
|
|
768
|
-
gobj
|
|
769
|
-
);
|
|
770
|
-
if(!gobj_window) {
|
|
771
|
-
log_error(`${gobj_name(gobj)}: cannot create the marker window`);
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
gobj_start(gobj_window);
|
|
775
|
-
|
|
776
|
-
} else {
|
|
777
|
-
// Initialize a popup
|
|
778
|
-
const popup = new maplibregl.Popup({
|
|
779
|
-
closeButton: true,
|
|
780
|
-
closeOnClick: true, // Automatically close when clicking elsewhere
|
|
781
|
-
closeOnMove: true,
|
|
782
|
-
anchor: 'center',
|
|
783
|
-
maxWidth: 'none',
|
|
784
|
-
});
|
|
785
|
-
|
|
786
|
-
const popupContent = `
|
|
787
|
-
<b>${properties.name}</b><br>Id: ${properties.id}
|
|
788
|
-
`;
|
|
789
|
-
popup.setLngLat(coordinates).setHTML(popupContent).addTo(map);
|
|
722
|
+
let feature = e && e.features && e.features[0];
|
|
723
|
+
if(!feature) {
|
|
724
|
+
log_error(`${gobj_name(gobj)}: marker click with no feature`);
|
|
725
|
+
return;
|
|
790
726
|
}
|
|
727
|
+
let properties = feature.properties || {};
|
|
728
|
+
let coordinates = feature.geometry.coordinates.slice();
|
|
729
|
+
gobj_send_event(gobj, "EV_MARKER_CLICKED", {
|
|
730
|
+
gobj_service_name: properties.gobj_service_name || "",
|
|
731
|
+
name: (properties.name !== undefined)? String(properties.name) : "",
|
|
732
|
+
id: (properties.id !== undefined)? String(properties.id) : "",
|
|
733
|
+
coordinates: coordinates
|
|
734
|
+
}, gobj);
|
|
791
735
|
}
|
|
792
736
|
|
|
793
737
|
/************************************************************
|
|
@@ -983,6 +927,100 @@ function ac_refresh(gobj, event, kw, src)
|
|
|
983
927
|
return 0;
|
|
984
928
|
}
|
|
985
929
|
|
|
930
|
+
/************************************************************
|
|
931
|
+
* EV_MARKER_CLICKED {gobj_service_name, name, id, coordinates}
|
|
932
|
+
*
|
|
933
|
+
* A marker backed by a gobj service opens that service's view in
|
|
934
|
+
* a window -- ONE per marker: a second click is told to the open
|
|
935
|
+
* one (EV_SHOW). (It created a second window under the same service
|
|
936
|
+
* name, moved the one $container into it and left the first one
|
|
937
|
+
* empty; closing the first then unregistered the second's name.)
|
|
938
|
+
* A marker without a service gets a popup with its name and id.
|
|
939
|
+
************************************************************/
|
|
940
|
+
function ac_marker_clicked(gobj, event, kw, src)
|
|
941
|
+
{
|
|
942
|
+
let priv = gobj.priv;
|
|
943
|
+
const map = priv.xmap;
|
|
944
|
+
|
|
945
|
+
/* A marker may or may not be backed by a gobj service. Only look it up
|
|
946
|
+
* when the feature carries a name (verbose=false: a marker without a
|
|
947
|
+
* service is a normal case handled by the popup branch below, not an
|
|
948
|
+
* error). gobj_find_service() would otherwise crash on undefined. */
|
|
949
|
+
const gobj_service = kw.gobj_service_name
|
|
950
|
+
? gobj_find_service(kw.gobj_service_name, false)
|
|
951
|
+
: null;
|
|
952
|
+
|
|
953
|
+
if(gobj_service) {
|
|
954
|
+
let name = clean_name(gobj_name(gobj_service));
|
|
955
|
+
let window_service_name = `window-map-${name}`;
|
|
956
|
+
|
|
957
|
+
let gobj_window = gobj_find_service(window_service_name, false);
|
|
958
|
+
if(gobj_window) {
|
|
959
|
+
gobj_send_event(gobj_window, "EV_SHOW", {}, gobj);
|
|
960
|
+
return 0;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
let popupContent = createElement2(
|
|
964
|
+
['div',
|
|
965
|
+
{
|
|
966
|
+
class: 'xmap columns m-0 p-0 is-flex-wrap-wrap',
|
|
967
|
+
},
|
|
968
|
+
gobj_read_attr(gobj_service, "$container")
|
|
969
|
+
]
|
|
970
|
+
);
|
|
971
|
+
|
|
972
|
+
gobj_window = gobj_create_service(
|
|
973
|
+
window_service_name,
|
|
974
|
+
"C_YUI_WINDOW",
|
|
975
|
+
{
|
|
976
|
+
$parent: document.getElementById('top-layer'),
|
|
977
|
+
width: 700,
|
|
978
|
+
height: 500,
|
|
979
|
+
auto_save_size_and_position: false,
|
|
980
|
+
center: true,
|
|
981
|
+
showMax: false,
|
|
982
|
+
content_size: true,
|
|
983
|
+
/* The marker's own name: this window is one marker's
|
|
984
|
+
* detail, and several can be open at once, so the bar
|
|
985
|
+
* must say WHICH. It is DATA, so it travels in
|
|
986
|
+
* title_prefix (never translated) — in `title` it
|
|
987
|
+
* would get a data-i18n and a marker named like a
|
|
988
|
+
* locale key ("status") would render translated. */
|
|
989
|
+
title_prefix: gobj_name(gobj_service),
|
|
990
|
+
title: "",
|
|
991
|
+
icon: "yi-location-dot",
|
|
992
|
+
logical_class: "MAP_MARKER_WINDOW",
|
|
993
|
+
body: popupContent
|
|
994
|
+
},
|
|
995
|
+
gobj
|
|
996
|
+
);
|
|
997
|
+
if(!gobj_window) {
|
|
998
|
+
log_error(`${gobj_name(gobj)}: cannot create the marker window`);
|
|
999
|
+
return -1;
|
|
1000
|
+
}
|
|
1001
|
+
gobj_start(gobj_window);
|
|
1002
|
+
return 0;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
const popup = new maplibregl.Popup({
|
|
1006
|
+
closeButton: true,
|
|
1007
|
+
closeOnClick: true, // Automatically close when clicking elsewhere
|
|
1008
|
+
closeOnMove: true,
|
|
1009
|
+
anchor: 'center',
|
|
1010
|
+
maxWidth: 'none',
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
/* Built as nodes, never as markup: the name and the id are data. */
|
|
1014
|
+
let $content = document.createElement('div');
|
|
1015
|
+
let $name = document.createElement('b');
|
|
1016
|
+
$name.textContent = kw.name;
|
|
1017
|
+
$content.appendChild($name);
|
|
1018
|
+
$content.appendChild(document.createElement('br'));
|
|
1019
|
+
$content.appendChild(document.createTextNode(`Id: ${kw.id}`));
|
|
1020
|
+
popup.setLngLat(kw.coordinates).setDOMContent($content).addTo(map);
|
|
1021
|
+
return 0;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
986
1024
|
/************************************************************
|
|
987
1025
|
*
|
|
988
1026
|
************************************************************/
|
|
@@ -1056,6 +1094,7 @@ function create_gclass(gclass_name)
|
|
|
1056
1094
|
["EV_MAP_ON_LOAD", ac_map_on_load, null],
|
|
1057
1095
|
["EV_REFRESH", ac_refresh, null],
|
|
1058
1096
|
["EV_SELECT", ac_select, null],
|
|
1097
|
+
["EV_MARKER_CLICKED", ac_marker_clicked, null],
|
|
1059
1098
|
["EV_SHOW", ac_show, null],
|
|
1060
1099
|
["EV_HIDE", ac_hide, null]
|
|
1061
1100
|
]]
|
|
@@ -1071,6 +1110,7 @@ function create_gclass(gclass_name)
|
|
|
1071
1110
|
["EV_MAP_ON_LOAD", 0],
|
|
1072
1111
|
["EV_REFRESH", 0],
|
|
1073
1112
|
["EV_SELECT", 0],
|
|
1113
|
+
["EV_MARKER_CLICKED", 0],
|
|
1074
1114
|
["EV_SHOW", 0],
|
|
1075
1115
|
["EV_HIDE", 0]
|
|
1076
1116
|
];
|
package/src/c_yui_nav.js
CHANGED
|
@@ -108,7 +108,7 @@ const attrs_table = [
|
|
|
108
108
|
SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
|
|
109
109
|
|
|
110
110
|
SDATA(data_type_t.DTP_STRING, "menu_id", 0, "", "Id of the menu this nav renders"),
|
|
111
|
-
SDATA(data_type_t.DTP_STRING, "nav_label", 0, "", "
|
|
111
|
+
SDATA(data_type_t.DTP_STRING, "nav_label", 0, "", "i18n key of the label for aria/heading; falls back to 'navigation'"),
|
|
112
112
|
SDATA(data_type_t.DTP_JSON, "menu_items", 0, null, "Array of menu items to render"),
|
|
113
113
|
SDATA(data_type_t.DTP_STRING, "zone", 0, "", "Zone id where this nav lives"),
|
|
114
114
|
SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical", "vertical|icon-bar|tabs|drawer|submenu|accordion"),
|
|
@@ -128,7 +128,8 @@ SDATA_END()
|
|
|
128
128
|
let __nav_aria_seq__ = 0;
|
|
129
129
|
|
|
130
130
|
let PRIVATE_DATA = {
|
|
131
|
-
click_handler: null
|
|
131
|
+
click_handler: null,
|
|
132
|
+
key_handler: null
|
|
132
133
|
};
|
|
133
134
|
let __gclass__ = null;
|
|
134
135
|
|
|
@@ -193,6 +194,9 @@ function mt_destroy(gobj)
|
|
|
193
194
|
if($c && priv && priv.click_handler) {
|
|
194
195
|
$c.removeEventListener("click", priv.click_handler);
|
|
195
196
|
}
|
|
197
|
+
if($c && priv && priv.key_handler) {
|
|
198
|
+
$c.removeEventListener("keydown", priv.key_handler);
|
|
199
|
+
}
|
|
196
200
|
if($c && $c.parentNode) {
|
|
197
201
|
$c.parentNode.removeChild($c);
|
|
198
202
|
}
|
|
@@ -261,8 +265,11 @@ function build_ui(gobj)
|
|
|
261
265
|
if(layout !== "drawer") {
|
|
262
266
|
$container.setAttribute("role", "navigation");
|
|
263
267
|
if(!$container.hasAttribute("aria-label")) {
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
/* A key, translated by the shell's translator: the bare
|
|
269
|
+
* menu_id read out "secondary.main.system". */
|
|
270
|
+
let label = gobj_read_attr(gobj, "nav_label") || "navigation";
|
|
271
|
+
$container.setAttribute("aria-label", t(label));
|
|
272
|
+
$container.setAttribute("data-i18n-aria-label", label);
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
|
|
@@ -295,6 +302,9 @@ function rebuild(gobj)
|
|
|
295
302
|
if($old && priv.click_handler) {
|
|
296
303
|
$old.removeEventListener("click", priv.click_handler);
|
|
297
304
|
}
|
|
305
|
+
if($old && priv.key_handler) {
|
|
306
|
+
$old.removeEventListener("keydown", priv.key_handler);
|
|
307
|
+
}
|
|
298
308
|
|
|
299
309
|
build_ui(gobj); /* writes a fresh $container + wires new clicks */
|
|
300
310
|
|
|
@@ -408,17 +418,24 @@ function render_tabs(gobj, items)
|
|
|
408
418
|
* wire_clicks by its data-close-item marker). */
|
|
409
419
|
if(it.closable) {
|
|
410
420
|
children.push(["span", {class: "icon is-small yui-nav-close ml-2",
|
|
411
|
-
"data-close-item": it.id, role: "button",
|
|
421
|
+
"data-close-item": it.id, role: "button", tabindex: "0",
|
|
412
422
|
"aria-label": t("close"), "data-i18n-aria-label": "close",
|
|
413
423
|
title: t("close"), "data-i18n-title": "close"},
|
|
414
424
|
["i", {class: "yi-xmark", "aria-hidden":"true"}]]);
|
|
415
425
|
}
|
|
426
|
+
/* A tab with show_label:false is a bare icon: the label is
|
|
427
|
+
* its only name (same contract as item_li). */
|
|
428
|
+
let label = it.name || "";
|
|
416
429
|
let a_attrs = {
|
|
417
430
|
href: it.route ? "#" + it.route : "#",
|
|
418
431
|
"data-item-id": it.id,
|
|
419
|
-
"data-route": it.route || ""
|
|
432
|
+
"data-route": it.route || "",
|
|
433
|
+
"aria-label": label || it.id
|
|
420
434
|
};
|
|
421
|
-
|
|
435
|
+
if(label) {
|
|
436
|
+
a_attrs["data-i18n-aria-label"] = label;
|
|
437
|
+
}
|
|
438
|
+
let tip = it.tooltip || it.aria_label || label;
|
|
422
439
|
if(tip) {
|
|
423
440
|
a_attrs.title = tip;
|
|
424
441
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -536,12 +553,13 @@ function render_drawer(gobj, items)
|
|
|
536
553
|
* outer wrapper. Open/close is driven from the toolbar or from the
|
|
537
554
|
* public yui_shell_{open,close,toggle}_drawer() helpers.
|
|
538
555
|
*/
|
|
539
|
-
let menu_id = gobj_read_attr(gobj, "menu_id") || "drawer";
|
|
540
556
|
let wrap = document.createElement("div");
|
|
541
557
|
wrap.className = "yui-drawer";
|
|
542
558
|
wrap.setAttribute("role", "dialog");
|
|
543
559
|
wrap.setAttribute("aria-modal", "true");
|
|
544
|
-
|
|
560
|
+
let nav_label = gobj_read_attr(gobj, "nav_label") || "navigation";
|
|
561
|
+
wrap.setAttribute("aria-label", t(nav_label));
|
|
562
|
+
wrap.setAttribute("data-i18n-aria-label", nav_label);
|
|
545
563
|
|
|
546
564
|
let back = document.createElement("div");
|
|
547
565
|
back.className = "yui-drawer-backdrop";
|
|
@@ -551,7 +569,8 @@ function render_drawer(gobj, items)
|
|
|
551
569
|
let panel = document.createElement("div");
|
|
552
570
|
panel.className = "yui-drawer-panel";
|
|
553
571
|
panel.setAttribute("role", "navigation");
|
|
554
|
-
panel.setAttribute("aria-label",
|
|
572
|
+
panel.setAttribute("aria-label", t(nav_label));
|
|
573
|
+
panel.setAttribute("data-i18n-aria-label", nav_label);
|
|
555
574
|
panel.appendChild(render_vertical(gobj, items));
|
|
556
575
|
|
|
557
576
|
wrap.appendChild(back);
|
|
@@ -614,6 +633,10 @@ function render_accordion(gobj, items)
|
|
|
614
633
|
};
|
|
615
634
|
if(!empty_string(head_text)) {
|
|
616
635
|
head_attrs.i18n = head_text;
|
|
636
|
+
head_attrs.title = head_text;
|
|
637
|
+
head_attrs["data-i18n-title"] = head_text;
|
|
638
|
+
head_attrs["aria-label"] = head_text;
|
|
639
|
+
head_attrs["data-i18n-aria-label"] = head_text;
|
|
617
640
|
}
|
|
618
641
|
let $hdr = createElement2(["button", head_attrs, head_text]);
|
|
619
642
|
$container.appendChild($hdr);
|
|
@@ -717,7 +740,7 @@ function item_li(gobj, it, opts)
|
|
|
717
740
|
* Skip when both empty so we don't emit `title=""` noise.
|
|
718
741
|
* Mirror the value in `data-i18n-title` so refresh_language()
|
|
719
742
|
* can re-translate the tooltip on language switch. */
|
|
720
|
-
let tip = it.tooltip || it.aria_label;
|
|
743
|
+
let tip = it.tooltip || it.aria_label || label;
|
|
721
744
|
if(tip) {
|
|
722
745
|
a_attrs.title = tip;
|
|
723
746
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -771,7 +794,7 @@ function item_iconbar(gobj, it, opts)
|
|
|
771
794
|
if(label) {
|
|
772
795
|
a_attrs["data-i18n-aria-label"] = label;
|
|
773
796
|
}
|
|
774
|
-
let tip = it.tooltip || it.aria_label;
|
|
797
|
+
let tip = it.tooltip || it.aria_label || label;
|
|
775
798
|
if(tip) {
|
|
776
799
|
a_attrs.title = tip;
|
|
777
800
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -864,6 +887,21 @@ function wire_clicks(gobj, $container)
|
|
|
864
887
|
|
|
865
888
|
$container.addEventListener("click", handler);
|
|
866
889
|
priv.click_handler = handler;
|
|
890
|
+
|
|
891
|
+
/* The ✕ of a closable tab is a span (a button inside the tab's
|
|
892
|
+
* <a> is invalid): Enter/Space on it does what a click does. */
|
|
893
|
+
let key_handler = ev => {
|
|
894
|
+
if(ev.key !== "Enter" && ev.key !== " ") {
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
let target = ev.target;
|
|
898
|
+
if(!target || !target.closest || !target.closest("[data-close-item]")) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
handler(ev);
|
|
902
|
+
};
|
|
903
|
+
$container.addEventListener("keydown", key_handler);
|
|
904
|
+
priv.key_handler = key_handler;
|
|
867
905
|
}
|
|
868
906
|
|
|
869
907
|
|
|
@@ -972,8 +1010,9 @@ function ac_route_changed(gobj, event, kw, src)
|
|
|
972
1010
|
|
|
973
1011
|
function css_escape(s)
|
|
974
1012
|
{
|
|
975
|
-
/*
|
|
976
|
-
|
|
1013
|
+
/* For a quoted attribute selector: a backslash too, or a route
|
|
1014
|
+
* carrying one makes querySelector throw. */
|
|
1015
|
+
return String(s).replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
977
1016
|
}
|
|
978
1017
|
|
|
979
1018
|
/***************************************************************
|
package/src/c_yui_pager.js
CHANGED
|
@@ -148,7 +148,9 @@ function build_ui(gobj)
|
|
|
148
148
|
['div', {class: 'C_YUI_PAGER', style: 'height:100%; display:flex; flex-direction:column;'}, [
|
|
149
149
|
['div', {class: 'yui-pager-header is-flex is-align-items-center is-flex-grow-0',
|
|
150
150
|
style: 'gap:.25rem; padding:.25rem .25rem;'}, [
|
|
151
|
-
['button', {class: 'yui-pager-back button is-white is-hidden',
|
|
151
|
+
['button', {class: 'yui-pager-back button is-white is-hidden',
|
|
152
|
+
title: t('back'), 'data-i18n-title': 'back',
|
|
153
|
+
'aria-label': t('back'), 'data-i18n-aria-label': 'back'}, [
|
|
152
154
|
['span', {class: 'icon'}, ['i', {class: 'yi-arrow-left'}]]
|
|
153
155
|
], {
|
|
154
156
|
click: function(evt) {
|
|
@@ -157,7 +159,9 @@ function build_ui(gobj)
|
|
|
157
159
|
}
|
|
158
160
|
}],
|
|
159
161
|
['span', {class: 'yui-pager-title is-flex-grow-1', style: 'font-weight:600;'}, ''],
|
|
160
|
-
['button', {class: 'yui-pager-discard button is-white is-hidden',
|
|
162
|
+
['button', {class: 'yui-pager-discard button is-white is-hidden',
|
|
163
|
+
title: t('discard'), 'data-i18n-title': 'discard',
|
|
164
|
+
'aria-label': t('discard'), 'data-i18n-aria-label': 'discard'}, [
|
|
161
165
|
['span', {class: 'icon'}, ['i', {class: 'yi-broom'}]],
|
|
162
166
|
['span', {class: 'is-hidden-mobile', i18n: 'discard'}, 'discard']
|
|
163
167
|
], {
|
|
@@ -233,13 +237,14 @@ function render_header(gobj)
|
|
|
233
237
|
* deeper pages show a back arrow.
|
|
234
238
|
*/
|
|
235
239
|
let $back_icon = $back.querySelector('i');
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
let back_key = (model.back_kind === "close") ? 'close' : 'back';
|
|
241
|
+
$back_icon.className = (back_key === 'close') ? 'yi-xmark' : 'yi-arrow-left';
|
|
242
|
+
/* The key moves with the glyph: a key left on "back" made the ✕ of
|
|
243
|
+
* the root page announce itself as Back after a language switch. */
|
|
244
|
+
$back.setAttribute('title', t(back_key));
|
|
245
|
+
$back.setAttribute('data-i18n-title', back_key);
|
|
246
|
+
$back.setAttribute('aria-label', t(back_key));
|
|
247
|
+
$back.setAttribute('data-i18n-aria-label', back_key);
|
|
243
248
|
$discard.classList.toggle('is-hidden', !model.show_discard);
|
|
244
249
|
/* render_header runs on every push/pop/replace, AFTER the host's
|
|
245
250
|
* one-time refresh_language($container,t), so the title must be
|
package/src/c_yui_period.js
CHANGED
|
@@ -563,10 +563,13 @@ function build_ui(gobj)
|
|
|
563
563
|
|
|
564
564
|
function build_mode_button(gobj, mode)
|
|
565
565
|
{
|
|
566
|
+
/* The name is COMPOSED for a bucket (period_name), so it carries no
|
|
567
|
+
* key: ac_language_changed() rewrites the text and both names. */
|
|
568
|
+
let name = mode_name(mode);
|
|
566
569
|
let $btn = createElement2(
|
|
567
570
|
["button", {class: `button YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
|
|
568
|
-
type: "button"},
|
|
569
|
-
[["span", {class: "YUI_PERIOD_MODE_TEXT"},
|
|
571
|
+
type: "button", title: name, "aria-label": name},
|
|
572
|
+
[["span", {class: "YUI_PERIOD_MODE_TEXT"}, name]]
|
|
570
573
|
]);
|
|
571
574
|
$btn.addEventListener("click", () => {
|
|
572
575
|
gobj_send_event(gobj, "EV_SET_MODE", {mode: mode.id}, gobj);
|
|
@@ -588,10 +591,12 @@ function build_more_menu(gobj)
|
|
|
588
591
|
if(!mode.overflow) {
|
|
589
592
|
continue;
|
|
590
593
|
}
|
|
594
|
+
let name = mode_name(mode);
|
|
591
595
|
let $item = createElement2(
|
|
592
596
|
["a", {class: `dropdown-item YUI_PERIOD_MODE ` +
|
|
593
|
-
`YUI_PERIOD_MODE_${mode.id.toUpperCase()}`, href: "#"
|
|
594
|
-
|
|
597
|
+
`YUI_PERIOD_MODE_${mode.id.toUpperCase()}`, href: "#",
|
|
598
|
+
title: name, "aria-label": name},
|
|
599
|
+
[["span", {class: "YUI_PERIOD_MODE_TEXT"}, name]]
|
|
595
600
|
]);
|
|
596
601
|
$item.addEventListener("click", (ev) => {
|
|
597
602
|
ev.preventDefault();
|
|
@@ -996,7 +1001,9 @@ function render_calendar(gobj)
|
|
|
996
1001
|
: build_years_grid(gobj, view);
|
|
997
1002
|
|
|
998
1003
|
let $today = createElement2(
|
|
999
|
-
["button", {class: "button is-ghost mt-2 YUI_PERIOD_CAL_TODAY", type: "button"
|
|
1004
|
+
["button", {class: "button is-ghost mt-2 YUI_PERIOD_CAL_TODAY", type: "button",
|
|
1005
|
+
title: t("today"), "data-i18n-title": "today",
|
|
1006
|
+
"aria-label": t("today"), "data-i18n-aria-label": "today"},
|
|
1000
1007
|
[["span", {"data-i18n": "today"}, t("today")]]
|
|
1001
1008
|
]);
|
|
1002
1009
|
$today.addEventListener("click", () => {
|
|
@@ -1357,10 +1364,13 @@ function ac_language_changed(gobj, event, kw, src)
|
|
|
1357
1364
|
if(!mode.$btn) {
|
|
1358
1365
|
continue;
|
|
1359
1366
|
}
|
|
1367
|
+
let name = mode_name(mode);
|
|
1360
1368
|
let $text = mode.$btn.querySelector(".YUI_PERIOD_MODE_TEXT");
|
|
1361
1369
|
if($text) {
|
|
1362
|
-
$text.textContent =
|
|
1370
|
+
$text.textContent = name;
|
|
1363
1371
|
}
|
|
1372
|
+
mode.$btn.setAttribute("title", name);
|
|
1373
|
+
mode.$btn.setAttribute("aria-label", name);
|
|
1364
1374
|
}
|
|
1365
1375
|
repaint(gobj);
|
|
1366
1376
|
if(priv.$calendar) {
|