Skip to content

Commit

Permalink
feat: add option 'showArrow'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienwnklr authored and risadams committed Dec 23, 2022
1 parent 4b6b563 commit b7d625c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Selectize.defaults = {

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

/*
load : null, // function(query, callback) { ... }
Expand Down
4 changes: 2 additions & 2 deletions src/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
6 changes: 4 additions & 2 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,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

0 comments on commit b7d625c

Please sign in to comment.