Skip to content

Commit

Permalink
updating dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
risadams committed Jan 4, 2023
1 parent 24f0e51 commit 1cf9b54
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 82 deletions.
2 changes: 1 addition & 1 deletion dist/css/selectize.bootstrap2.css

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

4 changes: 2 additions & 2 deletions dist/css/selectize.bootstrap3.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.css

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

66 changes: 39 additions & 27 deletions dist/js/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://selectize.dev
*
* Copyright (c) 2013-2015 Brian Reavis & contributors
* Copyright (c) 2020-2022 Selectize Team & contributors
* Copyright (c) 2020-2023 Selectize Team & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
Expand Down Expand Up @@ -759,14 +759,15 @@ var autoGrow = function ($input) {
}
}

var width = $input.attr('readonly') ? 0 : 4;
placeholder = $input.attr('placeholder');
if (placeholder) {
placeholderWidth = measureString(placeholder, $input) + 4;
placeholderWidth = measureString(placeholder, $input) + width;
} else {
placeholderWidth = 0;
}

width = Math.max(measureString(value, $input), placeholderWidth) + 4;
width = Math.max(measureString(value, $input), placeholderWidth) + width;
if (width !== currentWidth) {
currentWidth = width;
$input.width(width);
Expand Down Expand Up @@ -925,12 +926,14 @@ $.extend(Selectize.prototype, {
var classes;
var classes_plugins;
var inputId;
var noArrowClass;

inputMode = self.settings.mode;
classes = $input.attr('class') || '';
classes = $input.attr('class') || '';
noArrowClass = settings.showArrow ? '' : ' no-arrow';

$wrapper = $('<div>').addClass(settings.wrapperClass).addClass(classes + ' selectize-control').addClass(inputMode);
$control = $('<div>').addClass(settings.inputClass + ' selectize-input items').appendTo($wrapper);
$control = $('<div>').addClass(settings.inputClass + noArrowClass + ' selectize-input items').appendTo($wrapper);
$control_input = $('<input type="text" autocomplete="new-password" autofill="no" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
$dropdown_parent = $(settings.dropdownParent || $wrapper);
$dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode + ' selectize-dropdown').hide().appendTo($dropdown_parent);
Expand Down Expand Up @@ -965,7 +968,7 @@ $.extend(Selectize.prototype, {

if (!self.settings.search) {
$control_input.attr('readonly', true);
$control_input.attr('inputmode', 'none');
$control_input.attr('inputmode', 'none');
$control.css('cursor', 'pointer');
}

Expand Down Expand Up @@ -1031,15 +1034,13 @@ $.extend(Selectize.prototype, {

$document.on('mousedown' + eventNS, function(e) {
if (self.isFocused) {
if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
if (
e.target === self.$dropdown[0] ||
self.$dropdown.has(e.target).length)
{
return false;
}
if (self.$dropdown.has(e.target).length) {
self.ignoreBlur = true;
window.setTimeout(function() {
self.ignoreBlur = false;
}, 0);
} else if (e.target !== self.$control[0]) {
if (e.target !== self.$control[0]) {
self.blur(e.target);
}
}
Expand Down Expand Up @@ -1185,28 +1186,30 @@ $.extend(Selectize.prototype, {

if (!self.isFocused) {
if (!defaultPrevented) {
window.setTimeout(function() {
self.focus();
}, 0);
window.setTimeout(function () {
if (!self.isOpen) {
self.focus();
}
}, 0);
}
}
if (e.target !== self.$control_input[0] || self.$control_input.val() === '') {
if ($target !== self.$control_input[0] || self.$control_input.val() === '') {
if (self.settings.mode === 'single') {
self.isOpen ? self.close() : self.open();
} else {
if (!defaultPrevented) {
self.setActiveItem(null);
}
if (!self.settings.openOnFocus) {
if (self.isOpen && e.target === self.lastOpenTarget) {
if (self.isOpen && $target === self.lastOpenTarget) {
self.close();
self.lastOpenTarget = false;
} else if (!self.isOpen) {
self.refreshOptions();
self.open();
self.lastOpenTarget = e.target;
self.lastOpenTarget = $target;
} else {
self.lastOpenTarget = e.target;
self.lastOpenTarget = $target;
}
}
}
Expand Down Expand Up @@ -1391,10 +1394,6 @@ $.extend(Selectize.prototype, {
onBlur: function(e, dest) {
var self = this;

if (self.ignoreBlur) {
return;
}

if (!self.isFocused) return;
self.isFocused = false;

Expand Down Expand Up @@ -2378,13 +2377,19 @@ $.extend(Selectize.prototype, {
var $control = this.$control;
var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
offset.top += $control.outerHeight(true);
var w = $control[0].getBoundingClientRect().width;
var w = this.$wrapper[0].style.width !== 'fit-content' ? this.settings.dropdownParent === 'body' ? 'max-content' : '100%' : 'max-content';
if (this.settings.minWidth && this.settings.minWidth > w)
{
w = this.settings.minWidth;
}
this.$dropdown.css({

if (this.settings.dropdownParent !== 'body' && w === 'max-content' && $control.outerWidth(true) >= this.$dropdown.outerWidth(true)) {
w = '100%';
}

this.$dropdown.css({
width : w,
minWidth : $control.outerWidth(true),
top : offset.top,
left : offset.left
});
Expand Down Expand Up @@ -2793,6 +2798,7 @@ Selectize.defaults = {

ignoreOnDropwdownHeight: 'img, i',
search: true,
showArrow: true,

render: {
}
Expand Down Expand Up @@ -2988,8 +2994,10 @@ Selectize.define("auto_position", function () {
controlPosBottom - dropdownHeight - wrapperHeight >= 0 ?
POSITION.top :
POSITION.bottom;
const w = this.$wrapper[0].style.width !== 'fit-content' ? this.settings.dropdownParent === 'body' ? 'max-content' : '100%' : 'max-content';
const styles = {
width: $control.outerWidth(),
width: w,
minWidth : $control.outerWidth(true),
left: offset.left
};

Expand All @@ -3009,6 +3017,10 @@ Selectize.define("auto_position", function () {
this.$control.removeClass('selectize-position-top');
}

if (this.settings.dropdownParent !== 'body' && w === 'max-content' && $control.outerWidth(true) >= this.$dropdown.outerWidth(true)) {
w = '100%';
}

this.$dropdown.css(styles);
};
}());
Expand Down
4 changes: 2 additions & 2 deletions dist/js/selectize.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/scss/selectize.scss
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ $select-spinner-border-color: $select-color-border;
cursor: text;
}

&:after {
&:not(.no-arrow):after {
content: " ";
display: block;
position: absolute;
Expand All @@ -353,7 +353,7 @@ $select-spinner-border-color: $select-color-border;
border-width: $select-arrow-size $select-arrow-size 0 $select-arrow-size;
border-color: $select-arrow-color transparent transparent transparent;
}
&.dropdown-active:after {
&:not(.no-arrow).dropdown-active:after {
margin-top: $select-arrow-size * -0.8;
border-width: 0 $select-arrow-size $select-arrow-size $select-arrow-size;
border-color: transparent transparent $select-arrow-color transparent;
Expand Down
2 changes: 1 addition & 1 deletion docs/static/css/selectize.bootstrap2.css

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

Loading

0 comments on commit 1cf9b54

Please sign in to comment.