bludit/bl-kernel/admin/themes/booty/js/bootstrap-select.min.js

9 lines
43 KiB
JavaScript
Raw Normal View History

/*!
* Bootstrap-select v1.13.0-beta (https://developer.snapappointments.com/bootstrap-select)
*
* Copyright 2012-2018 SnapAppointments, LLC
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
*/
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){"use strict";function b(a,b){return a.length===b.length&&a.every(function(a,c){return a===b[c]})}function c(a,b,c,d){for(var f=["content","subtext","tokens"],g=!1,h=0;h<f.length;h++){var i=f[h],j=a[i];if(j&&(d&&(j=e(j)),j=j.toUpperCase(),g="contains"===c?j.indexOf(b)>=0:j.startsWith(b)))break}return g}function d(a){return parseInt(a,10)||0}function e(b){var c=[{re:/[\xC0-\xC6]/g,ch:"A"},{re:/[\xE0-\xE6]/g,ch:"a"},{re:/[\xC8-\xCB]/g,ch:"E"},{re:/[\xE8-\xEB]/g,ch:"e"},{re:/[\xCC-\xCF]/g,ch:"I"},{re:/[\xEC-\xEF]/g,ch:"i"},{re:/[\xD2-\xD6]/g,ch:"O"},{re:/[\xF2-\xF6]/g,ch:"o"},{re:/[\xD9-\xDC]/g,ch:"U"},{re:/[\xF9-\xFC]/g,ch:"u"},{re:/[\xC7-\xE7]/g,ch:"c"},{re:/[\xD1]/g,ch:"N"},{re:/[\xF1]/g,ch:"n"}];return a.each(c,function(){b=b?b.replace(this.re,this.ch):""}),b}function f(b){var c=arguments,d=b;[].shift.apply(c);var e,f=this.each(function(){var b=a(this);if(b.is("select")){var f=b.data("selectpicker"),g="object"==typeof d&&d;if(f){if(g)for(var h in g)g.hasOwnProperty(h)&&(f.options[h]=g[h])}else{var i=a.extend({},w.DEFAULTS,a.fn.selectpicker.defaults||{},b.data(),g);i.template=a.extend({},w.DEFAULTS.template,a.fn.selectpicker.defaults?a.fn.selectpicker.defaults.template:{},b.data().template,g.template),b.data("selectpicker",f=new w(this,i))}"string"==typeof d&&(e=f[d]instanceof Function?f[d].apply(f,c):f.options[d])}});return void 0!==e?e:f}var g=document.createElement("_");if(g.classList.toggle("c3",!1),g.classList.contains("c3")){var h=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:h.call(this,a)}}String.prototype.startsWith||function(){var a=function(){try{var a={},b=Object.defineProperty,c=b(a,a,a)&&b}catch(a){}return c}(),b={}.toString,c=function(a){if(null==this)throw new TypeError;var c=String(this);if(a&&"[object RegExp]"==b.call(a))throw new TypeError;var d=c.length,e=String(a),f=e.length,g=arguments.length>1?arguments[1]:void 0,h=g?Number(g):0;h!=h&&(h=0);var i=Math.min(Math.max(h,0),d);if(f+i>d)return!1;for(var j=-1;++j<f;)if(c.charCodeAt(i+j)!=e.charCodeAt(j))return!1;return!0};a?a(String.prototype,"startsWith",{value:c,configurable:!0,writable:!0}):String.prototype.startsWith=c}(),Object.keys||(Object.keys=function(a,b,c){c=[];for(b in a)c.hasOwnProperty.call(a,b)&&c.push(b);return c});var i={useDefault:!1,_set:a.valHooks.select.set};a.valHooks.select.set=function(b,c){return c&&!i.useDefault&&a(b).data("selected",!0),i._set.apply(this,arguments)};var j=null,k=function(){try{return new Event("change"),!0}catch(a){return!1}}();a.fn.triggerNative=function(a){var b,c=this[0];c.dispatchEvent?(k?b=new Event(a,{bubbles:!0}):(b=document.createEvent("Event"),b.initEvent(a,!0,!1)),c.dispatchEvent(b)):c.fireEvent?(b=document.createEventObject(),b.eventType=a,c.fireEvent("on"+a,b)):this.trigger(a)};var l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},m={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`"},n=function(a){var b=function(b){return a[b]},c="(?:"+Object.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}},o=n(l),p=n(m),q={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r={ESCAPE:27,ENTER:13,SPACE:32,TAB:9,ARROW_UP:38,ARROW_DOWN:40},s={};s.full=(a.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),s.major=s.full[0];var t={DISABLED:"disabled",DIVIDER:"4"===s.major?"dropdown-divider":"divider",SHOW:"4"===s.major?"show":"open",DROPUP:"dropup",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCL
this.$element.data("tabindex")!==this.$element.attr("tabindex")&&-98!==this.$element.attr("tabindex")&&"-98"!==this.$element.attr("tabindex")&&(this.$element.data("tabindex",this.$element.attr("tabindex")),this.$button.attr("tabindex",this.$element.data("tabindex"))),this.$element.attr("tabindex",-98)},clickListener:function(){var b=this,c=a(document);c.data("spaceSelect",!1),this.$button.on("keyup",function(a){/(32)/.test(a.keyCode.toString(10))&&c.data("spaceSelect")&&(a.preventDefault(),c.data("spaceSelect",!1))}),this.$newElement.on("show.bs.dropdown",function(){s.major>3&&!b.dropdown&&(b.dropdown=b.$button.data("bs.dropdown"),b.dropdown._menu=b.$menu[0])}),this.$button.on("click.bs.dropdown.data-api",function(){b.$newElement.hasClass(t.SHOW)||b.setSize()}),this.$element.on("shown.bs.select",function(){b.$menuInner[0].scrollTop!==b.selectpicker.view.scrollTop&&(b.$menuInner[0].scrollTop=b.selectpicker.view.scrollTop),b.options.liveSearch?b.$searchbox.focus():b.$menuInner.focus()}),this.$menuInner.on("click","li a",function(c,d){var e=a(this),f=b.isVirtual()?b.selectpicker.view.position0:0,g=b.selectpicker.current.map.originalIndex[e.parent().index()+f],h=b.$element.val(),i=b.$element.prop("selectedIndex"),k=!0;if(b.multiple&&1!==b.options.maxOptions&&c.stopPropagation(),c.preventDefault(),!b.isDisabled()&&!e.parent().hasClass(t.DISABLED)){var l=b.$element.find("option"),m=l.eq(g),n=m.prop("selected"),o=m.parent("optgroup"),p=b.options.maxOptions,q=o.data("maxOptions")||!1;if(b.multiple){if(m.prop("selected",!n),g===b.activeIndex&&(d=!0),d||(b.prevActiveIndex=b.activeIndex,b.activeIndex=void 0),b.setSelected(g,!n),e.blur(),!1!==p||!1!==q){var r=p<l.filter(":selected").length,s=q<o.find("option:selected").length;if(p&&r||q&&s)if(p&&1==p)l.prop("selected",!1),m.prop("selected",!0),b.$menuInner.find(".selected").removeClass("selected"),b.setSelected(g,!0);else if(q&&1==q){o.find("option:selected").prop("selected",!1),m.prop("selected",!0);var u=b.selectpicker.current.data[e.parent().index()+b.selectpicker.view.position0].optID;b.$menuInner.find(".optgroup-"+u).removeClass("selected"),b.setSelected(g,!0)}else{var v="string"==typeof b.options.maxOptionsText?[b.options.maxOptionsText,b.options.maxOptionsText]:b.options.maxOptionsText,w="function"==typeof v?v(p,q):v,x=w[0].replace("{n}",p),y=w[1].replace("{n}",q),z=a('<div class="notify"></div>');w[2]&&(x=x.replace("{var}",w[2][p>1?0:1]),y=y.replace("{var}",w[2][q>1?0:1])),m.prop("selected",!1),b.$menu.append(z),p&&r&&(z.append(a("<div>"+x+"</div>")),k=!1,b.$element.trigger("maxReached.bs.select")),q&&s&&(z.append(a("<div>"+y+"</div>")),k=!1,b.$element.trigger("maxReachedGrp.bs.select")),setTimeout(function(){b.setSelected(g,!1)},10),z.delay(750).fadeOut(300,function(){a(this).remove()})}}}else l.prop("selected",!1),m.prop("selected",!0),b.setSelected(g,!0);!b.multiple||b.multiple&&1===b.options.maxOptions?b.$button.focus():b.options.liveSearch&&b.$searchbox.focus(),k&&(h!=b.$element.val()&&b.multiple||i!=b.$element.prop("selectedIndex")&&!b.multiple)&&(j=[g,m.prop("selected"),n],b.$element.triggerNative("change"))}}),this.$menu.on("click","li."+t.DISABLED+" a, .popover-title, .popover-title :not(.close)",function(c){c.currentTarget==this&&(c.preventDefault(),c.stopPropagation(),b.options.liveSearch&&!a(c.target).hasClass("close")?b.$searchbox.focus():b.$button.focus())}),this.$menuInner.on("click",".divider, .dropdown-header",function(a){a.preventDefault(),a.stopPropagation(),b.options.liveSearch?b.$searchbox.focus():b.$button.focus()}),this.$menu.on("click",".popover-title .close",function(){b.$button.click()}),this.$searchbox.on("click",function(a){a.stopPropagation()}),this.$menu.on("click",".actions-btn",function(c){b.options.liveSearch?b.$searchbox.focus():b.$button.focus(),c.preventDefault(),c.stopPropagation(),a(this).hasClass("bs-select-all")?b.selectAll():b.deselectAll()}),this.$element.on({change:function(){b.render(),b.$element.trigger("changed.bs.select",j),j=null},focus:function(){b.$button.focus()}})},liveSearchListener:function(){var a=this,b=document.create
//# sourceMappingURL=bootstrap-select.js.map