" )
- .addClass( "arrow" )
- .addClass( feedback.vertical )
- .addClass( feedback.horizontal )
- .appendTo( this );
- }
- }
- })
- .off( "mouseover mouseout" )
- .on( "mouseover", function(event){
- event.stopImmediatePropagation();
- var jMe = $(this);
- $(this).data('openTimeoutId', setTimeout(function() {
- jMe.tooltip('open');
- }, 500));
- })
- .on( "mouseout", function(event){
- event.stopImmediatePropagation();
- clearTimeout($(this).data('openTimeoutId'));
- });
- /*
- .on( "click", function(){
- var sDataId = $(this).attr('data-attcode');
- if ($('.tooltip-close-button[data-attcode="'+sDataId+'"]').length == 0)
- {
- $(this).tooltip( 'open' );
- }
- else
- {
- $(this).tooltip( 'close' );
- }
- $( this ).unbind( "mouseleave" );
- return false;
- });
- */
-
- $('body').on('click', '.tooltip-close-button', function() {
- var sDataId = $(this).attr('data-attcode');
- $('#'+me.sId+' .tfs_advanced[data-attcode="'+sDataId+'"]').tooltip('close');
- });
- this.element.parent().on("click", ":not(.tooltip-tfs *,.tooltip-tfs)", function(){
- me.close_all_tooltips();
+ _make_tooltips: function () {
+ var me = this;
+ $('#'+this.sId+' .tfs_advanced').each(function (index, elt) {
+ var sDataAttcode = $(elt).attr('data-attcode');
+ var sTooltipContent = me._get_tooltip_content(sDataAttcode);
+ tippy(elt, {
+ 'content': sTooltipContent,
+ allowHTML: true,
+ interactive: true,
+ zIndex: 9999,
+ role: 'tooltip',
+ popperOptions: {
+ strategy: 'fixed'
+ }
+ });
});
+
},
- _get_tooltip_content: function(sDataAttCode)
- {
+ _get_tooltip_content: function (sDataAttCode) {
var oField = this._get_main_field_by_code(sDataAttCode);
var sContent = '';
- if (oField != null)
- {
- sContent += '
';
- for(var k in oField.subattr)
- {
+ if (oField != null) {
+ sContent += '
'+oField.label+'
';
+ for (var k in oField.subattr) {
bChecked = ($.inArray(oField.subattr[k].code, this.aSelected) != -1);
sContent += this._get_field_checkbox(oField.subattr[k].code, oField.subattr[k].label, false, bChecked, sDataAttCode);
}
}
return sContent;
},
- _get_field_checkbox: function(sCode, sLabel, bHasTooltip, bChecked, sParentId)
- {
+ _get_field_checkbox: function (sCode, sLabel, bHasTooltip, bChecked, sParentId) {
var sPrefix = 'tfs_'+this.sId+'_';
sParentId = (sPrefix+sParentId).replace('.', '_');
sElementId = (sPrefix+sCode).replace('.', '_');
var aClasses = [];
- if (bHasTooltip)
- {
+ if (bHasTooltip) {
aClasses.push('tfs_advanced');
sLabel += ' [+]';
}
var sChecked = '';
- if (bChecked)
- {
+ if (bChecked) {
sChecked = ' checked ';
}
var sDataParent = '';
- if (sParentId != null)
- {
+ if (sParentId != null) {
sDataParent = ' data-parent="'+sParentId+'" ';
}
- if (bHasTooltip)
- {
+ if (bHasTooltip) {
sContent = '
';
- }
- else
- {
- sContent = '
';
+ } else {
+ sContent = '
';
}
return sContent;
- },
- close_all_tooltips: function()
- {
- $('.tfs_advanced').each(function (i) {
- $(this).tooltip("close");
- });
}
- });
+ });
});
diff --git a/js/utils.js b/js/utils.js
index 1256c464d..b0428385b 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -430,13 +430,11 @@ function ExportStartExport() {
if (this.checked) {
oParams[this.name] = $(this).val();
}
- }
- else {
+ } else {
oParams[this.name] = $(this).val();
}
}
});
- $(':itop-tabularfieldsselector:visible').tabularfieldsselector('close_all_tooltips');
$('#export-form').hide();
$('#export-feedback').show();
oParams.operation = 'export_build';
@@ -445,8 +443,7 @@ function ExportStartExport() {
if ($(':input[name=query_mode]:checked').length > 0) {
if (sQueryMode == 'oql') {
oParams.expression = $('#export-form :input[name=expression]').val();
- }
- else {
+ } else {
oParams.query = $('#export-form :input[name=query]').val();
}
}
diff --git a/pages/run_query.php b/pages/run_query.php
index 69702cf4b..216cf59bc 100644
--- a/pages/run_query.php
+++ b/pages/run_query.php
@@ -180,7 +180,7 @@ try
//--- Query textarea
$oQueryTitle = new Html('
'.Dict::S('UI:RunQuery:ExpressionToEvaluate').'
');
$oQueryForm->AddSubBlock($oQueryTitle);
- $oQueryTextArea = new TextArea(utils::EscapeHtml($sExpression), 'expression', 120, 8);
+ $oQueryTextArea = new TextArea('expression', utils::EscapeHtml($sExpression), 'expression', 120, 8);
$oQueryTextArea->SetName('expression');
$oQueryForm->AddSubBlock($oQueryTextArea);
diff --git a/sources/application/UI/Base/Component/Input/AbstractInput.php b/sources/application/UI/Base/Component/Input/AbstractInput.php
index 0c0d6346c..b20cebb71 100644
--- a/sources/application/UI/Base/Component/Input/AbstractInput.php
+++ b/sources/application/UI/Base/Component/Input/AbstractInput.php
@@ -18,6 +18,8 @@ abstract class AbstractInput extends UIBlock
protected $sName;
/** @var string */
protected $sValue;
+ /**@var string */
+ protected $sPlaceholder;
public function GetName(): string
{
@@ -52,4 +54,25 @@ abstract class AbstractInput extends UIBlock
return $this;
}
+
+ /**
+ * @return string
+ */
+ public function GetPlaceholder(): ?string
+ {
+ return $this->sPlaceholder;
+ }
+
+ /**
+ * @param string $sPlaceholder
+ *
+ * @return $this
+ */
+ public function SetPlaceholder(string $sPlaceholder)
+ {
+ $this->sPlaceholder = $sPlaceholder;
+
+ return $this;
+ }
+
}
\ No newline at end of file
diff --git a/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php b/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php
index 67f9b7b94..93faa9fc9 100644
--- a/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php
+++ b/sources/application/UI/Base/Component/Input/InputUIBlockFactory.php
@@ -94,4 +94,24 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
return new InputWithLabel($sLabel, $oInput, $sId);
}
+ /**
+ * If you need to have a real field with a label, you might use a {@link Field} component instead
+ *
+ * @param string $sName
+ * @param string|null $sId
+ *
+ * @return \Combodo\iTop\Application\UI\Base\Component\Input\Select
+ */
+ public static function MakeForSelect(string $sName, ?string $sId = null): Select
+ {
+ $oInput = new Select($sId);
+ $oInput->SetName($sName);
+
+ if (is_null($sId)) {
+ $sId = $oInput->GetId();
+ }
+
+ return $oInput;
+ }
+
}
\ No newline at end of file
diff --git a/sources/application/UI/Base/Component/Input/InputWithLabel.php b/sources/application/UI/Base/Component/Input/InputWithLabel.php
index bd5ed1d1b..8df94628e 100644
--- a/sources/application/UI/Base/Component/Input/InputWithLabel.php
+++ b/sources/application/UI/Base/Component/Input/InputWithLabel.php
@@ -23,6 +23,8 @@ class InputWithLabel extends UIBlock
protected $sLabel;
/** @var \Combodo\iTop\Application\UI\Base\UIBlock */
protected $oInput;
+ /** @var bool Label before input ? */
+ protected $bBeforeInput;
/**
* @param string $sLabel
@@ -34,6 +36,7 @@ class InputWithLabel extends UIBlock
parent::__construct($sId);
$this->sLabel = $sLabel;
$this->oInput = $oInput;
+ $this->bBeforeInput = true;
}
/**
@@ -56,6 +59,30 @@ class InputWithLabel extends UIBlock
return $this;
}
+ /**
+ * @param bool $bBeforeInput
+ *
+ * @return $this
+ */
+ public function SetBeforeInput(bool $bBeforeInput)
+ {
+ $this->bBeforeInput = $bBeforeInput;
+ if ($bBeforeInput) {
+ $this->oInput->AddCSSClass('ibo-input--label-left');
+ } else {
+ $this->oInput->AddCSSClass('ibo-input--label-right');
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return bool
+ */
+ public function IsLabelBefore(): bool
+ {
+ return $this->bBeforeInput;
+ }
/**
* @return string
diff --git a/sources/application/UI/Base/Component/Input/TextArea.php b/sources/application/UI/Base/Component/Input/TextArea.php
index f0f7b80bf..40d05b63d 100644
--- a/sources/application/UI/Base/Component/Input/TextArea.php
+++ b/sources/application/UI/Base/Component/Input/TextArea.php
@@ -21,16 +21,17 @@ class TextArea extends AbstractInput
/** @var int */
protected $iRows;
- public function __construct(?string $sValue, ?string $sId = null, ?int $iCols = null, ?int $iRows = null)
+ public function __construct(string $sName, ?string $sValue, ?string $sId = null, ?int $iCols = null, ?int $iRows = null)
{
parent::__construct($sId);
+ $this->sName = $sName;
$this->sValue = $sValue;
$this->iCols = $iCols;
$this->iRows = $iRows;
}
- public function GetCols(): int
+ public function GetCols(): ?int
{
return $this->iCols;
}
@@ -47,7 +48,7 @@ class TextArea extends AbstractInput
return $this;
}
- public function GetRows(): int
+ public function GetRows(): ?int
{
return $this->iRows;
}
diff --git a/sources/application/WebPage/WebPage.php b/sources/application/WebPage/WebPage.php
index acd7e0bd8..97429f887 100644
--- a/sources/application/WebPage/WebPage.php
+++ b/sources/application/WebPage/WebPage.php
@@ -832,7 +832,7 @@ class WebPage implements Page
{
$aPossibleAttFlags = MetaModel::EnumPossibleAttributeFlags();
- $sHtml = "
\n";
+ $sHtml = "
\n";
foreach ($aFields as $aAttrib)
{
$sLayout = isset($aAttrib['layout']) ? $aAttrib['layout'] : 'small';
diff --git a/templates/base/components/datatable/config/layout.html.twig b/templates/base/components/datatable/config/layout.html.twig
index 0cb06c72b..8c24d447f 100644
--- a/templates/base/components/datatable/config/layout.html.twig
+++ b/templates/base/components/datatable/config/layout.html.twig
@@ -1,44 +1,49 @@
-
+
\ No newline at end of file
diff --git a/templates/base/components/datatable/static/formtable/layout.ready.js.twig b/templates/base/components/datatable/static/formtable/layout.ready.js.twig
index ac04707ed..749d505a5 100644
--- a/templates/base/components/datatable/static/formtable/layout.ready.js.twig
+++ b/templates/base/components/datatable/static/formtable/layout.ready.js.twig
@@ -9,7 +9,7 @@ var table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_
search: false,
dom: "t",
});
-
-
-//table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }}.columns.adjust().draw();
-//$(".dataTables_scrollBody thead").hide();
\ No newline at end of file
+if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible'))
+{
+ table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }}.columns.adjust().draw();
+}
diff --git a/templates/base/components/fieldset/layout.html.twig b/templates/base/components/fieldset/layout.html.twig
index 4ee38ee80..2156d52a6 100644
--- a/templates/base/components/fieldset/layout.html.twig
+++ b/templates/base/components/fieldset/layout.html.twig
@@ -1,5 +1,5 @@
{% if oUIBlock.GetSubBlocks() %}
-