vendor: 6,834 bytes, lines 1-198
1/*! 2 * Material Design for Bootstrap 4 3 * Version: MDB PRO 4.8.0 4 * 5 * Modified for material select menus only 6 */ 7 8 9// t: current time, b: begInnIng value, c: change In value, d: duration 10jQuery.easing['jswing'] = jQuery.easing['swing']; 11 12jQuery.extend( jQuery.easing, 13{ 14 def: 'easeOutQuad', 15 swing: function (x, t, b, c, d) { 16 //alert(jQuery.easing.default); 17 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 18 }, 19 easeInQuad: function (x, t, b, c, d) { 20 return c*(t/=d)*t + b; 21 }, 22 easeOutQuad: function (x, t, b, c, d) { 23 return -c *(t/=d)*(t-2) + b; 24 }, 25 easeInOutQuad: function (x, t, b, c, d) { 26 if ((t/=d/2) < 1) return c/2*t*t + b; 27 return -c/2 * ((--t)*(t-2) - 1) + b; 28 }, 29 easeInCubic: function (x, t, b, c, d) { 30 return c*(t/=d)*t*t + b; 31 }, 32 easeOutCubic: function (x, t, b, c, d) { 33 return c*((t=t/d-1)*t*t + 1) + b; 34 }, 35 easeInOutCubic: function (x, t, b, c, d) { 36 if ((t/=d/2) < 1) return c/2*t*t*t + b; 37 return c/2*((t-=2)*t*t + 2) + b; 38 }, 39 easeInQuart: function (x, t, b, c, d) { 40 return c*(t/=d)*t*t*t + b; 41 }, 42 easeOutQuart: function (x, t, b, c, d) { 43 return -c * ((t=t/d-1)*t*t*t - 1) + b; 44 }, 45 easeInOutQuart: function (x, t, b, c, d) { 46 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 47 return -c/2 * ((t-=2)*t*t*t - 2) + b; 48 }, 49 easeInQuint: function (x, t, b, c, d) { 50 return c*(t/=d)*t*t*t*t + b; 51 }, 52 easeOutQuint: function (x, t, b, c, d) { 53 return c*((t=t/d-1)*t*t*t*t + 1) + b; 54 }, 55 easeInOutQuint: function (x, t, b, c, d) { 56 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 57 return c/2*((t-=2)*t*t*t*t + 2) + b; 58 }, 59 easeInSine: function (x, t, b, c, d) { 60 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 61 }, 62 easeOutSine: function (x, t, b, c, d) { 63 return c * Math.sin(t/d * (Math.PI/2)) + b; 64 }, 65 easeInOutSine: function (x, t, b, c, d) { 66 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 67 }, 68 easeInExpo: function (x, t, b, c, d) { 69 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 70 }, 71 easeOutExpo: function (x, t, b, c, d) { 72 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 73 }, 74 easeInOutExpo: function (x, t, b, c, d) { 75 if (t==0) return b; 76 if (t==d) return b+c; 77 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 78 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 79 }, 80 easeInCirc: function (x, t, b, c, d) { 81 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 82 }, 83 easeOutCirc: function (x, t, b, c, d) { 84 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 85 }, 86 easeInOutCirc: function (x, t, b, c, d) { 87 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 88 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 89 }, 90 easeInElastic: function (x, t, b, c, d) { 91 var s=1.70158;var p=0;var a=c; 92 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 93 if (a < Math.abs(c)) { a=c; var s=p/4; } 94 else var s = p/(2*Math.PI) * Math.asin (c/a); 95 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 96 }, 97 easeOutElastic: function (x, t, b, c, d) { 98 var s=1.70158;var p=0;var a=c; 99 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 100 if (a < Math.abs(c)) { a=c; var s=p/4; } 101 else var s = p/(2*Math.PI) * Math.asin (c/a); 102 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 103 }, 104 easeInOutElastic: function (x, t, b, c, d) { 105 var s=1.70158;var p=0;var a=c; 106 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 107 if (a < Math.abs(c)) { a=c; var s=p/4; } 108 else var s = p/(2*Math.PI) * Math.asin (c/a); 109 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 110 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 111 }, 112 easeInBack: function (x, t, b, c, d, s) { 113 if (s == undefined) s = 1.70158; 114 return c*(t/=d)*t*((s+1)*t - s) + b; 115 }, 116 easeOutBack: function (x, t, b, c, d, s) { 117 if (s == undefined) s = 1.70158; 118 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 119 }, 120 easeInOutBack: function (x, t, b, c, d, s) { 121 if (s == undefined) s = 1.70158; 122 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 123 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 124 }, 125 easeInBounce: function (x, t, b, c, d) { 126 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 127 }, 128 easeOutBounce: function (x, t, b, c, d) { 129 if ((t/=d) < (1/2.75)) { 130 return c*(7.5625*t*t) + b; 131 } else if (t < (2/2.75)) { 132 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 133 } else if (t < (2.5/2.75)) { 134 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 135 } else { 136 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 137 } 138 }, 139 easeInOutBounce: function (x, t, b, c, d) { 140 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 141 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 142 } 143}); 144 145 146/*! 147 * Dropdown Js 148 * Version: MDB PRO 4.8.0 149 * 150 */ 151 152"use strict"; 153 154(function ($) { 155 $.fn.scrollTo = function (elem) { 156 $(this).scrollTop($(this).scrollTop() - $(this).offset().top + $(elem).offset().top); 157 return this; 158 }; 159 160 $.fn.dropdown = function (option) { 161 this.each(function () { 162 var origin = $(this); 163 var options = $.extend({}, $.fn.dropdown.defaults, option); 164 var isFocused = false; // Dropdown menu 165 166 var activates = $("#".concat(origin.attr('data-activates'))); 167 168 function updateOptions() { 169 if (origin.data('induration') !== undefined) { 170 options.inDuration = origin.data('inDuration'); 171 } 172 173 if (origin.data('outduration') !== undefined) { 174 options.outDuration = origin.data('outDuration'); 175 } 176 177 if (origin.data('constrainwidth') !== undefined) { 178 options.constrain_width = origin.data('constrainwidth'); 179 } 180 181 if (origin.data('hover') !== undefined) { 182 options.hover = origin.data('hover'); 183 } 184 185 if (origin.data('gutter') !== undefined) { 186 options.gutter = origin.data('gutter'); 187 } 188 189 if (origin.data('beloworigin') !== undefined) { 190 options.belowOrigin = origin.data('beloworigin'); 191 } 192 193 if (origin.data('alignment') !== undefined) { 194 options.alignment = origin.data('alignment'); 195 } 196 } 197 198 updateOptions(); // Attach dropdown to its activator
199 200 origin.after(activates); 201 /* 202 Helper function to position and resize dropdown. 203 Used in hover and click handler. 204 */ 205 206 function placeDropdown(eventType) { 207 // Check for simultaneous focus and click events. 208 if (eventType === 'focus') { 209 isFocused = true; 210 } // Check html data attributes 211 212 213 updateOptions(); // Set Dropdown state 214 215 activates.addClass('active'); 216 origin.addClass('active'); // Constrain width 217 218 if (options.constrain_width === true) { 219 activates.css('width', origin.outerWidth()); 220 } else { 221 activates.css('white-space', 'nowrap'); 222 } // Offscreen detection 223 224 225 var windowHeight = window.innerHeight; 226 var originHeight = origin.innerHeight(); 227 var offsetLeft = origin.offset().left; 228 var offsetTop = origin.offset().top - $(window).scrollTop(); 229 var currAlignment = options.alignment; 230 var gutterSpacing = 0; 231 var leftPosition = 0; // Below Origin 232 233 var verticalOffset = 0; 234 235 if (options.belowOrigin === true) { 236 verticalOffset = originHeight; 237 } // Check for scrolling positioned container. 238 239 240 var scrollOffset = 0; 241 var wrapper = origin.parent(); 242 243 if (!wrapper.is('body') && wrapper[0].scrollHeight > wrapper[0].clientHeight) { 244 scrollOffset = wrapper[0].scrollTop; 245 } 246 247 if (offsetLeft + activates.innerWidth() > $(window).width()) { 248 // Dropdown goes past screen on right, force right alignment 249 currAlignment = 'right'; 250 } else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) { 251 // Dropdown goes past screen on left, force left alignment 252 currAlignment = 'left'; 253 } // Vertical bottom offscreen detection 254 255 256 if (offsetTop + activates.innerHeight() > windowHeight) { 257 // If going upwards still goes offscreen, just crop height of dropdown. 258 if (offsetTop + originHeight - activates.innerHeight() < 0) { 259 var adjustedHeight = windowHeight - offsetTop - verticalOffset; 260 activates.css('max-height', adjustedHeight); 261 } else { 262 // Flow upwards. 263 if (!verticalOffset) { 264 verticalOffset += originHeight; 265 } 266 267 verticalOffset -= activates.innerHeight(); 268 } 269 } // Handle edge alignment 270 271 272 if (currAlignment === 'left') { 273 gutterSpacing = options.gutter; 274 leftPosition = origin.position().left + gutterSpacing; 275 } else if (currAlignment === 'right') { 276 var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth(); 277 gutterSpacing = -options.gutter; 278 leftPosition = offsetRight + gutterSpacing; 279 } // Position dropdown 280 281 282 activates.css({ 283 position: 'absolute', 284 top: origin.position().top + verticalOffset + scrollOffset, 285 left: leftPosition 286 }); // Show dropdown 287 288 activates.stop(true, true).css('opacity', 0).slideDown({ 289 queue: false, 290 duration: options.inDuration, 291 easing: 'easeOutCubic', 292 complete: function complete() { 293 $(this).css('height', ''); 294 } 295 }).animate({ 296 opacity: 1, 297 scrollTop: 0 298 }, { 299 queue: false, 300 duration: options.inDuration, 301 easing: 'easeOutSine' 302 }); 303 } 304 305 function hideDropdown() { 306 // Check for simultaneous focus and click events. 307 isFocused = false; 308 activates.fadeOut(options.outDuration); 309 activates.removeClass('active'); 310 origin.removeClass('active'); 311 setTimeout(function () { 312 activates.css('max-height', ''); 313 }, options.outDuration); 314 } // Hover 315 316 317 if (options.hover) { 318 var open = false; 319 origin.unbind("click.".concat(origin.attr('id'))); // Hover handler to show dropdown 320 321 origin.on('mouseenter', function () { 322 // Mouse over 323 if (open === false) { 324 placeDropdown(); 325 open = true; 326 } 327 }); 328 origin.on('mouseleave', function (e) {
329 // If hover on origin then to something other than dropdown content, then close 330 var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element 331 332 if (!$(toEl).closest('.dropdown-content').is(activates)) { 333 activates.stop(true, true); 334 hideDropdown(); 335 open = false; 336 } 337 }); 338 activates.on('mouseleave', function (e) { 339 // Mouse out 340 var toEl = e.toElement || e.relatedTarget; 341 342 if (!$(toEl).closest('.dropdown-button').is(origin)) { 343 activates.stop(true, true); 344 hideDropdown(); 345 open = false; 346 } 347 }); // Click 348 } else { 349 // Click handler to show dropdown 350 origin.unbind("click.".concat(origin.attr('id'))); 351 origin.bind("click.".concat(origin.attr('id')), function (e) { 352 if (!isFocused) { 353 if (origin[0] === e.currentTarget && !origin.hasClass('active') && $(e.target).closest('.dropdown-content').length === 0) { 354 e.preventDefault(); // Prevents button click from moving window 355 356 placeDropdown('click'); 357 } else if (origin.hasClass('active')) { 358 // If origin is clicked and menu is open, close menu 359 hideDropdown(); 360 $(document).unbind("click.".concat(activates.attr('id'), " touchstart.").concat(activates.attr('id'))); 361 } // If menu open, add click close handler to document 362 363 364 if (activates.hasClass('active')) { 365 $(document).bind("click.".concat(activates.attr('id'), " touchstart.").concat(activates.attr('id')), function (e) { 366 if (!activates.is(e.target) && !origin.is(e.target) && !origin.find(e.target).length) { 367 hideDropdown(); 368 $(document).unbind("click.".concat(activates.attr('id'), " touchstart.").concat(activates.attr('id'))); 369 } 370 }); 371 } 372 } 373 }); 374 } 375 376 origin.on('open', function (e, eventType) { 377 placeDropdown(eventType); 378 }); 379 origin.on('close', hideDropdown); 380 }); 381 }; 382 383 $.fn.dropdown.defaults = { 384 inDuration: 300, 385 outDuration: 225, 386 constrain_width: true, 387 hover: false, 388 gutter: 0, 389 belowOrigin: false, 390 alignment: 'left' 391 }; 392 $('.dropdown-button').dropdown(); 393 394 $.fn.mdbDropSearch = function (options) { 395 var $mdbInput = $(this).find('input'); 396 this.filter(function (value, index) { 397 $(index).on('keyup', function () { 398 var $linksInDropMenu = $mdbInput.closest('div[id]').find('a, li'); 399 400 for (var i = 0; i < $linksInDropMenu.length; i++) { 401 if ($linksInDropMenu.eq(i).html().toUpperCase().indexOf($mdbInput.val().toUpperCase()) > -1) { 402 $linksInDropMenu.eq(i).css({ 403 display: '' 404 }); 405 } else { 406 $linksInDropMenu.eq(i).css({ 407 display: 'none' 408 }); 409 } 410 } 411 }); 412 }); 413 var settings = $.extend({ 414 color: '#000', 415 backgroundColor: '', 416 fontSize: '.9rem', 417 fontWeight: '400', 418 borderRadius: '', 419 borderColor: '' 420 }, options); 421 return this.css({ 422 color: settings.color, 423 backgroundColor: settings.backgroundColor, 424 fontSize: settings.fontSize, 425 fontWeight: settings.fontWeight, 426 borderRadius: settings.borderRadius, 427 border: settings.border, 428 margin: settings.margin 429 }); 430 }; 431})(jQuery); 432 433var dropdownSelectors = $('.dropdown, .dropup'); // Custom function to read dropdown data 434 435function dropdownEffectData(target) { 436 // TODO - page level global? 437 var effectInDefault = 'fadeIn'; 438 var effectOutDefault = 'fadeOut'; 439 var dropdown = $(target); 440 var dropdownMenu = $('.dropdown-menu', target); 441 var parentUl = dropdown.parents('ul.nav'); // If parent is ul.nav allow global effect settings 442 443 if (parentUl.height > 0) { 444 effectInDefault = parentUl.data('dropdown-in') || null; 445 effectOutDefault = parentUl.data('dropdown-out') || null; 446 } 447 448 return { 449 target: target, 450 dropdown: dropdown, 451 dropdownMenu: dropdownMenu, 452 effectIn: dropdownMenu.data('dropdown-in') || effectInDefault, 453 effectOut: dropdownMenu.data('dropdown-out') || effectOutDefault 454 }; 455} // Custom function to start effect (in or out) 456 457 458function dropdownEffectStart(data, effectToStart) { 459 if (effectToStart) { 460 data.dropdown.addClass('dropdown-animating'); 461 data.dropdownMenu.addClass(['animated', effectToStart].join(' ')); 462 } 463} // Custom function to read when animation is over 464 465 466function dropdownEffectEnd(data, callbackFunc) { 467 var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; 468 data.dropdown.one(animationEnd, function () { 469 data.dropdown.removeClass('dropdown-animating'); 470 data.dropdownMenu.removeClass(['animated', data.effectIn, data.effectOut].join(' ')); // Custom callback option, used to remove open class in out effect
471 472 if (typeof callbackFunc === 'function') { 473 callbackFunc(); 474 } 475 }); 476} // Bootstrap API hooks 477 478 479dropdownSelectors.on({ 480 'show.bs.dropdown': function showBsDropdown() { 481 // On show, start in effect 482 var dropdown = dropdownEffectData(this); 483 dropdownEffectStart(dropdown, dropdown.effectIn); 484 }, 485 'shown.bs.dropdown': function shownBsDropdown() { 486 // On shown, remove in effect once complete 487 var dropdown = dropdownEffectData(this); 488 489 if (dropdown.effectIn && dropdown.effectOut) { 490 dropdownEffectEnd(dropdown); 491 } 492 }, 493 'hide.bs.dropdown': function hideBsDropdown(e) { 494 // On hide, start out effect 495 var dropdown = dropdownEffectData(this); 496 497 if (dropdown.effectOut) { 498 e.preventDefault(); 499 dropdownEffectStart(dropdown, dropdown.effectOut); 500 dropdownEffectEnd(dropdown, function () { 501 dropdown.dropdown.removeClass('show'); 502 dropdown.dropdownMenu.removeClass('show'); 503 }); 504 } 505 } 506}); 507 508 509/*! 510 * Material Select Js 511 * Version: MDB PRO 4.8.0 512 * 513 */ 514 515"use strict"; 516 517function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 518 519function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 520 521function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 522 523(function ($) { 524 var MaterialSelect = 525 /*#__PURE__*/ 526 function () { 527 function MaterialSelect($nativeSelect, options) { 528 _classCallCheck(this, MaterialSelect); 529 530 this.$nativeSelect = $nativeSelect; 531 this.defaults = { 532 destroy: false, 533 nativeID: null, 534 BSsearchIn: false, 535 BSinputText: false, 536 fasClasses: '', 537 farClasses: '', 538 fabClasses: '', 539 copyClassesOption: false, 540 language: { 541 active: false, 542 pl: { 543 selectAll: 'Wybierz wszystko', 544 optionsSelected: 'wybranych opcji' 545 }, 546 in: { 547 selectAll: 'Pilih semuanya', 548 optionsSelected: 'opsi yang dipilih' 549 }, 550 fr: { 551 selectAll: 'Tout choisir', 552 optionsSelected: 'options sélectionnées' 553 }, 554 ge: { 555 selectAll: 'Wähle alles aus', 556 optionsSelected: 'ausgewählte Optionen' 557 }, 558 ar: { 559 selectAll: 'اختر كل شيء', 560 optionsSelected: 'الخيارات المØÂددة' 561 } 562 } 563 }; 564 this.options = this.assignOptions(options); 565 this.isMultiple = Boolean(this.$nativeSelect.attr('multiple')); 566 this.isSearchable = Boolean(this.$nativeSelect.attr('searchable')); 567 this.isRequired = Boolean(this.$nativeSelect.attr('required')); 568 this.uuid = this.options.nativeID !== null && this.options.nativeID !== '' && this.options.nativeID !== undefined && typeof this.options.nativeID === 'string' ? this.options.nativeID : this._randomUUID(); 569 this.$selectWrapper = $('<div class="select-wrapper"></div>'); 570 this.$materialOptionsList = $("<ul id=\"select-options-".concat(this.uuid, "\" class=\"dropdown-content select-dropdown w-100 ").concat(this.isMultiple ? 'multiple-select-dropdown' : '', "\"></ul>")); 571 this.$materialSelectInitialOption = $nativeSelect.find('option:selected').text() || $nativeSelect.find('option:first').text() || ''; 572 this.$nativeSelectChildren = this.$nativeSelect.children('option, optgroup'); 573 this.$materialSelect = $("<input type=\"text\" class=\"".concat(this.options.BSinputText ? 'browser-default custom-select multi-bs-select select-dropdown' : 'select-dropdown', "\" readonly=\"true\" ").concat(this.$nativeSelect.is(':disabled') ? 'disabled' : '', " data-activates=\"select-options-").concat(this.uuid, "\" value=\"\"/>")); 574 this.$dropdownIcon = this.options.BSinputText ? '' : $('<span class="caret"><i class="far fa-chevron-down"></i></span>'); 575 this.$searchInput = null; 576 this.$toggleAll = $("<li class=\"select-toggle-all\"><span><input type=\"checkbox\" class=\"form-check-input\"><label>Select all</label></span></li>"); 577 this.mainLabel = this.$nativeSelect.next('.mdb-main-label'); 578 this.valuesSelected = []; 579 this.keyCodes = { 580 tab: 9, 581 esc: 27, 582 enter: 13, 583 arrowUp: 38, 584 arrowDown: 40 585 }; 586 MaterialSelect.mutationObservers = []; 587 } 588 589 _createClass(MaterialSelect, [{ 590 key: "assignOptions", 591 value: function assignOptions(newOptions) { 592 return $.extend({}, this.defaults, newOptions); 593 } 594 }, {
595 key: "init", 596 value: function init() { 597 var alreadyInitialized = Boolean(this.$nativeSelect.data('select-id')); 598 599 if (alreadyInitialized) { 600 this._removeMaterialWrapper(); 601 } 602 603 if (this.options.destroy) { 604 this.$nativeSelect.data('select-id', null).removeClass('initialized'); 605 return; 606 } 607 608 if (this.options.BSsearchIn || this.options.BSinputText) { 609 this.$selectWrapper.addClass(this.$nativeSelect.attr('class').split(' ').filter(function (el) { 610 return el !== 'md-form'; 611 }).join(' ')).css({ 612 marginTop: '1.5rem', 613 marginBottom: '1.5rem' 614 }); 615 } else { 616 this.$selectWrapper.addClass(this.$nativeSelect.attr('class')); 617 } 618 619 this.$nativeSelect.data('select-id', this.uuid); 620 var sanitizedLabelHtml = this.$materialSelectInitialOption.replace(/"/g, '"').replace(/ +/g, ' ').trim(); 621 this.mainLabel.length === 0 ? this.$materialSelect.val(sanitizedLabelHtml) : this.mainLabel.text(); 622 this.renderMaterialSelect(); 623 this.bindEvents(); 624 625 if (this.isRequired) { 626 this.enableValidation(); 627 } 628 629 if (this.options.language.active && this.$toggleAll) { 630 if (this.options.language.pl) { 631 this.$toggleAll.find('label').text(this.options.language.pl.selectAll ? this.options.language.pl.selectAll : this.defaults.language.pl.selectAll); 632 } 633 634 if (this.options.language.fr) { 635 this.$toggleAll.find('label').text(this.options.language.fr.selectAll ? this.options.language.fr.selectAll : this.defaults.language.fr.selectAll); 636 } 637 638 if (this.options.language.ge) { 639 this.$toggleAll.find('label').text(this.options.language.ge.selectAll ? this.options.language.ge.selectAll : this.defaults.language.ge.selectAll); 640 } 641 642 if (this.options.language.ar) { 643 this.$toggleAll.find('label').text(this.options.language.ar.selectAll ? this.options.language.ar.selectAll : this.defaults.language.ar.selectAll); 644 } 645 646 if (this.options.language.in) { 647 this.$toggleAll.find('label').text(this.options.language.in.selectAll ? this.options.language.in.selectAll : this.defaults.language.in.selectAll); 648 } 649 } 650 651 if (this.$materialSelect.hasClass('custom-select') && this.$materialSelect.hasClass('select-dropdown')) { 652 this.$materialSelect.css({ 653 'display': 'inline-block', 654 'width': '100%', 655 'height': 'calc(1.5em + .75rem + 2px)', 656 'padding': '.375rem 1.75rem .375rem .75rem', 657 'font-size': '1rem', 658 'line-height': '1.5', 659 'background-color': '#fff', 660 'border': '1px solid #ced4da' 661 }); 662 } 663 } 664 }, { 665 key: "_removeMaterialWrapper", 666 value: function _removeMaterialWrapper() { 667 var currentUuid = this.$nativeSelect.data('select-id'); 668 this.$nativeSelect.parent().find('span.caret').remove(); 669 this.$nativeSelect.parent().find('input').remove(); 670 this.$nativeSelect.unwrap(); 671 $("ul#select-options-".concat(currentUuid)).remove(); 672 } 673 }, { 674 key: "renderMaterialSelect", 675 value: function renderMaterialSelect() { 676 var _this = this; 677 678 this.$nativeSelect.before(this.$selectWrapper); 679 this.appendDropdownIcon(); 680 this.appendMaterialSelect(); 681 this.appendMaterialOptionsList(); 682 this.appendNativeSelect(); 683 this.appendSaveSelectButton(); 684 685 if (!this.$nativeSelect.is(':disabled')) { 686 this.$materialSelect.dropdown({ 687 hover: false, 688 closeOnClick: false 689 }); 690 } 691 692 if (this.$nativeSelect.data('inherit-tabindex') !== false) { 693 this.$materialSelect.attr('tabindex', this.$nativeSelect.attr('tabindex')); 694 } 695 696 if (this.isMultiple) { 697 this.$nativeSelect.find('option:selected:not(:disabled)').each(function (i, element) { 698 var index = element.index; 699 700 _this._toggleSelectedValue(index); 701 702 _this.$materialOptionsList.find('li:not(.optgroup):not(.select-toggle-all)').eq(index).find(':checkbox').prop('checked', true); 703 }); 704 } else { 705 var index = this.$nativeSelect.find('option:selected').index(); 706 this.$materialOptionsList.find('li').eq(index).addClass('active'); 707 } 708 709 this.$nativeSelect.addClass('initialized'); 710 711 if (this.options.BSinputText) { 712 this.mainLabel.css('top', '-7px'); 713 } 714 } 715 }, {
716 key: "appendDropdownIcon", 717 value: function appendDropdownIcon() { 718 if (this.$nativeSelect.is(':disabled')) { 719 this.$dropdownIcon.addClass('disabled'); 720 } 721 722 this.$selectWrapper.append(this.$dropdownIcon); 723 } 724 }, { 725 key: "appendMaterialSelect", 726 value: function appendMaterialSelect() { 727 this.$selectWrapper.append(this.$materialSelect); 728 } 729 }, { 730 key: "appendMaterialOptionsList", 731 value: function appendMaterialOptionsList() { 732 if (this.isSearchable) { 733 this.appendSearchInputOption(); 734 } 735 736 this.buildMaterialOptions(); 737 738 if (this.isMultiple) { 739 this.appendToggleAllCheckbox(); 740 } 741 742 this.$selectWrapper.append(this.$materialOptionsList); 743 } 744 }, { 745 key: "appendNativeSelect", 746 value: function appendNativeSelect() { 747 this.$nativeSelect.appendTo(this.$selectWrapper); 748 } 749 }, { 750 key: "appendSearchInputOption", 751 value: function appendSearchInputOption() { 752 var placeholder = this.$nativeSelect.attr('searchable'); 753 754 if (this.options.BSsearchIn) { 755 this.$searchInput = $("<span class=\"search-wrap ml-2\"><div class=\"mt-0\"><input type=\"text\" class=\"search form-control mb-2 w-100 d-block select-default\" placeholder=\"".concat(placeholder, "\"></div></span>")); 756 } else { 757 this.$searchInput = $("<span class=\"search-wrap ml-2\"><div class=\"md-form mt-0\"><input type=\"text\" class=\"search form-control w-100 d-block\" placeholder=\"".concat(placeholder, "\"></div></span>")); 758 } 759 760 this.$materialOptionsList.append(this.$searchInput); 761 this.$searchInput.on("click", function (e) { 762 e.stopPropagation(); 763 }); 764 } 765 }, { 766 key: "appendToggleAllCheckbox", 767 value: function appendToggleAllCheckbox() { 768 this.$materialOptionsList.find('li.disabled').first().after(this.$toggleAll); 769 } 770 }, { 771 key: "appendSaveSelectButton", 772 value: function appendSaveSelectButton() { 773 this.$selectWrapper.parent().find('button.btn-save').appendTo(this.$materialOptionsList); 774 } 775 }, { 776 key: "buildMaterialOptions", 777 value: function buildMaterialOptions() { 778 var _this2 = this; 779 780 this.$nativeSelectChildren.each(function (index, option) { 781 var $this = $(option); 782 783 if ($this.is('option')) { 784 _this2.buildSingleOption($this, _this2.isMultiple ? 'multiple' : ''); 785 } else if ($this.is('optgroup')) { 786 var $materialOptgroup = $("<li class=\"optgroup\"><span>".concat($this.attr('label'), "</span></li>")); 787 788 _this2.$materialOptionsList.append($materialOptgroup); 789 790 var $optgroupOptions = $this.children('option'); 791 $optgroupOptions.each(function (index, optgroupOption) { 792 _this2.buildSingleOption($(optgroupOption), 'optgroup-option'); 793 }); 794 } 795 }); 796 } 797 }, { 798 key: "buildSingleOption", 799 value: function buildSingleOption($nativeSelectChild, type) { 800 var disabled = $nativeSelectChild.is(':disabled') ? 'disabled' : ''; 801 var optgroupClass = type === 'optgroup-option' ? 'optgroup-option' : ''; 802 var iconUrl = $nativeSelectChild.data('icon'); 803 var fas = $nativeSelectChild.data('fas') ? "<i class=\"fa-pull-right m-2 fas fa-".concat($nativeSelectChild.data('fas'), " ").concat([...this.options.fasClasses].join(''), "\"></i> ") : ''; 804 var far = $nativeSelectChild.data('far') ? "<i class=\"fa-pull-right m-2 far fa-".concat($nativeSelectChild.data('far'), " ").concat([...this.options.farClasses].join(''), "\"></i> ") : ''; 805 var fab = $nativeSelectChild.data('fab') ? "<i class=\"fa-pull-right m-2 fab fa-".concat($nativeSelectChild.data('fab'), " ").concat([...this.options.fabClasses].join(''), "\"></i> ") : ''; 806 var classes = $nativeSelectChild.attr('class'); 807 var iconHtml = iconUrl ? "<img alt=\"\" src=\"".concat(iconUrl, "\" class=\"").concat(classes, "\">") : ''; 808 var checkboxHtml = this.isMultiple ? "<input type=\"checkbox\" class=\"form-check-input\" ".concat(disabled, "/><label></label>") : ''; 809 this.$materialOptionsList.append($("<li class=\"".concat(disabled, " ").concat(optgroupClass, " ").concat(this.options.copyClassesOption ? classes : '', " \">").concat(iconHtml, "<span class=\"filtrable\">").concat(checkboxHtml, " ").concat($nativeSelectChild.html(), " ").concat(fas, " ").concat(far, " ").concat(fab, "</sp
809an></li>"))); 810 } 811 }, { 812 key: "enableValidation", 813 value: function enableValidation() { 814 this.$nativeSelect.css({ 815 position: 'absolute', 816 top: '1rem', 817 left: '0', 818 height: '0', 819 width: '0', 820 opacity: '0', 821 padding: '0', 822 'pointer-events': 'none' 823 }); 824 825 if (this.$nativeSelect.attr('style').indexOf('inline!important') === -1) { 826 this.$nativeSelect.attr('style', "".concat(this.$nativeSelect.attr('style'), " display: inline!important;")); 827 } 828 829 this.$nativeSelect.attr('tabindex', -1); 830 this.$nativeSelect.data('inherit-tabindex', false); 831 } 832 }, { 833 key: "bindEvents", 834 value: function bindEvents() { 835 var _this3 = this; 836 837 var config = { 838 attributes: true, 839 childList: true, 840 characterData: true, 841 subtree: true 842 }; 843 var observer = new MutationObserver(this._onMutationObserverChange.bind(this)); 844 observer.observe(this.$nativeSelect.get(0), config); 845 observer.customId = this.uuid; 846 observer.customStatus = 'observing'; 847 MaterialSelect.clearMutationObservers(); 848 MaterialSelect.mutationObservers.push(observer); 849 var $saveSelectBtn = this.$nativeSelect.parent().find('button.btn-save'); 850 $saveSelectBtn.on('click', this._onSaveSelectBtnClick.bind(this)); 851 this.$materialSelect.on('focus', this._onMaterialSelectFocus.bind(this)); 852 this.$materialSelect.on('click', this._onMaterialSelectClick.bind(this)); 853 this.$materialSelect.on('blur', this._onMaterialSelectBlur.bind(this)); 854 this.$materialSelect.on('keydown', this._onMaterialSelectKeydown.bind(this)); 855 this.$toggleAll.on('click', this._onToggleAllClick.bind(this)); 856 this.$materialOptionsList.on('mousedown', this._onEachMaterialOptionMousedown.bind(this)); 857 this.$materialOptionsList.find('li:not(.optgroup)').not(this.$toggleAll).each(function (materialOptionIndex, materialOption) { 858 $(materialOption).on('click', _this3._onEachMaterialOptionClick.bind(_this3, materialOptionIndex, materialOption)); 859 }); 860 861 if (!this.isMultiple && this.isSearchable) { 862 this.$materialOptionsList.find('li').on('click', this._onSingleMaterialOptionClick.bind(this)); 863 } 864 865 if (this.isSearchable) { 866 this.$searchInput.find('.search').on('keyup', this._onSearchInputKeyup); 867 } 868 869 $('html').on('click', this._onHTMLClick.bind(this)); 870 } 871 }, { 872 key: "_onMutationObserverChange", 873 value: function _onMutationObserverChange(mutationsList) { 874 mutationsList.forEach(function (mutation) { 875 var $select = $(mutation.target).closest('select'); 876 877 if ($select.data('stop-refresh') !== true && (mutation.type === 'childList' || mutation.type === 'attributes' && $(mutation.target).is('option'))) { 878 MaterialSelect.clearMutationObservers(); 879 $select.materialSelect({ 880 'destroy': true 881 }); 882 $select.materialSelect(); 883 } 884 }); 885 } 886 }, { 887 key: "_onSaveSelectBtnClick", 888 value: function _onSaveSelectBtnClick(e) { 889 $('input.multi-bs-select').trigger('close'); 890 this.$materialOptionsList.hide(); 891 this.$materialSelect.removeClass('active'); 892 } 893 }, { 894 key: "_onEachMaterialOptionClick", 895 value: function _onEachMaterialOptionClick(materialOptionIndex, materialOption, e) { 896 e.stopPropagation(); 897 var $this = $(materialOption); 898 899 if ($this.hasClass('disabled') || $this.hasClass('optgroup')) { 900 return; 901 } 902 903 var selected = true; 904 905 if (this.isMultiple) { 906 $this.find('input[type="checkbox"]').prop('checked', function (index, oldPropertyValue) { 907 return !oldPropertyValue; 908 }); 909 var hasOptgroup = Boolean(this.$nativeSelect.find('optgroup').length); 910 var thisIndex = this._isToggleAllPresent() ? $this.index() - 1 : $this.index(); 911 912 if (this.isSearchable && hasOptgroup) { 913 selected = this._toggleSelectedValue(thisIndex - $this.prevAll('.optgroup').length - 1); 914 } else if (this.isSearchable) { 915 selected = this._toggleSelectedValue(thisIndex - 1); 916 } else if (hasOptgroup) { 917 selected = this._toggleSelectedValue(thisIndex - $this.prevAll('.optgroup').length); 918 } else { 919 selected = this._toggleSelectedValue(thisIndex); 920 } 921 922 if (this._isToggleAllPresent()) { 923 this._updateToggleAllOption(); 924 } 925 926 this.$materialSelect.trigger('focus'); 927 } else { 928 this.$materialOptionsList.find('li').removeClass('active'); 929 $this.toggleClass('active'); 930 this.$materialSelect.val($this.text().replace(/ +/g, ' ').trim()); 931 this.$materialSelect.trigger('close'); 932 } 933 934 this._selectSingleOption($this); 935 936 this.$nativeSelect.data('stop-refresh', true); 937 this.$nativeSelect.find('option').eq(materialOptionIndex).prop('selected', selected); 938 this.$nativeSelect.removeData('stop-refresh'); 939 940 this._triggerChangeOnNativeSelect(); 941 942 if (this.mainLabel.prev().find('input').hasClass('select-dropdown')) { 943 if (this.mainLabel.prev().find('input.select-dropdown').val().length > 0) { 944 this.mainLabel.addClass('active'); 945 } 946 } 947 948 if (typeof this.options === 'function') { 949 this.options(); 950 } 951 952 if ($this.hasClass('li-added')) { 953 this.$materialOptionsList.append(this.buildSingleOption($this, '')); 954 } 955 } 956 }, {
957 key: "_triggerChangeOnNativeSelect", 958 value: function _triggerChangeOnNativeSelect() { 959 var keyboardEvt = new KeyboardEvent('change', { 960 bubbles: true, 961 cancelable: true 962 }); 963 this.$nativeSelect.get(0).dispatchEvent(keyboardEvt); 964 } 965 }, { 966 key: "_onMaterialSelectFocus", 967 value: function _onMaterialSelectFocus(e) { 968 var $this = $(e.target); 969 970 if ($('ul.select-dropdown').not(this.$materialOptionsList.get(0)).is(':visible')) { 971 $("input.select-dropdown").trigger('close'); 972 } 973 974 if (!this.$materialOptionsList.is(':visible')) { 975 $this.trigger('open', ['focus']); 976 var label = $this.val(); 977 var $selectedOption = this.$materialOptionsList.find('li').filter(function () { 978 return $(this).text().toLowerCase() === label.toLowerCase(); 979 })[0]; 980 981 this._selectSingleOption($selectedOption); 982 } 983 984 if (!this.isMultiple) { 985 this.mainLabel.addClass('active active-check'); 986 } 987 } 988 }, { 989 key: "_onMaterialSelectClick", 990 value: function _onMaterialSelectClick(e) { 991 this.mainLabel.addClass('active-check'); 992 e.stopPropagation(); 993 } 994 }, { 995 key: "_onMaterialSelectBlur", 996 value: function _onMaterialSelectBlur(e) { 997 var $this = $(e); 998 999 if (!this.isMultiple && !this.isSearchable) { 1000 $this.trigger('close'); 1001 } 1002 1003 this.$materialOptionsList.find('li.selected').removeClass('selected'); 1004 this.mainLabel.removeClass('active-check'); 1005 1006 if (this.mainLabel.prev().find('input').hasClass('select-dropdown')) { 1007 if (this.mainLabel.prev().find('input.select-dropdown').val() === '') { 1008 this.mainLabel.removeClass('active'); 1009 } 1010 } 1011 } 1012 }, { 1013 key: "_onSingleMaterialOptionClick", 1014 value: function _onSingleMaterialOptionClick() { 1015 this.$materialSelect.trigger('close'); 1016 } 1017 }, { 1018 key: "_onEachMaterialOptionMousedown", 1019 value: function _onEachMaterialOptionMousedown(e) { 1020 var option = e.target; 1021 1022 if ($('.modal-content').find(this.$materialOptionsList).length) { 1023 if (option.scrollHeight > option.offsetHeight) { 1024 e.preventDefault(); 1025 } 1026 } 1027 1028 this.mainLabel.removeClass('active-check'); 1029 } 1030 }, { 1031 key: "_onHTMLClick", 1032 value: function _onHTMLClick(e) { 1033 if (!$(e.target).closest("#select-options-".concat(this.uuid)).length && !$(e.target).hasClass('mdb-select') && $("#select-options-".concat(this.uuid)).hasClass('active')) { 1034 this.$materialSelect.trigger('close'); 1035 this.mainLabel.removeClass('active-check'); 1036 } 1037 1038 if (this.isSearchable && this.$searchInput !== null && this.$materialOptionsList.hasClass('active')) { 1039 this.$materialOptionsList.find('.search-wrap input.search').focus(); 1040 } 1041 } 1042 }, { 1043 key: "_onToggleAllClick", 1044 value: function _onToggleAllClick(e) { 1045 var _this4 = this; 1046 1047 var checkbox = $(this.$toggleAll).find('input[type="checkbox"]').first(); 1048 var state = !$(checkbox).prop('checked'); 1049 $(checkbox).prop('checked', state); 1050 this.$materialOptionsList.find('li:not(.optgroup):not(.disabled):not(.select-toggle-all)').each(function (materialOptionIndex, materialOption) { 1051 var $optionCheckbox = $(materialOption).find('input[type="checkbox"]'); 1052 1053 if (state && $optionCheckbox.is(':checked') || !state && !$optionCheckbox.is(':checked')) { 1054 return; 1055 } 1056 1057 if (_this4._isToggleAllPresent()) { 1058 materialOptionIndex++; 1059 } 1060 1061 $optionCheckbox.prop('checked', state); 1062 1063 _this4.$nativeSelect.find('option').eq(materialOptionIndex).prop('selected', state); 1064 1065 if (state) { 1066 $(materialOption).removeClass('active'); 1067 } else { 1068 $(materialOption).addClass('active'); 1069 } 1070 1071 _this4._toggleSelectedValue(materialOptionIndex); 1072 1073 _this4._selectOption(materialOption); 1074 1075 _this4._setValueToMaterialSelect(); 1076 }); 1077 this.$nativeSelect.data('stop-refresh', true); 1078 1079 this._triggerChangeOnNativeSelect(); 1080 1081 this.$nativeSelect.removeData('stop-refresh'); 1082 e.stopPropagation(); 1083 } 1084 }, {
1085 key: "_onMaterialSelectKeydown", 1086 value: function _onMaterialSelectKeydown(e) { 1087 var $this = $(e.target); 1088 var isTab = e.which === this.keyCodes.tab; 1089 var isEsc = e.which === this.keyCodes.esc; 1090 var isEnter = e.which === this.keyCodes.enter; 1091 var isArrowUp = e.which === this.keyCodes.arrowUp; 1092 var isArrowDown = e.which === this.keyCodes.arrowDown; 1093 var isMaterialSelectVisible = this.$materialOptionsList.is(':visible'); 1094 1095 if (isTab) { 1096 this._handleTabKey($this); 1097 1098 return; 1099 } else if (isArrowDown && !isMaterialSelectVisible) { 1100 $this.trigger('open'); 1101 return; 1102 } else if (isEnter && !isMaterialSelectVisible) { 1103 return; 1104 } 1105 1106 e.preventDefault(); 1107 1108 if (isEnter) { 1109 this._handleEnterKey($this); 1110 } else if (isArrowDown) { 1111 this._handleArrowDownKey(); 1112 } else if (isArrowUp) { 1113 this._handleArrowUpKey(); 1114 } else if (isEsc) { 1115 this._handleEscKey($this); 1116 } else { 1117 this._handleLetterKey(e); 1118 } 1119 } 1120 }, { 1121 key: "_handleTabKey", 1122 value: function _handleTabKey(materialSelect) { 1123 this._handleEscKey(materialSelect); 1124 } 1125 }, { 1126 key: "_handleEnterKey", 1127 value: function _handleEnterKey(materialSelect) { 1128 var $activeOption = this.$materialOptionsList.find('li.selected:not(.disabled)'); 1129 $activeOption.trigger('click').addClass('active'); 1130 1131 if (!this.isMultiple) { 1132 $(materialSelect).trigger('close'); 1133 } 1134 } 1135 }, { 1136 key: "_handleArrowDownKey", 1137 value: function _handleArrowDownKey() { 1138 var $firstOption = this.$materialOptionsList.find('li').not('.disabled').first(); 1139 var $lastOption = this.$materialOptionsList.find('li').not('.disabled').last(); 1140 var anySelected = this.$materialOptionsList.find('li.selected').length > 0; 1141 var $currentOption = anySelected ? this.$materialOptionsList.find('li.selected') : $firstOption; 1142 var $matchedMaterialOption = $currentOption.is($lastOption) || !anySelected ? $currentOption : $currentOption.next('li:not(.disabled)'); 1143 1144 this._selectSingleOption($matchedMaterialOption); 1145 1146 if (!$matchedMaterialOption.find('input').is(':checked')) { 1147 $matchedMaterialOption.removeClass('active'); 1148 } 1149 1150 if (!$matchedMaterialOption.prev().hasClass('selected') && !$matchedMaterialOption.prev().find('input').is(':checked')) { 1151 $matchedMaterialOption.prev().removeClass('active'); 1152 } 1153 1154 $matchedMaterialOption.addClass('active'); 1155 } 1156 }, { 1157 key: "_handleArrowUpKey", 1158 value: function _handleArrowUpKey() { 1159 var $firstOption = this.$materialOptionsList.find('li').not('.disabled').first(); 1160 var $lastOption = this.$materialOptionsList.find('li').not('.disabled').last(); 1161 var anySelected = this.$materialOptionsList.find('li.selected').length > 0; 1162 var $currentOption = anySelected ? this.$materialOptionsList.find('li.selected') : $lastOption; 1163 var $matchedMaterialOption = $currentOption.is($firstOption) || !anySelected ? $currentOption : $currentOption.prev('li:not(.disabled)'); 1164 1165 this._selectSingleOption($matchedMaterialOption); 1166 1167 if (!$matchedMaterialOption.find('input').is(':checked')) { 1168 $matchedMaterialOption.removeClass('active'); 1169 } 1170 1171 if (!$matchedMaterialOption.next().hasClass('selected') && !$matchedMaterialOption.next().find('input').is(':checked')) { 1172 $matchedMaterialOption.next().removeClass('active'); 1173 } 1174 1175 $matchedMaterialOption.addClass('active'); 1176 } 1177 }, { 1178 key: "_handleEscKey", 1179 value: function _handleEscKey(materialSelect) { 1180 $(materialSelect).trigger('close'); 1181 } 1182 }, { 1183 key: "_handleLetterKey", 1184 value: function _handleLetterKey(e) { 1185 var _this5 = this; 1186 1187 var filterQueryString = ''; 1188 var letter = String.fromCharCode(e.which).toLowerCase(); 1189 var nonLetters = Object.keys(this.keyCodes).map(function (key) { 1190 return _this5.keyCodes[key]; 1191 }); 1192 var isLetterSearchable = letter && nonLetters.indexOf(e.which) === -1; 1193 1194 if (isLetterSearchable) { 1195 filterQueryString += letter; 1196 var $matchedMaterialOption = this.$materialOptionsList.find('li').filter(function (index, element) { 1197 return $(element).text().toLowerCase().includes(filterQueryString); 1198 }).first(); 1199 1200 if (!this.isMultiple) { 1201 this.$materialOptionsList.find('li').removeClass('active'); 1202 } 1203 1204 $matchedMaterialOption.addClass('active'); 1205 1206 this._selectSingleOption($matchedMaterialOption); 1207 } 1208 } 1209 }, {
1210 key: "_onSearchInputKeyup", 1211 value: function _onSearchInputKeyup(e) { 1212 var $this = $(e.target); 1213 var $ul = $this.closest('ul'); 1214 var searchValue = $this.val(); 1215 var $options = $ul.find('li span.filtrable'); 1216 $options.each(function () { 1217 var $option = $(this); 1218 1219 if (typeof this.outerHTML === 'string') { 1220 var liValue = this.textContent.toLowerCase(); 1221 1222 if (liValue.includes(searchValue.toLowerCase())) { 1223 $option.show().parent().show(); 1224 } else { 1225 $option.hide().parent().hide(); 1226 } 1227 } 1228 }); 1229 } 1230 }, { 1231 key: "_isToggleAllPresent", 1232 value: function _isToggleAllPresent() { 1233 return this.$materialOptionsList.find(this.$toggleAll).length; 1234 } 1235 }, { 1236 key: "_updateToggleAllOption", 1237 value: function _updateToggleAllOption() { 1238 var $allOptionsButToggleAll = this.$materialOptionsList.find('li').not('.select-toggle-all, .disabled').find('[type=checkbox]'); 1239 var $checkedOptionsButToggleAll = $allOptionsButToggleAll.filter(':checked'); 1240 var isToggleAllChecked = this.$toggleAll.find('[type=checkbox]').is(':checked'); 1241 1242 if ($checkedOptionsButToggleAll.length === $allOptionsButToggleAll.length && !isToggleAllChecked) { 1243 this.$toggleAll.find('[type=checkbox]').prop('checked', true); 1244 } else if ($checkedOptionsButToggleAll.length < $allOptionsButToggleAll.length && isToggleAllChecked) { 1245 this.$toggleAll.find('[type=checkbox]').prop('checked', false); 1246 } 1247 } 1248 }, { 1249 key: "_toggleSelectedValue", 1250 value: function _toggleSelectedValue(optionIndex) { 1251 var selectedValueIndex = this.valuesSelected.indexOf(optionIndex); 1252 var isSelected = selectedValueIndex !== -1; 1253 1254 if (!isSelected) { 1255 this.valuesSelected.push(optionIndex); 1256 } else { 1257 this.valuesSelected.splice(selectedValueIndex, 1); 1258 } 1259 1260 this.$materialOptionsList.find('li:not(.optgroup):not(.select-toggle-all)').eq(optionIndex).toggleClass('active'); 1261 this.$nativeSelect.find('option').eq(optionIndex).prop('selected', !isSelected); 1262 1263 this._setValueToMaterialSelect(); 1264 1265 return !isSelected; 1266 } 1267 }, { 1268 key: "_selectSingleOption", 1269 value: function _selectSingleOption(newOption) { 1270 this.$materialOptionsList.find('li.selected').removeClass('selected'); 1271 1272 this._selectOption(newOption); 1273 } 1274 }, { 1275 key: "_selectOption", 1276 value: function _selectOption(newOption) { 1277 var option = $(newOption); 1278 option.addClass('selected'); 1279 } 1280 }, { 1281 key: "_setValueToMaterialSelect", 1282 value: function _setValueToMaterialSelect() { 1283 var _this6 = this; 1284 1285 var value = ''; 1286 var optionsSelected = 'options selected'; 1287 var itemsCount = this.valuesSelected.length; 1288 1289 if (this.options.language.active && this.$toggleAll) { 1290 if (this.options.language.pl) { 1291 optionsSelected = this.options.language.pl.optionsSelected ? this.options.language.pl.optionsSelected : this.defaults.language.pl.optionsSelected; 1292 } else if (this.options.language.fr) { 1293 optionsSelected = this.options.language.fr.optionsSelected ? this.options.language.fr.optionsSelected : this.defaults.language.fr.optionsSelected; 1294 } else if (this.options.language.ge) { 1295 optionsSelected = this.options.language.ge.optionsSelected ? this.options.language.ge.optionsSelected : this.defaults.language.ge.optionsSelected; 1296 } else if (this.options.language.ar) { 1297 optionsSelected = this.options.language.ar.optionsSelected ? this.options.language.ar.optionsSelected : this.defaults.language.ar.optionsSelected; 1298 } else if (this.options.language.in) { 1299 optionsSelected = this.options.language.in.optionsSelected ? this.options.language.in.optionsSelected : this.defaults.language.in.optionsSelected; 1300 } 1301 } 1302 1303 this.valuesSelected.map(function (el) { 1304 return value += ", ".concat(_this6.$nativeSelect.find('option').eq(el).text().replace(/ +/g, ' ').trim()); 1305 }); 1306 itemsCount >= 5 ? value = "".concat(itemsCount, " ").concat(optionsSelected) : value = value.substring(2); 1307 value.length === 0 && this.mainLabel.length === 0 ? value = this.$nativeSelect.find('option:disabled').eq(0).text() : null; 1308 value.length > 0 && !this.options.BSinputText ? this.mainLabel.addClass('active active-check') : this.mainLabel.removeClass('active'); 1309 this.options.BSinputText ? this.mainLabel.css('top', '-7px') : null; 1310 this.$nativeSelect.siblings("".concat(this.options.BSinputText ? "input.multi-bs-select" : "input.select-dropdown")).val(value); 1311 } 1312 }, {
1313 key: "_randomUUID", 1314 value: function _randomUUID() { 1315 var d = new Date().getTime(); 1316 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 1317 var r = (d + Math.random() * 16) % 16 | 0; 1318 d = Math.floor(d / 16); 1319 return (c === 'x' ? r : r & 0x3 | 0x8).toString(16); 1320 }); 1321 } 1322 }], [{ 1323 key: "clearMutationObservers", 1324 value: function clearMutationObservers() { 1325 MaterialSelect.mutationObservers.forEach(function (observer) { 1326 observer.disconnect(); 1327 observer.customStatus = 'stopped'; 1328 }); 1329 } 1330 }]); 1331 1332 return MaterialSelect; 1333 }(); 1334 1335 $.fn.materialSelect = function (callback) { 1336 $(this).not('.browser-default').not('.custom-select').each(function () { 1337 var materialSelect = new MaterialSelect($(this), callback); 1338 materialSelect.init(); 1339 }); 1340 }; 1341 1342 $.fn.material_select = $.fn.materialSelect; 1343 1344 (function (originalVal) { 1345 $.fn.val = function (value) { 1346 if (!arguments.length) { 1347 return originalVal.call(this); 1348 } 1349 1350 if (this.data('stop-refresh') !== true && this.hasClass('mdb-select') && this.hasClass('initialized')) { 1351 MaterialSelect.clearMutationObservers(); 1352 this.materialSelect({ 1353 'destroy': true 1354 }); 1355 var ret = originalVal.call(this, value); 1356 this.materialSelect(); 1357 return ret; 1358 } 1359 1360 return originalVal.call(this, value); 1361 }; 1362 })($.fn.val); 1363})(jQuery); 1364 1365jQuery('select').siblings('input.select-dropdown', 'input.multi-bs-select').on('mousedown', function (e) { 1366 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 1367 if (e.clientX >= e.target.clientWidth || e.clientY >= e.target.clientHeight) { 1368 e.preventDefault(); 1369 } 1370 } 1371});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.