Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/css/selectize.bootstrap2.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/css/selectize.bootstrap4.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/css/selectize.bootstrap5.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/css/selectize.legacy.css

Large diffs are not rendered by default.

445 changes: 244 additions & 201 deletions dist/js/selectize.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/selectize.min.js

Large diffs are not rendered by default.

32 changes: 29 additions & 3 deletions dist/scss/selectize.bootstrap4.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,33 @@ $select-arrow-offset: calc(#{$select-padding-x} + 5px) !default;
border-radius: 0;
}

.input-group .#{$selectize}-input {
overflow: unset;
border-radius: 0 $select-border-radius $select-border-radius 0;
.input-group .#{$selectize}-control:not(:last-child) {
.#{$selectize}-input{
overflow: unset;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}

.input-group .#{$selectize}-control:not(:first-child) {
.#{$selectize}-input{
overflow: unset;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}

// .input-group .#{$selectize}-input {
// overflow: unset;
// border-radius: 0 $select-border-radius $select-border-radius 0;
// }

.#{selectize}-dropdown.plugin-auto_position.#{$selectize}-position-top {
border-top: $select-border!important;
border-bottom: $select-border!important;
border-radius: $select-border-radius!important;
}
.#{selectize}-control.plugin-auto_position .#{selectize}-input.#{$selectize}-position-top.dropdown-active {
border-radius: $select-border-radius!important;
border-top: $select-border!important;
}
38 changes: 30 additions & 8 deletions dist/scss/selectize.bootstrap5.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,39 @@ $select-arrow-offset: calc(#{$select-padding-x} + 5px) !default;
border-radius: 0;
}

.input-group .#{$selectize}-input {
overflow: unset;
border-radius: 0 $select-border-radius $select-border-radius 0;
.input-group>.input-group-append>.btn, .input-group>.form-control:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.input-group>.input-group-prepend>.btn {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}


.input-group .#{$selectize}-control:not(:last-child) {
.#{$selectize}-input{
overflow: unset;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}

.input-group .#{$selectize}-control:not(:first-child) {
.#{$selectize}-input{
overflow: unset;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}

.#{selectize}-dropdown.plugin-auto_position.#{$selectize}-position-top {
border-top: $select-border;
border-bottom: $select-border;
border-radius: $select-border-radius;
border-top: $select-border!important;
border-bottom: $select-border!important;
border-radius: $select-border-radius!important;
}
.#{selectize}-control.plugin-auto_position .#{selectize}-input.#{$selectize}-position-top.dropdown-active {
border-radius: $select-border-radius;
border-top: $select-border;
border-radius: $select-border-radius!important;
border-top: $select-border!important;
}
43 changes: 34 additions & 9 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -1851,19 +1851,44 @@ $.extend(Selectize.prototype, {
* element to reflect the current state.
*/
updateOriginalInput: function(opts) {
var i, n, options, label, self = this;
var i, n, existing, fresh, old, $options, label, value, values, self = this;
opts = opts || {};

if (self.tagType === TAG_SELECT) {
options = [];
for (i = 0, n = self.items.length; i < n; i++) {
label = self.options[self.items[i]][self.settings.labelField] || '';
options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
}
if (!options.length && !this.$input.attr('multiple')) {
options.push('<option value="" selected="selected"></option>');
$options = self.$input.find('option');
existing = [];
fresh = [];
old = [];
values = [];

$options.get().forEach(function(option) {
existing.push(option.value);
});

self.items.forEach(function(item) {
label = self.options[item][self.settings.labelField] || '';

values.push(item);

if (existing.indexOf(item) != -1) {
return;
}

fresh.push('<option value="' + escape_html(item) + '" selected="selected">' + escape_html(label) + '</option>');
});

old = existing.filter(function(value) {
return values.indexOf(value) < 0;
}).map(function(value) {
return 'option[value="' + value + '"]';
});

if (existing.length - old.length + fresh.length === 0 && !self.$input.attr('multiple')) {
fresh.push('<option value="" selected="selected"></option>');
}
self.$input.html(options.join(''));

self.$input.find(old.join(', ')).remove();
self.$input.append(fresh.join(''));
} else {
self.$input.val(self.getValue());
self.$input.attr('value',self.$input.val());
Expand Down