Skip to content

Commit

Permalink
Release v1.13.3
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol committed Oct 15, 2018
1 parent b8fadf6 commit 0a79b80
Show file tree
Hide file tree
Showing 162 changed files with 399 additions and 319 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# v1.13.3 (2018-10-15)

### Bug Fixes
- [#1425]: Don't render checkMark (tickIcon) if showTick is false or the select is not multiple
- [#1828]: Select not working on mobile
- [#2045]: 'auto' width not working
- [#2086]: Cannot read property 'display' of undefined
- [#2092]: Cannot read property 'className' of undefined
- [#2101]: Extra tick mark when using livesearch in Bootstrap 4

[#1425]: https://github.com/snapappointments/bootstrap-select/issues/#1425
[#1828]: https://github.com/snapappointments/bootstrap-select/issues/#1828
[#2045]: https://github.com/snapappointments/bootstrap-select/issues/#2045
[#2086]: https://github.com/snapappointments/bootstrap-select/issues/#2086
[#2092]: https://github.com/snapappointments/bootstrap-select/issues/#2092
[#2101]: https://github.com/snapappointments/bootstrap-select/issues/#2101

-------------------

# v1.13.2 (2018-08-27)

### Bug Fixes
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Bootstrap-select requires jQuery v1.9.1+, Bootstrap’s dropdown.js component, a

Several quick start options are available:

- [Download the latest release.](https://github.com/snapappointments/bootstrap-select/archive/v1.13.2.zip)
- [Download the latest release.](https://github.com/snapappointments/bootstrap-select/archive/v1.13.3.zip)
- Clone the repo: `git clone https://github.com/snapappointments/bootstrap-select.git`
- Install with [npm](https://www.npmjs.com/package/bootstrap-select): `npm install bootstrap-select`
- Install with [yarn](https://yarn.pm/bootstrap-select): `yarn add bootstrap-select`
Expand All @@ -54,13 +54,13 @@ Several quick start options are available:

```html
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.2/css/bootstrap-select.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.3/css/bootstrap-select.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.2/js/bootstrap-select.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.3/js/bootstrap-select.min.js"></script>

<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.2/js/i18n/defaults-*.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.3/js/i18n/defaults-*.min.js"></script>
```
> The CDN is updated after the release is made public, which means that there is a delay between the publishing of a release and its availability on the CDN.
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-select.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-select.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

180 changes: 105 additions & 75 deletions dist/js/bootstrap-select.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-select v1.13.2 (https://developer.snapappointments.com/bootstrap-select)
* Bootstrap-select v1.13.3 (https://developer.snapappointments.com/bootstrap-select)
*
* Copyright 2012-2018 SnapAppointments, LLC
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
Expand Down Expand Up @@ -484,7 +484,7 @@
this.init();
};

Selectpicker.VERSION = '1.13.2';
Selectpicker.VERSION = '1.13.3';

Selectpicker.BootstrapVersion = version.major;

Expand Down Expand Up @@ -622,10 +622,10 @@
that.$button.addClass('bs-invalid');

that.$element.on({
'shown.bs.select': function () {
'shown.bs.select.invalid': function () {
that.$element
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
.off('shown.bs.select');
.off('shown.bs.select.invalid');
},
'rendered.bs.select': function () {
// if select is no longer invalid, remove the bs-invalid class
Expand All @@ -651,61 +651,87 @@
// If we are multiple or showTick option is set, then add the show-tick class
var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '',
autofocus = this.autofocus ? ' autofocus' : '';

// Elements
var header = this.options.header ? '<div class="' + classNames.POPOVERHEADER + '"><button type="button" class="close" aria-hidden="true">&times;</button>' + this.options.header + '</div>' : '';
var searchbox = this.options.liveSearch ?
'<div class="bs-searchbox">' +
'<input type="text" class="form-control" autocomplete="off"' +
(null === this.options.liveSearchPlaceholder ? '' : ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"') + ' role="textbox" aria-label="Search">' +
'</div>'
: '';
var actionsbox = this.multiple && this.options.actionsBox ?
'<div class="bs-actionsbox">' +
'<div class="btn-group btn-group-sm btn-block">' +
'<button type="button" class="actions-btn bs-select-all btn ' + classNames.BUTTONCLASS + '">' +
this.options.selectAllText +
'</button>' +
'<button type="button" class="actions-btn bs-deselect-all btn ' + classNames.BUTTONCLASS + '">' +
this.options.deselectAllText +
'</button>' +
'</div>' +
'</div>'
: '';
var donebutton = this.multiple && this.options.doneButton ?
'<div class="bs-donebutton">' +
'<div class="btn-group btn-block">' +
'<button type="button" class="btn btn-sm ' + classNames.BUTTONCLASS + '">' +
this.options.doneButtonText +
'</button>' +
'</div>' +
'</div>'
: '';
var drop =
'<div class="dropdown bootstrap-select' + showTick + '">' +
var drop,
header = '',
searchbox = '',
actionsbox = '',
donebutton = '';

if (this.options.header) {
header =
'<div class="' + classNames.POPOVERHEADER + '">' +
'<button type="button" class="close" aria-hidden="true">&times;</button>' +
this.options.header +
'</div>';
}

if (this.options.liveSearch) {
searchbox =
'<div class="bs-searchbox">' +
'<input type="text" class="form-control" autocomplete="off"' +
(
null === this.options.liveSearchPlaceholder ? ''
:
' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"'
) +
' role="textbox" aria-label="Search">' +
'</div>';
}

if (this.multiple && this.options.actionsBox) {
actionsbox =
'<div class="bs-actionsbox">' +
'<div class="btn-group btn-group-sm btn-block">' +
'<button type="button" class="actions-btn bs-select-all btn ' + classNames.BUTTONCLASS + '">' +
this.options.selectAllText +
'</button>' +
'<button type="button" class="actions-btn bs-deselect-all btn ' + classNames.BUTTONCLASS + '">' +
this.options.deselectAllText +
'</button>' +
'</div>' +
'</div>';
}

if (this.multiple && this.options.doneButton) {
donebutton =
'<div class="bs-donebutton">' +
'<div class="btn-group btn-block">' +
'<button type="button" class="btn btn-sm ' + classNames.BUTTONCLASS + '">' +
this.options.doneButtonText +
'</button>' +
'</div>' +
'</div>';
}

drop =
'<div class="dropdown bootstrap-select' + showTick + '">' +
'<button type="button" class="' + this.options.styleBase + ' dropdown-toggle" ' + (this.options.display === 'static' ? 'data-display="static"' : '') + 'data-toggle="dropdown"' + autofocus + ' role="button">' +
'<div class="filter-option">' +
'<div class="filter-option-inner">' +
'<div class="filter-option-inner-inner"></div>' +
'</div> ' +
'</div>' +
(version.major === '4' ?
'' :
'<span class="bs-caret">' +
this.options.template.caret +
'</span>'
) +
'<div class="filter-option">' +
'<div class="filter-option-inner">' +
'<div class="filter-option-inner-inner"></div>' +
'</div> ' +
'</div>' +
(
version.major === '4' ? ''
:
'<span class="bs-caret">' +
this.options.template.caret +
'</span>'
) +
'</button>' +
'<div class="' + classNames.MENU + ' ' + (version.major === '4' ? '' : classNames.SHOW) + '" role="combobox">' +
header +
searchbox +
actionsbox +
'<div class="inner ' + classNames.SHOW + '" role="listbox" aria-expanded="false" tabindex="-1">' +
'<ul class="' + classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : '') + '">' +
'</ul>' +
'</div>' +
donebutton +
header +
searchbox +
actionsbox +
'<div class="inner ' + classNames.SHOW + '" role="listbox" aria-expanded="false" tabindex="-1">' +
'<ul class="' + classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : '') + '">' +
'</ul>' +
'</div>' +
donebutton +
'</div>' +
'</div>';
'</div>';

return $(drop);
},
Expand Down Expand Up @@ -939,11 +965,15 @@
li: document.createElement('li'),
whitespace: document.createTextNode("\u00A0")
},
checkMark = elementTemplates.span.cloneNode(false),
checkMark,
fragment = document.createDocumentFragment();

checkMark.className = that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';
elementTemplates.a.appendChild(checkMark);
if (that.options.showTick || that.multiple) {
checkMark = elementTemplates.span.cloneNode(false);
checkMark.className = that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';
elementTemplates.a.appendChild(checkMark);
}

elementTemplates.a.setAttribute('role', 'option');

elementTemplates.subtext.className = 'text-muted';
Expand All @@ -954,12 +984,11 @@
// Helper functions
/**
* @param content
* @param [index]
* @param [classes]
* @param [optgroup]
* @returns {HTMLElement}
*/
var generateLI = function (content, index, classes, optgroup) {
var generateLI = function (content, classes, optgroup) {
var li = elementTemplates.li.cloneNode(false);

if (content) {
Expand Down Expand Up @@ -1147,7 +1176,6 @@
mainElements.push(
generateLI(
false,
null,
classNames.DIVIDER,
optID + 'div'
)
Expand Down Expand Up @@ -1190,7 +1218,6 @@
mainElements.push(
generateLI(
false,
null,
classNames.DIVIDER,
optID + 'div'
)
Expand All @@ -1208,7 +1235,7 @@
labelIcon: labelIcon
});

mainElements.push(generateLI(labelElement, null, 'dropdown-header' + optGroupClass, optID));
mainElements.push(generateLI(labelElement, 'dropdown-header' + optGroupClass, optID));
mainData.push({
content: labelEscaped,
subtext: labelSubtext,
Expand All @@ -1231,7 +1258,7 @@
optionIcon: icon
});

mainElements.push(generateLI(generateA(textElement, 'opt ' + optionClass + optGroupClass, inline), index, '', optID));
mainElements.push(generateLI(generateA(textElement, 'opt ' + optionClass + optGroupClass, inline), '', optID));
mainData.push({
content: optionContent || text,
subtext: subtext,
Expand All @@ -1246,7 +1273,7 @@

availableOptionsCount++;
} else if (thisData.divider === true) {
mainElements.push(generateLI(false, index, classNames.DIVIDER));
mainElements.push(generateLI(false, classNames.DIVIDER));
mainData.push({
type: 'divider',
originalIndex: index,
Expand All @@ -1272,7 +1299,6 @@
mainElements.push(
generateLI(
false,
null,
classNames.DIVIDER,
optID + 'div'
)
Expand All @@ -1290,7 +1316,7 @@
optionIcon: icon
});

mainElements.push(generateLI(generateA(textElement, optionClass, inline), index));
mainElements.push(generateLI(generateA(textElement, optionClass, inline)));
mainData.push({
content: optionContent || text,
subtext: subtext,
Expand Down Expand Up @@ -1464,12 +1490,13 @@
header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null,
search = this.options.liveSearch ? document.createElement('div') : null,
actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null;
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null,
firstOption = this.$element.find('option')[0];

this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth;

text.className = 'text';
a.className = 'dropdown-item ' + this.$element.find('option')[0].className;
a.className = 'dropdown-item ' + (firstOption ? firstOption.className : '');
newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW;
newElement.style.width = this.sizeInfo.selectWidth + 'px';
if (this.options.width === 'auto') menu.style.minWidth = 0;
Expand Down Expand Up @@ -1754,7 +1781,11 @@
getPlacement = function ($element) {
var containerPosition = {},
// fall back to dropdown's default display setting if display is not manually set
display = that.options.display || $.fn.dropdown.Constructor.Default.display;
display = that.options.display || (
// Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default
$.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display
: false
);

that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP));
pos = $element.offset();
Expand Down Expand Up @@ -1883,10 +1914,8 @@
prevActiveIndex = this.selectpicker.main.map.newIndex[this.prevActiveIndex];
prevActive = this.selectpicker.main.elements[prevActiveIndex];

prevActive.classList.toggle('selected', selected);
prevActive.classList.remove('active');
if (prevActive.firstChild) {
prevActive.firstChild.classList.toggle('selected', selected);
prevActive.firstChild.classList.remove('active');
}
}
Expand Down Expand Up @@ -2200,7 +2229,7 @@
changed_arguments = null;
},
'focus': function () {
that.$button.focus();
if (!that.options.mobile) that.$button.focus();
}
});
},
Expand Down Expand Up @@ -2301,9 +2330,10 @@

val: function (value) {
if (typeof value !== 'undefined') {
this.$element
.val(value)
.triggerNative('change');
this.$element.val(value);
this.render();
this.$element.trigger('changed.bs.select', changed_arguments);
changed_arguments = null;

return this.$element;
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/js/bootstrap-select.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/bootstrap-select.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/i18n/defaults-ar_AR.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-select v1.13.2 (https://developer.snapappointments.com/bootstrap-select)
* Bootstrap-select v1.13.3 (https://developer.snapappointments.com/bootstrap-select)
*
* Copyright 2012-2018 SnapAppointments, LLC
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
Expand Down
2 changes: 1 addition & 1 deletion dist/js/i18n/defaults-ar_AR.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a79b80

Please sign in to comment.