Commit 6b4ca5cd authored by Carsten  Rose's avatar Carsten Rose
Browse files

Implements #9655. Checkboxes and radios now defined with a min-width in horizontal plain mode.

parent 05e19ddd
Pipeline #2795 passed with stages
in 2 minutes and 34 seconds
......@@ -2611,6 +2611,8 @@ Parameter
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| requiredPosition | int | See requiredPosition_ . |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| minWidth | int | See checkboxRadioMinWidth_ . |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
* Example:
......@@ -3144,6 +3146,8 @@ See also at specific *FormElement* definitions.
| dataReference | string | Optional. See `applicationTest`_ |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| requiredPosition | int | See requiredPosition_ . |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| minWidth | int | See checkboxRadioMinWidth . |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
......@@ -3214,6 +3218,15 @@ extraButtonInfo
will be applied. E.g. this might be `pull-right` to align the `info` button/icon on the right side below the input element.
.. _`checkboxRadioMinWidth`:
Checkbox / Radio: minWidth
^^^^^^^^^^^^^^^^^^^^^^^^^^
Checkbox and Radio Elements, shown in plain horizontal mode, receives a minWidth to align them. The default is 80px and
might be defined per Form or per FormElement.
.. _`requiredPosition`:
Required Position
......@@ -3228,6 +3241,9 @@ The default is 'label-right'.
The definition can be set per Form (=affects all FormElements) or per FormElement.
.. _`input-checkbox`:
Type: checkbox
......
......@@ -2244,6 +2244,8 @@ abstract class AbstractBuildForm {
$attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
$attributeBaseLabel = Support::doAttribute('style', 'min-width: ' . $formElement[F_FE_MIN_WIDTH] . 'px;');
$key = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, 'h');
$htmlHidden = $this->buildNativeHidden($key, '');
......@@ -2293,7 +2295,7 @@ abstract class AbstractBuildForm {
$htmlElement = Support::wrapTag('<label>', $htmlElement);
}
$htmlElement = Support::wrapTag("<label class='$checkboxClass'>", $htmlElement, true);
$htmlElement = Support::wrapTag("<label class='$checkboxClass' $attributeBaseLabel>", $htmlElement, true);
// control orientation
if ($formElement[FE_MAX_LENGTH] > 1) {
......@@ -2508,6 +2510,8 @@ abstract class AbstractBuildForm {
$attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]);
$attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
$attributeBaseLabel = Support::doAttribute('style', 'min-width: ' . $formElement[F_FE_MIN_WIDTH] . 'px;');
$jj = 0;
$orientation = ($formElement[FE_MAX_LENGTH] > 1) ? ALIGN_HORIZONTAL : ALIGN_VERTICAL;
......@@ -2515,7 +2519,7 @@ abstract class AbstractBuildForm {
if ($formElement[FE_MODE] == FE_MODE_READONLY) {
$radioClass .= ' qfq-disabled';
}
$radioOuterTag = ($orientation === ALIGN_HORIZONTAL) ? 'label' : 'div';
$radioOuterTag = ($orientation === ALIGN_HORIZONTAL) ? "label $attributeBaseLabel" : 'div';
$br = '';
$attribute = $attributeBase;
......@@ -2541,7 +2545,7 @@ abstract class AbstractBuildForm {
// With ALIGN_HORIZONTAL: the label causes some trouble: skip it
if (($orientation === ALIGN_VERTICAL)) {
$htmlElement = Support::wrapTag('<label>', $htmlElement);
$htmlElement = Support::wrapTag("<label>", $htmlElement);
}
if ($formElement[FE_MAX_LENGTH] > 1) {
......
......@@ -985,6 +985,9 @@ const F_FE_REQUIRED_POSITION_INPUT_RIGHT = 'input-right';
const F_FE_REQUIRED_POSITION_NOTE_LEFT = 'note-left';
const F_FE_REQUIRED_POSITION_NOTE_RIGHT = 'note-right';
const F_FE_MIN_WIDTH = 'minWidth';
const F_FE_MIN_WIDTH_DEFAULT = '80';
const F_PARAMETER = 'parameter'; // valid for F_ and FE_
// Form columns: via parameter field
......
......@@ -284,6 +284,7 @@ class HelperFormElement {
$feSpecNative[$key][F_FE_LABEL_ALIGN] = $formSpec[F_FE_LABEL_ALIGN];
}
Support::setIfNotSet($feSpecNative[$key], F_FE_REQUIRED_POSITION, $formSpec[F_FE_REQUIRED_POSITION]);
Support::setIfNotSet($feSpecNative[$key], F_FE_MIN_WIDTH, $formSpec[F_FE_MIN_WIDTH]);
}
return $feSpecNative;
......
......@@ -1333,7 +1333,7 @@ class QuickFormQuery {
/**
* The named $keys will be synced between STORE_SYSTEM and $formSpec (both directions).
* The per form definition has precedence over STORE_SYSTEM.
* STORE_SYSTEM if filled with the default values (config.qfq.php or if note exist than QFQ hardcoded)
* STORE_SYSTEM if filled with the default values (config.qfq.php or if not exist than QFQ hardcoded)
* Copying the 'Form' definition back to the system store helps to access the values
* by '{{ ...:Y}}' (system store). E.g. the value of bs-*-columns might be displayed as placeholder in the
* corresponding input field.
......@@ -1440,6 +1440,7 @@ class QuickFormQuery {
Support::setIfNotSet($formSpec, F_SESSION_TIMEOUT_SECONDS, $this->store->getVar(SYSTEM_SESSION_TIMEOUT_SECONDS, STORE_SYSTEM));
Support::setIfNotSet($formSpec, F_FE_REQUIRED_POSITION, F_FE_REQUIRED_POSITION_LABEL_RIGHT);
Support::setIfNotSet($formSpec, F_MULTI_MSG_NO_RECORD, F_MULTI_MSG_NO_RECORD_TEXT);
Support::setIfNotSet($formSpec, F_FE_MIN_WIDTH, F_FE_MIN_WIDTH_DEFAULT);
// In case there is no F_MODE defined on the form, check if there is one in STORE_SIP.
if ($formSpec[F_MODE] == '') {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment