Skip to content

Commit a9a21d0

Browse files
authored
Merge pull request #43 from SengitU/master
Resolved a bug related to display-type text
2 parents 253167a + 0d043ba commit a9a21d0

9 files changed

Lines changed: 67 additions & 41 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uxrocket.select",
3-
"version": "3.5.7",
3+
"version": "3.5.8",
44
"homepage": "https://github.com/uxrocket/uxrocket.select",
55
"authors": [
66
"Bilal Çınarlı <bcinarli@gmail.com>"

dist/uxrocket.select.js

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@
465465
Select.prototype.unbindUI = function() {
466466
this.emitEvent('destroy');
467467
this.$selection.off('.' + rocketName);
468+
this.$selection.parent().off('.' + rocketName);
468469
this.$el.off('.' + rocketName);
469470
};
470471

@@ -584,23 +585,29 @@
584585
if(!this.$drop) {
585586
this.prepareDrop();
586587
} else {
587-
this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected)
588+
this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected);
588589
}
589590

590591
this.$el.find('[value="' + value + '"]').removeAttr('selected');
591592
option.removeClass(selected);
592593
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+
}));
601598
}
602599

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)) {
604611
this.$selection.find('.' + selectionText).text(this.multiplePlaceholder);
605612
}
606613

@@ -826,16 +833,16 @@
826833
minWidth: this.$selection.outerWidth()
827834
};
828835
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
830837
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();
833840
var setPosition = {
834841
top: function(){
835-
optionList.css( { maxHeight: topSpace } );
842+
optionList.css( { maxHeight: topSpace > 250 ? 250 : topSpace} ); // Max-height for options
836843
},
837844
bottom: function(){
838-
optionList.css( { maxHeight: bottomSpace } );
845+
optionList.css( { maxHeight: bottomSpace > 250 ? 250 : bottomSpace } );
839846
}
840847
};
841848
if( bottomSpace >= dropHeight ){
@@ -1001,6 +1008,10 @@
10011008
focusedInstances.current = null;
10021009
}
10031010

1011+
if(focusedInstances.current && focusedInstances.current.el === this.$el[0]) {
1012+
focusedInstances.current = null;
1013+
}
1014+
10041015
this.unbindUI();
10051016
this.undecorateUI();
10061017

@@ -1159,7 +1170,7 @@
11591170
});
11601171

11611172
// version
1162-
ux.version = '3.5.7';
1173+
ux.version = '3.5.8';
11631174

11641175
// default settings
11651176
ux.settings = defaults;

dist/uxrocket.select.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/uxrocket.select.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3480,7 +3480,6 @@
34803480
console.log('Selected Text: ' + $el.text());
34813481
}
34823482
}
3483-
34843483
var $s = $('#sample-01').data('uxrSelect');
34853484
</script>
34863485
</body>

lib/uxrocket.select.js

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@
465465
Select.prototype.unbindUI = function() {
466466
this.emitEvent('destroy');
467467
this.$selection.off('.' + rocketName);
468+
this.$selection.parent().off('.' + rocketName);
468469
this.$el.off('.' + rocketName);
469470
};
470471

@@ -584,23 +585,29 @@
584585
if(!this.$drop) {
585586
this.prepareDrop();
586587
} else {
587-
this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected)
588+
this.$drop.find('[data-value="' + value + '"]').parent().removeClass(selected);
588589
}
589590

590591
this.$el.find('[value="' + value + '"]').removeAttr('selected');
591592
option.removeClass(selected);
592593
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+
}));
601598
}
602599

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)) {
604611
this.$selection.find('.' + selectionText).text(this.multiplePlaceholder);
605612
}
606613

@@ -826,16 +833,16 @@
826833
minWidth: this.$selection.outerWidth()
827834
};
828835
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
830837
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();
833840
var setPosition = {
834841
top: function(){
835-
optionList.css( { maxHeight: topSpace } );
842+
optionList.css( { maxHeight: topSpace > 250 ? 250 : topSpace} ); // Max-height for options
836843
},
837844
bottom: function(){
838-
optionList.css( { maxHeight: bottomSpace } );
845+
optionList.css( { maxHeight: bottomSpace > 250 ? 250 : bottomSpace } );
839846
}
840847
};
841848
if( bottomSpace >= dropHeight ){
@@ -1001,6 +1008,10 @@
10011008
focusedInstances.current = null;
10021009
}
10031010

1011+
if(focusedInstances.current && focusedInstances.current.el === this.$el[0]) {
1012+
focusedInstances.current = null;
1013+
}
1014+
10041015
this.unbindUI();
10051016
this.undecorateUI();
10061017

@@ -1159,7 +1170,7 @@
11591170
});
11601171

11611172
// version
1162-
ux.version = '3.5.7';
1173+
ux.version = '3.5.8';
11631174

11641175
// default settings
11651176
ux.settings = defaults;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uxrocket.select",
3-
"version": "3.5.7",
3+
"version": "3.5.8",
44
"description": "jQuery based Select box replacement function",
55
"repository": {
66
"type": "git",

uxrocket.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Select",
33
"registry": "uxrocket.select",
4-
"version": "3.5.7",
4+
"version": "3.5.8",
55
"paths": {
66
"lib": "lib/",
77
"dist": "dist/",

version.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Versiyon 3.5.8
2+
- FIX: Display-type text durumunda seçim sayısının sıfır olmaması problemi giderildi.
3+
- FIX: Drop pozisyonunun hesaplanmasındaki bir yanlışlık düzeltildi.
4+
- FIX: Component remove edildikten sonra da çalışan bir event düzeltildi.
5+
16
## Versiyon 3.5.7
27
- FIX: Display-type text olması durumunda pre-selected verilerin tag şeklinde gözükmesi problemi giderildi.
38
- FIX: Display-type tag olması durumunda pre-selected verilerin çalışması düzenlendi.

0 commit comments

Comments
 (0)