@yuneta/gobj-ui 7.23.115 → 7.23.117
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/dist/gobj-ui.cjs.js +48 -10
- package/dist/gobj-ui.es.js +48 -10
- package/package.json +1 -1
- package/src/c_yui_form.js +33 -0
- package/src/c_yui_treedb_graph.js +13 -2
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -7219,6 +7219,30 @@ function destroy_ui$10(gobj) {
|
|
|
7219
7219
|
/******************************************************************
|
|
7220
7220
|
* Build form with bulma and createElement2
|
|
7221
7221
|
******************************************************************/
|
|
7222
|
+
/************************************************************
|
|
7223
|
+
* Put the field's NAME on its control.
|
|
7224
|
+
*
|
|
7225
|
+
* The label of a field is written `<label for={name}>` -- and
|
|
7226
|
+
* `for` matches an **id**, which no control here sets: they
|
|
7227
|
+
* carry `name`. So the association reads right in the source
|
|
7228
|
+
* and does not exist in the document, and every field of every
|
|
7229
|
+
* form of this library was unlabelled for anything that is not
|
|
7230
|
+
* an eye.
|
|
7231
|
+
*
|
|
7232
|
+
* `aria-label` and not an `id`: two forms can be open at once
|
|
7233
|
+
* (a record in a window and another in a modal), and duplicate
|
|
7234
|
+
* ids would break the association for both. The key is the
|
|
7235
|
+
* label's own, so a language change reaches it.
|
|
7236
|
+
************************************************************/
|
|
7237
|
+
function name_form_control($field, conf) {
|
|
7238
|
+
if (!$field || typeof $field.querySelector !== "function" || !conf) return;
|
|
7239
|
+
let key = conf.label_i18n || conf.label || "";
|
|
7240
|
+
if (!key) return;
|
|
7241
|
+
let $control = $field.querySelector("input, select, textarea");
|
|
7242
|
+
if (!$control || $control.getAttribute("aria-label")) return;
|
|
7243
|
+
$control.setAttribute("aria-label", (0, i18next.t)(key));
|
|
7244
|
+
$control.setAttribute("data-i18n-aria-label", key);
|
|
7245
|
+
}
|
|
7222
7246
|
function build_form(gobj) {
|
|
7223
7247
|
let form_id = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "form_id");
|
|
7224
7248
|
let $form = (0, _yuneta_gobj_js.createElement2)(["form", {
|
|
@@ -7255,6 +7279,7 @@ function build_html_form(gobj, $form, prefix, template) {
|
|
|
7255
7279
|
if (placeholders[key]) html_field_conf.placeholder = placeholders[key];
|
|
7256
7280
|
if (html_field_conf.tag) {
|
|
7257
7281
|
let $field = create_form_field(gobj, $form, prefix, field_desc, html_field_conf);
|
|
7282
|
+
name_form_control($field, html_field_conf);
|
|
7258
7283
|
$form.appendChild($field);
|
|
7259
7284
|
}
|
|
7260
7285
|
});
|
|
@@ -62697,6 +62722,14 @@ function make_toolbar(gobj) {
|
|
|
62697
62722
|
let priv = gobj.priv;
|
|
62698
62723
|
let modes = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "operation_modes");
|
|
62699
62724
|
if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "readonly")) modes = modes.filter((mode) => mode !== "edition");
|
|
62725
|
+
let mode_options = modes.map((item) => [
|
|
62726
|
+
"option",
|
|
62727
|
+
{
|
|
62728
|
+
value: item,
|
|
62729
|
+
"data-i18n": item
|
|
62730
|
+
},
|
|
62731
|
+
option_label(item)
|
|
62732
|
+
]);
|
|
62700
62733
|
let left_items = [
|
|
62701
62734
|
[
|
|
62702
62735
|
"span",
|
|
@@ -62710,7 +62743,13 @@ function make_toolbar(gobj) {
|
|
|
62710
62743
|
[
|
|
62711
62744
|
"div",
|
|
62712
62745
|
{ class: "select" },
|
|
62713
|
-
[["select", {
|
|
62746
|
+
[["select", {
|
|
62747
|
+
class: "GRAPH_LAYOUT_SELECT",
|
|
62748
|
+
title: (0, i18next.t)("layout"),
|
|
62749
|
+
"data-i18n-title": "layout",
|
|
62750
|
+
"aria-label": (0, i18next.t)("layout"),
|
|
62751
|
+
"data-i18n-aria-label": "layout"
|
|
62752
|
+
}]],
|
|
62714
62753
|
{ change: (evt) => {
|
|
62715
62754
|
evt.stopPropagation();
|
|
62716
62755
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_LAYOUT", { layout: evt.target.value }, gobj);
|
|
@@ -62730,15 +62769,14 @@ function make_toolbar(gobj) {
|
|
|
62730
62769
|
{ class: "select" },
|
|
62731
62770
|
[[
|
|
62732
62771
|
"select",
|
|
62733
|
-
{
|
|
62734
|
-
|
|
62735
|
-
"
|
|
62736
|
-
|
|
62737
|
-
|
|
62738
|
-
|
|
62739
|
-
|
|
62740
|
-
|
|
62741
|
-
])
|
|
62772
|
+
{
|
|
62773
|
+
class: "GRAPH_MODE_SELECT",
|
|
62774
|
+
title: (0, i18next.t)("operation mode"),
|
|
62775
|
+
"data-i18n-title": "operation mode",
|
|
62776
|
+
"aria-label": (0, i18next.t)("operation mode"),
|
|
62777
|
+
"data-i18n-aria-label": "operation mode"
|
|
62778
|
+
},
|
|
62779
|
+
mode_options
|
|
62742
62780
|
]],
|
|
62743
62781
|
{ change: (evt) => {
|
|
62744
62782
|
evt.stopPropagation();
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -7214,6 +7214,30 @@ function destroy_ui$10(gobj) {
|
|
|
7214
7214
|
/******************************************************************
|
|
7215
7215
|
* Build form with bulma and createElement2
|
|
7216
7216
|
******************************************************************/
|
|
7217
|
+
/************************************************************
|
|
7218
|
+
* Put the field's NAME on its control.
|
|
7219
|
+
*
|
|
7220
|
+
* The label of a field is written `<label for={name}>` -- and
|
|
7221
|
+
* `for` matches an **id**, which no control here sets: they
|
|
7222
|
+
* carry `name`. So the association reads right in the source
|
|
7223
|
+
* and does not exist in the document, and every field of every
|
|
7224
|
+
* form of this library was unlabelled for anything that is not
|
|
7225
|
+
* an eye.
|
|
7226
|
+
*
|
|
7227
|
+
* `aria-label` and not an `id`: two forms can be open at once
|
|
7228
|
+
* (a record in a window and another in a modal), and duplicate
|
|
7229
|
+
* ids would break the association for both. The key is the
|
|
7230
|
+
* label's own, so a language change reaches it.
|
|
7231
|
+
************************************************************/
|
|
7232
|
+
function name_form_control($field, conf) {
|
|
7233
|
+
if (!$field || typeof $field.querySelector !== "function" || !conf) return;
|
|
7234
|
+
let key = conf.label_i18n || conf.label || "";
|
|
7235
|
+
if (!key) return;
|
|
7236
|
+
let $control = $field.querySelector("input, select, textarea");
|
|
7237
|
+
if (!$control || $control.getAttribute("aria-label")) return;
|
|
7238
|
+
$control.setAttribute("aria-label", t(key));
|
|
7239
|
+
$control.setAttribute("data-i18n-aria-label", key);
|
|
7240
|
+
}
|
|
7217
7241
|
function build_form(gobj) {
|
|
7218
7242
|
let form_id = gobj_read_str_attr(gobj, "form_id");
|
|
7219
7243
|
let $form = createElement2(["form", {
|
|
@@ -7250,6 +7274,7 @@ function build_html_form(gobj, $form, prefix, template) {
|
|
|
7250
7274
|
if (placeholders[key]) html_field_conf.placeholder = placeholders[key];
|
|
7251
7275
|
if (html_field_conf.tag) {
|
|
7252
7276
|
let $field = create_form_field(gobj, $form, prefix, field_desc, html_field_conf);
|
|
7277
|
+
name_form_control($field, html_field_conf);
|
|
7253
7278
|
$form.appendChild($field);
|
|
7254
7279
|
}
|
|
7255
7280
|
});
|
|
@@ -62692,6 +62717,14 @@ function make_toolbar(gobj) {
|
|
|
62692
62717
|
let priv = gobj.priv;
|
|
62693
62718
|
let modes = gobj_read_attr(gobj, "operation_modes");
|
|
62694
62719
|
if (gobj_read_bool_attr(gobj, "readonly")) modes = modes.filter((mode) => mode !== "edition");
|
|
62720
|
+
let mode_options = modes.map((item) => [
|
|
62721
|
+
"option",
|
|
62722
|
+
{
|
|
62723
|
+
value: item,
|
|
62724
|
+
"data-i18n": item
|
|
62725
|
+
},
|
|
62726
|
+
option_label(item)
|
|
62727
|
+
]);
|
|
62695
62728
|
let left_items = [
|
|
62696
62729
|
[
|
|
62697
62730
|
"span",
|
|
@@ -62705,7 +62738,13 @@ function make_toolbar(gobj) {
|
|
|
62705
62738
|
[
|
|
62706
62739
|
"div",
|
|
62707
62740
|
{ class: "select" },
|
|
62708
|
-
[["select", {
|
|
62741
|
+
[["select", {
|
|
62742
|
+
class: "GRAPH_LAYOUT_SELECT",
|
|
62743
|
+
title: t("layout"),
|
|
62744
|
+
"data-i18n-title": "layout",
|
|
62745
|
+
"aria-label": t("layout"),
|
|
62746
|
+
"data-i18n-aria-label": "layout"
|
|
62747
|
+
}]],
|
|
62709
62748
|
{ change: (evt) => {
|
|
62710
62749
|
evt.stopPropagation();
|
|
62711
62750
|
gobj_send_event(gobj, "EV_SET_LAYOUT", { layout: evt.target.value }, gobj);
|
|
@@ -62725,15 +62764,14 @@ function make_toolbar(gobj) {
|
|
|
62725
62764
|
{ class: "select" },
|
|
62726
62765
|
[[
|
|
62727
62766
|
"select",
|
|
62728
|
-
{
|
|
62729
|
-
|
|
62730
|
-
"
|
|
62731
|
-
|
|
62732
|
-
|
|
62733
|
-
|
|
62734
|
-
|
|
62735
|
-
|
|
62736
|
-
])
|
|
62767
|
+
{
|
|
62768
|
+
class: "GRAPH_MODE_SELECT",
|
|
62769
|
+
title: t("operation mode"),
|
|
62770
|
+
"data-i18n-title": "operation mode",
|
|
62771
|
+
"aria-label": t("operation mode"),
|
|
62772
|
+
"data-i18n-aria-label": "operation mode"
|
|
62773
|
+
},
|
|
62774
|
+
mode_options
|
|
62737
62775
|
]],
|
|
62738
62776
|
{ change: (evt) => {
|
|
62739
62777
|
evt.stopPropagation();
|
package/package.json
CHANGED
package/src/c_yui_form.js
CHANGED
|
@@ -490,6 +490,38 @@ function destroy_ui(gobj)
|
|
|
490
490
|
/******************************************************************
|
|
491
491
|
* Build form with bulma and createElement2
|
|
492
492
|
******************************************************************/
|
|
493
|
+
/************************************************************
|
|
494
|
+
* Put the field's NAME on its control.
|
|
495
|
+
*
|
|
496
|
+
* The label of a field is written `<label for={name}>` -- and
|
|
497
|
+
* `for` matches an **id**, which no control here sets: they
|
|
498
|
+
* carry `name`. So the association reads right in the source
|
|
499
|
+
* and does not exist in the document, and every field of every
|
|
500
|
+
* form of this library was unlabelled for anything that is not
|
|
501
|
+
* an eye.
|
|
502
|
+
*
|
|
503
|
+
* `aria-label` and not an `id`: two forms can be open at once
|
|
504
|
+
* (a record in a window and another in a modal), and duplicate
|
|
505
|
+
* ids would break the association for both. The key is the
|
|
506
|
+
* label's own, so a language change reaches it.
|
|
507
|
+
************************************************************/
|
|
508
|
+
function name_form_control($field, conf)
|
|
509
|
+
{
|
|
510
|
+
if(!$field || typeof $field.querySelector !== "function" || !conf) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
let key = conf.label_i18n || conf.label || "";
|
|
514
|
+
if(!key) {
|
|
515
|
+
return; /* a field with no label names nothing */
|
|
516
|
+
}
|
|
517
|
+
let $control = $field.querySelector("input, select, textarea");
|
|
518
|
+
if(!$control || $control.getAttribute("aria-label")) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
$control.setAttribute("aria-label", t(key));
|
|
522
|
+
$control.setAttribute("data-i18n-aria-label", key);
|
|
523
|
+
}
|
|
524
|
+
|
|
493
525
|
function build_form(gobj)
|
|
494
526
|
{
|
|
495
527
|
let form_id = gobj_read_str_attr(gobj, "form_id");
|
|
@@ -566,6 +598,7 @@ function build_html_form(gobj, $form, prefix, template)
|
|
|
566
598
|
*/
|
|
567
599
|
if(html_field_conf.tag) {
|
|
568
600
|
let $field = create_form_field(gobj, $form, prefix, field_desc, html_field_conf);
|
|
601
|
+
name_form_control($field, html_field_conf);
|
|
569
602
|
$form.appendChild($field);
|
|
570
603
|
}
|
|
571
604
|
});
|
|
@@ -699,9 +699,17 @@ function make_toolbar(gobj)
|
|
|
699
699
|
* via populate_nodes_tree_options()
|
|
700
700
|
*/
|
|
701
701
|
let left_items = [
|
|
702
|
+
/* The rótulo beside a select is a SPAN: it names it for the eye
|
|
703
|
+
* and for nothing else -- and it is `is-hidden-mobile`, so on a
|
|
704
|
+
* phone even the eye loses it and the control says only its
|
|
705
|
+
* current value. The name goes on the select, and a `title`
|
|
706
|
+
* with it, which is what carries the meaning where the label
|
|
707
|
+
* is gone. */
|
|
702
708
|
['span', {class: 'GRAPH_LAYOUT_LABEL is-hidden-mobile', style: 'padding-right:5px;', i18n: 'layout'}, 'layout'],
|
|
703
709
|
['div', {class: 'select'}, [
|
|
704
|
-
['select', {class: 'GRAPH_LAYOUT_SELECT'
|
|
710
|
+
['select', {class: 'GRAPH_LAYOUT_SELECT',
|
|
711
|
+
title: t('layout'), 'data-i18n-title': 'layout',
|
|
712
|
+
'aria-label': t('layout'), 'data-i18n-aria-label': 'layout'}]
|
|
705
713
|
], {
|
|
706
714
|
change: (evt) => {
|
|
707
715
|
evt.stopPropagation();
|
|
@@ -711,7 +719,10 @@ function make_toolbar(gobj)
|
|
|
711
719
|
|
|
712
720
|
['span', {class: 'GRAPH_MODE_LABEL is-hidden-mobile', style: 'padding-left:10px; padding-right:5px;', i18n: 'operation mode'}, 'operation mode'],
|
|
713
721
|
['div', {class: 'select'}, [
|
|
714
|
-
['select', {class: 'GRAPH_MODE_SELECT'
|
|
722
|
+
['select', {class: 'GRAPH_MODE_SELECT',
|
|
723
|
+
title: t('operation mode'), 'data-i18n-title': 'operation mode',
|
|
724
|
+
'aria-label': t('operation mode'),
|
|
725
|
+
'data-i18n-aria-label': 'operation mode'}, mode_options]
|
|
715
726
|
], {
|
|
716
727
|
change: (evt) => {
|
|
717
728
|
evt.stopPropagation();
|