Support placeholder on multiselect components

This commit is contained in:
Laurent Destailleur 2022-02-15 16:43:47 +01:00
parent 1b53ed09f9
commit 50853205bb
4 changed files with 33 additions and 5 deletions

View File

@ -8126,8 +8126,15 @@ class Form
}
$out .= '};'."\n";
$out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').'.$tmpplugin.'({
dir: \'ltr\',
$(\'#'.$htmlname.'\').'.$tmpplugin.'({';
if ($placeholder) {
$out .= '
placeholder: {
id: \'-1\',
text: \''.dol_escape_js($placeholder).'\'
},';
}
$out .= ' dir: \'ltr\',
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */

View File

@ -431,8 +431,8 @@ if ($object->isextrafieldmanaged) {
}
}
}
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright" title="'.$langs->trans("Measures").'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span>'.$langs->trans("Measures").'</div> ';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1); // Fill the array $arrayofmeasures with possible fields
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div> ';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
print '</div>';

View File

@ -5932,7 +5932,7 @@ input.select2-input {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
min-height: 30px !important;
min-height: 28px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 5px !important;
@ -6045,6 +6045,9 @@ input.select2-input {
background-color: #ddd;
margin-top: 4px !important;
}
.select2-selection--multiple input.select2-search__field {
border-bottom: none !important;
}
.select2-search__field
{

View File

@ -1197,6 +1197,17 @@ div.divsearchfield {
padding-left: 4px;
}
.caretleftaxis {
margin-left: -13px;
margin-top: -1px;
position: absolute;
}
.caretdownaxis {
margin-left: -12px;
margin-top: 0;
position: absolute;
}
<?php
// Add a nowrap on smartphone, so long list of field used for filter are overflowed with clip
if ($conf->browser->layout == 'phone') {
@ -5843,6 +5854,10 @@ input.select2-input {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
min-height: 28px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border: 1px solid #e4e4e4;
}
@ -5920,6 +5935,9 @@ input.select2-input {
border-right: none;
border-radius: 0 !important;
}
.select2-selection--multiple input.select2-search__field {
border-bottom: none !important;
}
.select2-search__field
{
outline: none;