@yuneta/gobj-ui 7.23.55 → 7.23.56
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 +7 -2
- package/dist/gobj-ui.es.js +7 -2
- package/package.json +1 -1
- package/src/c_yui_form.css +22 -0
- package/src/c_yui_form.js +21 -4
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -7515,7 +7515,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
7515
7515
|
$extend.dataset.form_tag = tag;
|
|
7516
7516
|
$extend.dataset.form_input_type = inputType;
|
|
7517
7517
|
$extend.classList.add("yui-form-data-input");
|
|
7518
|
-
apply_readonly_to_control(readonly, tag, $extend);
|
|
7518
|
+
apply_readonly_to_control(readonly, tag, inputType, $extend);
|
|
7519
7519
|
}
|
|
7520
7520
|
return $element;
|
|
7521
7521
|
}
|
|
@@ -7536,7 +7536,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
7536
7536
|
* control is still read -- unlike in a native submit, where it would
|
|
7537
7537
|
* be dropped.
|
|
7538
7538
|
******************************************************************/
|
|
7539
|
-
function apply_readonly_to_control(readonly, tag, $extend) {
|
|
7539
|
+
function apply_readonly_to_control(readonly, tag, inputType, $extend) {
|
|
7540
7540
|
if (!readonly) return;
|
|
7541
7541
|
switch (tag) {
|
|
7542
7542
|
case "select":
|
|
@@ -7547,6 +7547,11 @@ function apply_readonly_to_control(readonly, tag, $extend) {
|
|
|
7547
7547
|
case "select2":
|
|
7548
7548
|
$extend.setAttribute("disabled", "disabled");
|
|
7549
7549
|
if ($extend.tom_select) $extend.tom_select.disable();
|
|
7550
|
+
break;
|
|
7551
|
+
case "jsoneditor":
|
|
7552
|
+
$extend.classList.add("yui-jse-readonly");
|
|
7553
|
+
break;
|
|
7554
|
+
case "input": if (inputType === "color") $extend.setAttribute("disabled", "disabled");
|
|
7550
7555
|
}
|
|
7551
7556
|
}
|
|
7552
7557
|
/******************************************************************
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -7510,7 +7510,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
7510
7510
|
$extend.dataset.form_tag = tag;
|
|
7511
7511
|
$extend.dataset.form_input_type = inputType;
|
|
7512
7512
|
$extend.classList.add("yui-form-data-input");
|
|
7513
|
-
apply_readonly_to_control(readonly, tag, $extend);
|
|
7513
|
+
apply_readonly_to_control(readonly, tag, inputType, $extend);
|
|
7514
7514
|
}
|
|
7515
7515
|
return $element;
|
|
7516
7516
|
}
|
|
@@ -7531,7 +7531,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
7531
7531
|
* control is still read -- unlike in a native submit, where it would
|
|
7532
7532
|
* be dropped.
|
|
7533
7533
|
******************************************************************/
|
|
7534
|
-
function apply_readonly_to_control(readonly, tag, $extend) {
|
|
7534
|
+
function apply_readonly_to_control(readonly, tag, inputType, $extend) {
|
|
7535
7535
|
if (!readonly) return;
|
|
7536
7536
|
switch (tag) {
|
|
7537
7537
|
case "select":
|
|
@@ -7542,6 +7542,11 @@ function apply_readonly_to_control(readonly, tag, $extend) {
|
|
|
7542
7542
|
case "select2":
|
|
7543
7543
|
$extend.setAttribute("disabled", "disabled");
|
|
7544
7544
|
if ($extend.tom_select) $extend.tom_select.disable();
|
|
7545
|
+
break;
|
|
7546
|
+
case "jsoneditor":
|
|
7547
|
+
$extend.classList.add("yui-jse-readonly");
|
|
7548
|
+
break;
|
|
7549
|
+
case "input": if (inputType === "color") $extend.setAttribute("disabled", "disabled");
|
|
7545
7550
|
}
|
|
7546
7551
|
}
|
|
7547
7552
|
/******************************************************************
|
package/package.json
CHANGED
package/src/c_yui_form.css
CHANGED
|
@@ -57,3 +57,25 @@
|
|
|
57
57
|
overscroll-behavior: contain;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
|
|
61
|
+
/* A colour that cannot be changed. `readonly` does not apply to a colour
|
|
62
|
+
* input (the spec lists the types it applies to and colour is not one),
|
|
63
|
+
* so it is `disabled` instead -- and a disabled swatch is drawn by the
|
|
64
|
+
* browser as a pale ghost of itself, which loses the one thing the field
|
|
65
|
+
* is for: seeing the colour. Keep the swatch, lose the affordance. */
|
|
66
|
+
.C_YUI_FORM input[type="color"][disabled] {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
cursor: default;
|
|
69
|
+
border-color: var(--bulma-border, #dbdbdb);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* A json document that cannot be edited. The editor is read-only for
|
|
73
|
+
* real (`readOnly` at build time); this is what makes it LOOK it --
|
|
74
|
+
* the menu bar is the whole invitation, and it offers nothing that
|
|
75
|
+
* reading needs. */
|
|
76
|
+
.C_YUI_FORM .yui-jse-readonly .jse-menu {
|
|
77
|
+
display: none !important;
|
|
78
|
+
}
|
|
79
|
+
.C_YUI_FORM .yui-jse-readonly {
|
|
80
|
+
background-color: var(--bulma-background, #f5f5f5);
|
|
81
|
+
}
|
package/src/c_yui_form.js
CHANGED
|
@@ -1450,7 +1450,7 @@ function create_form_field(
|
|
|
1450
1450
|
$extend.dataset.form_input_type = inputType;
|
|
1451
1451
|
$extend.classList.add('yui-form-data-input');
|
|
1452
1452
|
|
|
1453
|
-
apply_readonly_to_control(readonly, tag, $extend);
|
|
1453
|
+
apply_readonly_to_control(readonly, tag, inputType, $extend);
|
|
1454
1454
|
}
|
|
1455
1455
|
|
|
1456
1456
|
return $element;
|
|
@@ -1473,7 +1473,7 @@ function create_form_field(
|
|
|
1473
1473
|
* control is still read -- unlike in a native submit, where it would
|
|
1474
1474
|
* be dropped.
|
|
1475
1475
|
******************************************************************/
|
|
1476
|
-
function apply_readonly_to_control(readonly, tag, $extend)
|
|
1476
|
+
function apply_readonly_to_control(readonly, tag, inputType, $extend)
|
|
1477
1477
|
{
|
|
1478
1478
|
if(!readonly) {
|
|
1479
1479
|
return;
|
|
@@ -1491,9 +1491,26 @@ function apply_readonly_to_control(readonly, tag, $extend)
|
|
|
1491
1491
|
$extend.tom_select.disable();
|
|
1492
1492
|
}
|
|
1493
1493
|
break;
|
|
1494
|
+
case 'jsoneditor':
|
|
1495
|
+
/* It IS read-only -- `readOnly` went to the editor when it was
|
|
1496
|
+
* built -- and it did not LOOK it: a json editor with its menu
|
|
1497
|
+
* bar on top invites an edit it will discard. The class mutes
|
|
1498
|
+
* it (c_yui_form.css), which is the same thing a readonly
|
|
1499
|
+
* `input` has done since it existed. */
|
|
1500
|
+
$extend.classList.add('yui-jse-readonly');
|
|
1501
|
+
break;
|
|
1502
|
+
case 'input':
|
|
1503
|
+
/* `readonly` does not apply to a colour input -- the spec lists
|
|
1504
|
+
* the types it applies to and colour is not one of them -- so
|
|
1505
|
+
* the swatch opens its picker and the value changes, and in a
|
|
1506
|
+
* form that only sends writable cols the change is then
|
|
1507
|
+
* silently dropped. Date and time DO honour it, and keep it:
|
|
1508
|
+
* readonly stays selectable and copyable, disabled does not. */
|
|
1509
|
+
if(inputType === 'color') {
|
|
1510
|
+
$extend.setAttribute("disabled", "disabled");
|
|
1511
|
+
}
|
|
1512
|
+
break;
|
|
1494
1513
|
default:
|
|
1495
|
-
/* A text control already carries `readonly`, which is the
|
|
1496
|
-
* better of the two: it stays selectable and copyable. */
|
|
1497
1514
|
break;
|
|
1498
1515
|
}
|
|
1499
1516
|
}
|