diff --git a/src/webui/www/private/scripts/lib/vanillaSelectBox.js b/src/webui/www/private/scripts/lib/vanillaSelectBox.js index 6d11b676f..0a62bde05 100644 --- a/src/webui/www/private/scripts/lib/vanillaSelectBox.js +++ b/src/webui/www/private/scripts/lib/vanillaSelectBox.js @@ -1,32 +1,32 @@ /* Copyright (C) Philippe Meyer 2019-2021 -Distributed under the MIT License +Distributed under the MIT License vanillaSelectBox : v1.05 : setValue() bug correction on single mode. You could not set the value -vanillaSelectBox : v1.04 : select all issue fixed by https://github.com/arthur911016 +vanillaSelectBox : v1.04 : select all issue fixed by https://github.com/arthur911016 vanillaSelectBox : v1.03 : getResult() an new fonction to get the selected values in an array vanillaSelectBox : v1.02 : Adding 2 new options "itemsSeparator" to change the default "," item separator showing in the button and translations.item to show the item in singular if there is only one. vanillaSelectBox : v1.01 : Removing useless code line 550,551 issue 71 by chchch -vanillaSelectBox : v1.00 : Adding a package.json file +vanillaSelectBox : v1.00 : Adding a package.json file vanillaSelectBox : v0.78 : Stop using inline styles in the main button. You can steal use keepInlineStyles:true to use the legacy behaviour vanillaSelectBox : v0.77 : Work on place holder with bastoune help => still seems to lose placeholder value on multiple dropdown checkall vanillaSelectBox : v0.76 : New changeTree function : to rebuild the original tree with new data + correcting empty() function -vanillaSelectBox : v0.75 : Remote search ready + local search modification : when a check on optgroup checks children only +vanillaSelectBox : v0.75 : Remote search ready + local search modification : when a check on optgroup checks children only if they not excluded from search. vanillaSelectBox : v0.72 : Remote search (WIP) bugfix [x] Select all duplicated vanillaSelectBox : v0.71 : Remote search (WIP) better code vanillaSelectBox : v0.70 : Remote search (WIP) for users to test vanillaSelectBox : v0.65 : Two levels: bug fix : groups are checked/unchecked when check all/uncheck all is clicked -vanillaSelectBox : v0.64 : Two levels: groups are now checkable to check/uncheck the children options +vanillaSelectBox : v0.64 : Two levels: groups are now checkable to check/uncheck the children options vanillaSelectBox : v0.63 : Two levels: one click on the group selects / unselects children vanillaSelectBox : v0.62 : New option: maxOptionWidth set a maximum width for each option for narrow menus vanillaSelectBox : v0.61 : New option: maxSelect, set a maximum to the selectable options in a multiple choice menu -vanillaSelectBox : v0.60 : Two levels: Optgroups are now used to show two level dropdowns +vanillaSelectBox : v0.60 : Two levels: Optgroups are now used to show two level dropdowns vanillaSelectBox : v0.59 : Bug fix : search box was overlapping first item in single selects vanillaSelectBox : v0.58 : Bug fixes vanillaSelectBox : v0.57 : Bug fix (minWidth option not honored) vanillaSelectBox : v0.56 : The multiselect checkboxes are a little smaller, maxWidth option is now working + added minWidth option as well - The button has now a style attribute to protect its appearance + The button has now a style attribute to protect its appearance vanillaSelectBox : v0.55 : All attributes from the original select options are copied to the selectBox element vanillaSelectBox : v0.54 : if all the options of the select are selected by the user then the check all checkbox is checked vanillaSelectBox : v0.53 : if all the options of the select are selected then the check all checkbox is checked @@ -149,7 +149,7 @@ function vanillaSelectBox(domSelector, options) { if (options.remote.onInit!= undefined && typeof options.remote.onInit === 'function') { this.onInit = options.remote.onInit; this.isInitRemote = true; - } + } if (options.remote.onInitSize != undefined) { this.onInitSize = options.remote.onInitSize; if (this.onInitSize < 3) this.onInitSize = 3; @@ -186,7 +186,7 @@ function vanillaSelectBox(domSelector, options) { if(options.keepInlineCaretStyles != undefined ) { this.keepInlineCaretStyles = options.keepInlineCaretStyles; } - + } this.closeOrder = function () { @@ -208,9 +208,16 @@ function vanillaSelectBox(domSelector, options) { if (selector === ".vsb-main button") { cssArray = [ { "key": "min-width", "value": "120px" }, + { "key": "border-radius", "value": "0" }, { "key": "width", "value": "100%" }, { "key": "text-align", "value": "left" }, - { "key": "z-index", "value": "1" } + { "key": "z-index", "value": "1" }, + { "key": "color", "value": "#333" }, + { "key": "background", "value": "white !important" }, + { "key": "border", "value": "1px solid #999 !important" }, + { "key": "line-height", "value": "20px" }, + { "key": "font-size", "value": "14px" }, + { "key": "padding", "value": "6px 12px" } ] } @@ -292,7 +299,7 @@ function vanillaSelectBox(domSelector, options) { if(this.keepInlineCaretStyles) { caret.style.position = "absolute"; caret.style.right = "8px"; - caret.style.marginTop = "6px"; + caret.style.marginTop = "8px"; } if (self.userOptions.stayOpen) { @@ -561,7 +568,7 @@ function vanillaSelectBox(domSelector, options) { } } } - }); + }); } if (self.userOptions.stayOpen) { @@ -726,13 +733,13 @@ vanillaSelectBox.prototype.buildSelect = function (data) { if(!self.isOptgroups){ self.isOptgroups = data[0].parent != undefined && data[0].parent != ""; } - + if(self.isOptgroups){ let groups = {}; data = data.filter(function(x){ return x.parent != undefined && x.parent != ""; }); - + data.forEach(function (x) { if(!groups[x.parent]){ groups[x.parent] = true; @@ -741,7 +748,7 @@ vanillaSelectBox.prototype.buildSelect = function (data) { for (let group in groups) { let anOptgroup = document.createElement("optgroup"); anOptgroup.setAttribute("label", group); - + options = data.filter(function(x){ return x.parent == group; }); @@ -856,7 +863,7 @@ vanillaSelectBox.prototype.remoteSearchIntegrateIt = function (data) { if (data == null || data.length == 0) return; while(self.root.firstChild) self.root.removeChild(self.root.firstChild); - + self.buildSelect(data); self.reloadTree(); } @@ -1259,7 +1266,7 @@ vanillaSelectBox.prototype.setValue = function (values) { Array.prototype.slice.call(listElements).forEach(function (x) { if (x.value !== 'all') { nrAll++; - } + } if (foundValues.indexOf(x.getAttribute("data-value")) != -1) { x.classList.add("active"); nrActives++; @@ -1394,3 +1401,4 @@ function vanillaSelectBox_type(target) { const lowercased = stripped.toLowerCase(); return lowercased; } +