From 41762cd0bf6d676fca52755b8c4dcaeb482a378c Mon Sep 17 00:00:00 2001 From: Steve James <4stevejames@gmail.com> Date: Sun, 25 Feb 2018 00:23:10 -0800 Subject: [PATCH 1/9] New features **Closes #750, #721, #605, #467, #454, #436, #232, #163, #86** ### Many new features and improvements: 1. Expanded on iconSet concept to create linkInfo option to allow configuration of all header link attributes, including icons, text, and titles.s. 2. Menu height can now be dynamically resized via the jQuery UI resizable widget, if loaded and resizableMenu option set to true. 3. Fixed some issues w/ the menu height getting mangled when filtering was in used. 4. Modifed how header option is used. Can still set to false to hide header, but now it is also used to specify what header links are seen and in what order. 5. The multiselect can now also be used as a fixed list box (always open; no pop-up) via the listbox option. 6. New options groupsSelectable and groupsCollapsable control whether option groups can be selected and/or collapsed, respectively. 7. Option groups can now be set to be collapsable. A new small button shows up at the left of each option group heading to collapse/expand the option group. 8. New resync and value methods allow quickly updating the widget options checked state from the underlying native select. 9. Can now use the up/down keys on closed single select to change the selected option if the button is focussed. 10. Fixed a previously unknown bug caused by binding menu events to the outer $menu container div instead of the $checkboxes container. This bug caused the menu events handler to also try to handle header events. 11. Added the ability to reference option groups by their label or index for use as a filter. Now usable programmatically in addOption, checkAll, uncheckAll, flipAll, collapseAll, and expandAll. 12. Simplified the auto width determination for the _setMenuWidth() method by tweaking the related CSS rules. As a benefit, the _getScrollBarWidth() function has been eliminated. 13. Updated and simplified the _setMenuHeight() method to allow it to better work with filtering. 14. Re-wrote the filter widget--can now search option group headings and supports alternative filter rules. 15. Updated and added unit tests. 16. Updated demos and changed theme to Redmond--no more ugly construction orange. 17. Updated i18n files for new linkInfo option format. --- css/jquery.multiselect.css | 32 +- css/jquery.multiselect.filter.css | 3 +- demos/animations.htm | 2 +- demos/assets/ba.hashchange.js | 4 +- demos/basic.htm | 2 +- demos/callbacks.htm | 24 +- demos/enabledisable.htm | 2 +- demos/filter.htm | 2 +- demos/headers.htm | 22 +- demos/maxchecked.htm | 2 +- demos/position.htm | 2 +- demos/preselected.htm | 2 +- demos/refresh.htm | 2 +- demos/selectedlist.htm | 2 +- demos/single.htm | 14 +- i18n/jquery.multiselect.br.js | 6 +- i18n/jquery.multiselect.cs.js | 6 +- i18n/jquery.multiselect.de.js | 6 +- i18n/jquery.multiselect.es.js | 6 +- i18n/jquery.multiselect.fr.js | 6 +- i18n/jquery.multiselect.hu.js | 6 +- i18n/jquery.multiselect.it.js | 6 +- i18n/jquery.multiselect.ja.js | 6 +- i18n/jquery.multiselect.pl.js | 8 +- i18n/jquery.multiselect.ru.js | 6 +- i18n/jquery.multiselect.tr.js | 6 +- i18n/jquery.multiselect.zh-cn.js | 6 +- i18n/jquery.multiselect.zh-tw.js | 6 +- src/jquery.multiselect.js | 1711 ++++------------------------- tests/unit/events.js | 4 +- tests/unit/index.htm | 2 +- tests/unit/methods.js | 77 +- tests/unit/options.js | 106 +- 33 files changed, 485 insertions(+), 1612 deletions(-) diff --git a/css/jquery.multiselect.css b/css/jquery.multiselect.css index 81aefdb..ab31790 100644 --- a/css/jquery.multiselect.css +++ b/css/jquery.multiselect.css @@ -1,35 +1,41 @@ -.ui-multiselect {box-sizing: border-box; padding:2px 0 2px 4px; text-align:left;} +.ui-multiselect {box-sizing: border-box; padding:2px 0 2px 4px; text-align:left; width: auto;} .ui-multiselect .ui-multiselect-open { float:right } -.ui-multiselect-menu { display:none; box-sizing:border-box; position:absolute; text-align:left; z-index:101; width:auto; padding:3px;} +.ui-multiselect-menu { display:none; box-sizing:border-box; position:absolute; text-align:left; z-index: 101; width:auto; height:auto; padding:3px; } +.ui-multiselect-menu.ui-multiselect-listbox {position:relative; z-index: 0;} .ui-multiselect-header { display:block; box-sizing:border-box; position:relative; width:auto; padding:3px 0 3px 4px; margin-bottom:3px;} .ui-multiselect-header > ul { font-size:0.9em } -.ui-multiselect-header > ul > li { float:left; padding:0 10px 0 0;} +.ui-multiselect-header li { float:left; margin:0 10px 0 0;} .ui-multiselect-header a { text-decoration:none; } .ui-multiselect-header a:hover { text-decoration:underline; cursor: pointer;} .ui-multiselect-header .ui-icon { float:left; } -.ui-multiselect-header .ui-multiselect-close { float:right; padding-right:0; text-align:right; } +.ui-multiselect-header .ui-multiselect-close { float:right; margin-right:0; text-align:right; } .ui-multiselect-checkboxes { display:block; box-sizing:border-box; position:relative; overflow:auto; width: auto; border: 0;} -.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px;} -.ui-multiselect-checkboxes label > input { position:relative; top:1px; } -.ui-multiselect-checkboxes label img { height: 30px; vertical-align: middle; padding-right: 3px;} -.ui-multiselect-checkboxes > .ui-multiselect-optgroup > a { border-bottom:1px solid; cursor: pointer; display:block; font-weight:bold; margin:1px 0; padding:3px; text-align:center; text-decoration:none; } -.ui-multiselect-checkboxes > .ui-multiselect-optgroup > ul { padding: 3px; } .ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup) { clear:both; font-size:0.9em; list-style: none; padding-right:3px;} +.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px;} +.ui-multiselect-checkboxes input { position:relative; top:1px; cursor: pointer;} +.ui-multiselect-checkboxes img { height: 30px; vertical-align: middle; margin-right: 3px;} +.ui-multiselect-optgroup > button { padding: 0 1px; margin: 0;} +.ui-multiselect-optgroup > a { border-bottom:1px solid; cursor: pointer; display:block; font-weight:bold; margin:1px 0; padding:3px; text-align:center; text-decoration:none; } +.ui-multiselect-optgroup > ul { padding: 3px; } .ui-multiselect-columns { display: inline-block; vertical-align: top; } +.ui-multiselect-collapsed > ul { display:none } .ui-multiselect-single .ui-multiselect-checkboxes input { left:-9999px; position:absolute !important; top: auto !important; } .ui-multiselect-single .ui-multiselect-checkboxes label { padding:5px !important } -.ui-multiselect.ui-multiselect-nowrap { white-space: nowrap} -.ui-multiselect.ui-multiselect-nowrap > span {display: inline-block} +.ui-multiselect.ui-multiselect-nowrap { white-space: nowrap } +.ui-multiselect.ui-multiselect-nowrap > span { display: inline-block } .ui-multiselect-checkboxes.ui-multiselect-nowrap li, -.ui-multiselect-checkboxes.ui-multiselect-nowrap a{ white-space: nowrap} +.ui-multiselect-checkboxes.ui-multiselect-nowrap a { white-space: nowrap } .ui-multiselect-measure > .ui-multiselect-header, -.ui-multiselect-measure > .ui-multiselect-checkboxes { float:left; } +.ui-multiselect-measure > .ui-multiselect-checkboxes { float: left; } +.ui-multiselect-measure > .ui-multiselect-checkboxes { margin: 4px; overflow-y: scroll; } + +.ui-multiselect-resize { border: 2px dotted #00F } @media print{ .ui-multiselect-menu {display: none;} diff --git a/css/jquery.multiselect.filter.css b/css/jquery.multiselect.filter.css index f8c323a..39c145c 100644 --- a/css/jquery.multiselect.filter.css +++ b/css/jquery.multiselect.filter.css @@ -1,3 +1,4 @@ .ui-multiselect-hasfilter ul { position:relative; top:2px } -.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px } +.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px; width:100%; } .ui-multiselect-filter input { width:100px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929; -webkit-appearance:textfield; -webkit-box-sizing:content-box; } +.ui-multiselect-excluded {display: none} diff --git a/demos/animations.htm b/demos/animations.htm index aef50e8..8ce8bb0 100644 --- a/demos/animations.htm +++ b/demos/animations.htm @@ -6,7 +6,7 @@ - + diff --git a/demos/assets/ba.hashchange.js b/demos/assets/ba.hashchange.js index aa93618..7f25465 100644 --- a/demos/assets/ba.hashchange.js +++ b/demos/assets/ba.hashchange.js @@ -1,9 +1,9 @@ /* - * jQuery hashchange event - v1.2 - 2/11/2010 + * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ -(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('