Preferences: Add a preference for if select multiple dropdowns stay open or closes immediately after selection

This commit is contained in:
nathan 2023-04-17 09:28:27 -06:00
parent b557eb7b83
commit 358cc70d66
4 changed files with 112 additions and 81 deletions

View File

@ -244,12 +244,22 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
*/
private _block_change_event = false;
/**
* Close the dropdown after user selects an option.
* Only applies when multiple="true". We initialize it in constructor to the common preference "select_multiple_close"
* @type {boolean}
* @private
*/
private _close_on_select : boolean;
constructor(...args : any[])
{
super();
// We want this on more often than off
this.hoist = true;
this._close_on_select = this.egw().preference("select_multiple_close") == "close";
this._triggerChange = this._triggerChange.bind(this);
this._doResize = this._doResize.bind(this);
this._handleMouseWheel = this._handleMouseWheel.bind(this);
@ -683,8 +693,8 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
}
/**
* Always close the dropdown if an option is clicked, even if multiple=true. This differs from SlSelect,
* which leaves the dropdown open for multiple=true
* Apply the user preference to close the dropdown if an option is clicked, even if multiple=true.
* The default (from SlSelect) leaves the dropdown open for multiple=true
*
* @param {MouseEvent} event
* @private
@ -696,6 +706,8 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
// Don't hide dropdown when clicking on select. That can close it after user opens it.
return;
}
if(this._close_on_select)
{
this.dropdown.hide().then(() =>
{
if(typeof this.handleMenuHide == "function")
@ -705,6 +717,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
}
});
}
}
/**
* Always close the dropdown if an option is clicked, even if multiple=true. This differs from SlSelect,

View File

@ -83,6 +83,10 @@ export class Et2SelectEmail extends Et2Select
constructor(...args : any[])
{
super(...args);
// Always off for select email, per ticket #79694
this._close_on_select = true;
this.search = true;
this.searchUrl = "EGroupware\\Api\\Etemplate\\Widget\\Taglist::ajax_email";
this.allowFreeEntries = true;

View File

@ -25,6 +25,10 @@ class preferences_hooks
*/
static public function settings($hook_data)
{
$select_multiple_close = array(
'open' => lang('Stay open'),
'close' => lang('Close after selection')
);
$navbar_format = array(
'icons' => lang('Icons only'),
'icons_and_text' => lang('Icons and text'),
@ -216,23 +220,23 @@ class preferences_hooks
'help' => 'A theme defines the colors and fonts used by the template.',
'xmlrpc' => True,
'admin' => False,
'forced' => file_exists(EGW_SERVER_ROOT.'/pixelegg') ? 'pixelegg' : 'idots',
'forced' => file_exists(EGW_SERVER_ROOT . '/pixelegg') ? 'pixelegg' : 'idots',
'reload' => true
),
'darkmode' => array(
'type' => 'select',
'label' => 'Dark mode theme',
'name' => 'darkmode',
'values' => array('0' => 'off', '1' => 'on', '2'=> 'auto'),
'values' => array('0' => 'off', '1' => 'on', '2' => 'auto'),
'help' => 'Dark mode theme',
'admin' => False,
'default' => '0'
),
'audio_effect'=> array(
'audio_effect' => array(
'type' => 'select',
'label' => 'Audio effect',
'name' => 'audio_effect',
'values' => array('0'=>lang('Disable'),'1'=>lang('Enable')),
'values' => array('0' => lang('Disable'), '1' => lang('Enable')),
'help' => 'Audio effect enables|disables sound effects used in the theme',
'xmlrpc' => True,
'admin' => False,
@ -246,7 +250,7 @@ class preferences_hooks
'help' => 'You can show the applications as icons only, icons with app-name or both.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'icons_and_text',
'default' => 'icons_and_text',
),
'link_list_format' => array(
'type' => 'select',
@ -258,6 +262,14 @@ class preferences_hooks
'admin' => False,
'forced' => 'icons',
),
'select_multiple_close' => array(
'type' => 'select',
'label' => 'Keep list open for selecting multiple',
'name' => 'select_multiple_close',
'values' => $select_multiple_close,
'help' => 'When you can select multiple options, should the option list stay open until you close it, or close after you pick an option.',
'default' => 'open'
),
'link_list_thumbnail' => array(
'type' => 'select',
'label' => 'Display thumbnails for linked images',
@ -289,12 +301,12 @@ class preferences_hooks
'label' => 'How do you like to select accounts',
'name' => 'account_selection',
'values' => $account_sels,
'help' => lang('The selectbox shows all available users (can be very slow on big installs with many users). The popup can search users by name or group.').' '.
'help' => lang('The selectbox shows all available users (can be very slow on big installs with many users). The popup can search users by name or group.') . ' ' .
lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'),
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default'=> 'selectbox'
'default' => 'selectbox'
),
'account_display' => array(
'type' => 'select',
@ -304,7 +316,7 @@ class preferences_hooks
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'lastname',
'default' => 'lastname',
),
'show_currentusers' => array(
'type' => 'check',
@ -315,7 +327,7 @@ class preferences_hooks
'admin' => True,
'forced' => true,
),
'scroll_area'=> array(
'scroll_area' => array(
'type' => 'select',
'label' => 'Applications list scroll area',
'name' => 'scroll_area',

View File

@ -104,6 +104,7 @@ interface/template selection preferences en Interface | Template
it sets content size (text only) according to selected size. preferences en It sets content size (text only) according to selected size.
just clicking on the line, like a checkbox preferences en just clicking on the line, like a checkbox
kama theme preferences en Kama theme
keep list open for selecting multiple preferences en Keep list open for selecting multiple
language preferences en Language
look & feel preferences en Look & feel
lowercase letters preferences en lowercase letters
@ -194,6 +195,7 @@ unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as u
uppercase letters preferences en uppercase letters
use default preferences en Use default
users choice preferences en Users choice
when you can select multiple options, should the option list stay open until you close it, or close after you pick an option. preferences en When you can select multiple options, should the option list stay open until you close it, or close after you pick an option.
when you say yes the home and logout buttons are presented as applications in the main top applcation bar. preferences en Show Home and Logout buttons as applications in the top bar.
which charset should be used for the csv export. the system default is the charset of this egroupware installation. addressbook en Select character set for the CSV Import|Export.
which currency symbol or name should be used in egroupware. preferences en Currency symbol or name.