|
465 | 465 | Select.prototype.unbindUI = function() { |
466 | 466 | this.emitEvent('destroy'); |
467 | 467 | this.$selection.off('.' + rocketName); |
| 468 | + this.$selection.parent().off('.' + rocketName); |
468 | 469 | this.$el.off('.' + rocketName); |
469 | 470 | }; |
470 | 471 |
|
|
584 | 585 | if(!this.$drop) { |
585 | 586 | this.prepareDrop(); |
586 | 587 | } else { |
587 | | - this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected) |
| 588 | + this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected); |
588 | 589 | } |
589 | 590 |
|
590 | 591 | this.$el.find('[value="' + value + '"]').removeAttr('selected'); |
591 | 592 | option.removeClass(selected); |
592 | 593 | this.$selection.find('[data-value="' + value + '"]').remove(); |
593 | | - this.$el.val($.grep(this.$el.val(), function(val) { |
594 | | - return val !== value; |
595 | | - })); |
596 | | - |
597 | | - if(this.multiple && this.options.displayType !== 'tags' && this.$el.val() !== null) { |
598 | | - this.$selection |
599 | | - .find('.' + selectionText) |
600 | | - .html(this.options.multipleInfoMessage + ' ' + this.$el.val().length + '/' + this.optionData.length); |
| 594 | + if(this.$el.val()) { |
| 595 | + this.$el.val($.grep(this.$el.val(), function(val) { |
| 596 | + return val !== value; |
| 597 | + })); |
601 | 598 | } |
602 | 599 |
|
603 | | - if(this.multiple && this.options.displayType === 'tags' && this.$el.val().length < 1) { |
| 600 | + if(this.multiple && this.options.displayType !== 'tags') { |
| 601 | + var $selection = this.$selection.find('.' + selectionText); |
| 602 | + if(this.$el.val()) { |
| 603 | + $selection.html(this.options.multipleInfoMessage + ' ' + this.$el.val().length + '/' + this.optionData.length); |
| 604 | + } |
| 605 | + else { |
| 606 | + $selection.html(this.options.multipleInfoMessage + ' ' + 0 + '/' + this.optionData.length); |
| 607 | + } |
| 608 | + } |
| 609 | + |
| 610 | + if(this.multiple && this.options.displayType === 'tags' && (this.$el.val() === null || this.$el.val().length < 1)) { |
604 | 611 | this.$selection.find('.' + selectionText).text(this.multiplePlaceholder); |
605 | 612 | } |
606 | 613 |
|
|
826 | 833 | minWidth: this.$selection.outerWidth() |
827 | 834 | }; |
828 | 835 | var optionList = $('.uxr-select-list'); |
829 | | - var dropHeight = this.$drop.height(); |
| 836 | + var dropHeight = this.$drop.height() > 280 ? 280 : this.$drop.height(); // Max-height with search field |
830 | 837 | var totalVisibleHeight = document.documentElement.clientHeight; |
831 | | - var topSpace = (this.$el.offset().top - $(window).scrollTop()) > 250 ? 250 : this.$el.offset().top - $(window).scrollTop(); |
832 | | - var bottomSpace = ((totalVisibleHeight - topSpace) - this.$selection.height()) > 250 ? 250 :(totalVisibleHeight - topSpace) - this.$selection.height(); |
| 838 | + var topSpace = this.$el.offset().top - $(window).scrollTop(); |
| 839 | + var bottomSpace = (totalVisibleHeight - topSpace) - this.$selection.height(); |
833 | 840 | var setPosition = { |
834 | 841 | top: function(){ |
835 | | - optionList.css( { maxHeight: topSpace } ); |
| 842 | + optionList.css( { maxHeight: topSpace > 250 ? 250 : topSpace} ); // Max-height for options |
836 | 843 | }, |
837 | 844 | bottom: function(){ |
838 | | - optionList.css( { maxHeight: bottomSpace } ); |
| 845 | + optionList.css( { maxHeight: bottomSpace > 250 ? 250 : bottomSpace } ); |
839 | 846 | } |
840 | 847 | }; |
841 | 848 | if( bottomSpace >= dropHeight ){ |
|
1001 | 1008 | focusedInstances.current = null; |
1002 | 1009 | } |
1003 | 1010 |
|
| 1011 | + if(focusedInstances.current && focusedInstances.current.el === this.$el[0]) { |
| 1012 | + focusedInstances.current = null; |
| 1013 | + } |
| 1014 | + |
1004 | 1015 | this.unbindUI(); |
1005 | 1016 | this.undecorateUI(); |
1006 | 1017 |
|
|
1159 | 1170 | }); |
1160 | 1171 |
|
1161 | 1172 | // version |
1162 | | - ux.version = '3.5.7'; |
| 1173 | + ux.version = '3.5.8'; |
1163 | 1174 |
|
1164 | 1175 | // default settings |
1165 | 1176 | ux.settings = defaults; |
|
0 commit comments