diff --git a/dist/select.css b/dist/select.css index 0e713bb1b..5ecf93b20 100644 --- a/dist/select.css +++ b/dist/select.css @@ -1,33 +1,33 @@ /*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.7 - 2017-04-15T14:28:36.790Z + * ui-select-bs4 + * https://github.com/bmontgomery/ui-select + * Version: 0.19.8 - 2019-08-12T21:29:30.366Z * License: MIT */ /* Style when highlighting a search. */ .ui-select-highlight { - font-weight: bold; + font-weight: bold; } .ui-select-offscreen { - clip: rect(0 0 0 0) !important; - width: 1px !important; - height: 1px !important; - border: 0 !important; - margin: 0 !important; - padding: 0 !important; - overflow: hidden !important; - position: absolute !important; - outline: 0 !important; - left: 0px !important; - top: 0px !important; + clip: rect(0 0 0 0) !important; + width: 1px !important; + height: 1px !important; + border: 0 !important; + margin: 0 !important; + padding: 0 !important; + overflow: hidden !important; + position: absolute !important; + outline: 0 !important; + left: 0px !important; + top: 0px !important; } .ui-select-choices-row:hover { - background-color: #f5f5f5; + background-color: #f5f5f5; } /* Select2 theme */ @@ -38,11 +38,11 @@ } .select2-result-single { - padding-left: 0; + padding-left: 0; } .select2-locked > .select2-search-choice-close{ - display:none; + display:none; } .select-locked > .ui-select-match-close{ @@ -50,7 +50,7 @@ } body > .select2-container.open { - z-index: 9999; /* The z-index Select2 applies to the select2-drop */ + z-index: 9999; /* The z-index Select2 applies to the select2-drop */ } /* Handle up direction Select2 */ @@ -96,22 +96,22 @@ body > .select2-container.open { /* Helper class to show styles when focus */ .selectize-input.selectize-focus{ - border-color: #007FBB !important; + border-color: #007FBB !important; } /* Fix input width for Selectize theme */ .selectize-control.single > .selectize-input > input { - width: 100%; + width: 100%; } /* Fix line break when there's at least one item selected with the Selectize theme */ .selectize-control.multi > .selectize-input > input { - margin: 0 !important; + margin: 0 !important; } /* Fix dropdown width for Selectize theme */ .selectize-control > .selectize-dropdown { - width: 100%; + width: 100%; } /* Mark invalid Selectize */ @@ -139,42 +139,42 @@ body > .select2-container.open { /* Helper class to show styles when focus */ .btn-default-focus { - color: #333; - background-color: #EBEBEB; - border-color: #ADADAD; - text-decoration: none; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); + color: #333; + background-color: #EBEBEB; + border-color: #ADADAD; + text-decoration: none; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); } .ui-select-bootstrap .ui-select-toggle { - position: relative; + position: relative; } .ui-select-bootstrap .ui-select-toggle > .caret { - position: absolute; - height: 10px; - top: 50%; - right: 10px; - margin-top: -2px; + position: absolute; + height: 10px; + top: 50%; + right: 10px; + margin-top: -2px; } /* Fix Bootstrap dropdown position when inside a input-group */ .input-group > .ui-select-bootstrap.dropdown { - /* Instead of relative */ - position: static; + /* Instead of relative */ + position: static; } .input-group > .ui-select-bootstrap > input.ui-select-search.form-control { - border-radius: 4px; /* FIXME hardcoded value :-/ */ - border-top-right-radius: 0; - border-bottom-right-radius: 0; + border-radius: 4px; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0; + border-bottom-right-radius: 0; } .input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up { - border-radius: 4px !important; /* FIXME hardcoded value :-/ */ - border-top-right-radius: 0 !important; - border-bottom-right-radius: 0 !important; + border-radius: 4px !important; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; } .ui-select-bootstrap .ui-select-search-hidden{ @@ -187,27 +187,31 @@ body > .select2-container.open { } .ui-select-bootstrap > .ui-select-match > .btn{ - /* Instead of center because of .btn */ - text-align: left !important; + /* Instead of center because of .btn */ + text-align: left !important; } .ui-select-bootstrap > .ui-select-match > .caret { - position: absolute; - top: 45%; - right: 15px; + position: absolute; + top: 45%; + right: 15px; } /* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ .ui-select-bootstrap > .ui-select-choices ,.ui-select-bootstrap > .ui-select-no-choice { - width: 100%; - height: auto; - max-height: 200px; - overflow-x: hidden; - margin-top: -1px; + width: 100%; + height: auto; + max-height: 200px; + overflow-x: hidden; + margin-top: -1px; } body > .ui-select-bootstrap.open { - z-index: 1000; /* Standard Bootstrap dropdown z-index */ + z-index: 1000; /* Standard Bootstrap dropdown z-index */ +} + +.ui-select-container-margin { + margin: 3px; } .ui-select-multiple.ui-select-bootstrap { @@ -216,49 +220,53 @@ body > .ui-select-bootstrap.open { } .ui-select-multiple.ui-select-bootstrap input.ui-select-search { - background-color: transparent !important; /* To prevent double background when disabled */ - border: none; - outline: none; - height: 1.666666em; - margin-bottom: 3px; + background-color: transparent !important; /* To prevent double background when disabled */ + border: none; + outline: none; + height: 1.666666em; + margin-bottom: 3px; } .ui-select-multiple.ui-select-bootstrap .ui-select-match .close { - font-size: 1.6em; - line-height: 0.75; + font-size: 1.6em; + line-height: 0.75; +} + +.ui-select-multiple.ui-select-bootstrap4-1 .ui-select-match .close { + margin-top: 2px; } .ui-select-multiple.ui-select-bootstrap .ui-select-match-item { - outline: 0; - margin: 0 3px 3px 0; + outline: 0; + margin: 0 3px 3px 0; } .ui-select-multiple .ui-select-match-item { - position: relative; + position: relative; } .ui-select-multiple .ui-select-match-item.dropping .ui-select-match-close { - pointer-events: none; + pointer-events: none; } .ui-select-multiple:hover .ui-select-match-item.dropping-before:before { - content: ""; - position: absolute; - top: 0; - right: 100%; - height: 100%; - margin-right: 2px; - border-left: 1px solid #428bca; + content: ""; + position: absolute; + top: 0; + right: 100%; + height: 100%; + margin-right: 2px; + border-left: 1px solid #428bca; } .ui-select-multiple:hover .ui-select-match-item.dropping-after:after { - content: ""; - position: absolute; - top: 0; - left: 100%; - height: 100%; - margin-left: 2px; - border-right: 1px solid #428bca; + content: ""; + position: absolute; + top: 0; + left: 100%; + height: 100%; + margin-left: 2px; + border-right: 1px solid #428bca; } .ui-select-bootstrap .ui-select-choices-row>span { @@ -318,10 +326,206 @@ body > .ui-select-bootstrap.open { overflow: hidden; } .ui-select-bootstrap .ui-select-toggle > a.btn { - position: absolute; - height: 10px; - right: 10px; - margin-top: -2px; + position: absolute; + height: 10px; + right: 10px; + margin-top: -2px; +} + +/* Bootstrap v4 Theme */ + +/* Helper class to show styles when focus */ +.btn-default-focus { + color: #333; + background-color: #EBEBEB; + border-color: #ADADAD; + text-decoration: none; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); +} + +.ui-select-bootstrap4 .ui-select-toggle{ + position: relative; + padding-right: 25px; +} + +/* Fix Bootstrap dropdown position when inside a input-group */ +.input-group > .ui-select-bootstrap4.dropdown { + /* Instead of relative */ + position: static; +} + +.input-group > .ui-select-bootstrap4 > input.ui-select-search.form-control { + border-radius: 4px; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.input-group > .ui-select-bootstrap4 > input.ui-select-search.form-control.direction-up { + border-radius: 4px !important; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; +} + +.ui-select-bootstrap4 .ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + +.ui-select-bootstrap4 > .ui-select-match > .btn{ + /* Instead of center because of .btn */ + text-align: left !important; +} + +.ui-select-bootstrap4 > .ui-select-match > .caret { + position: absolute; + top: 45%; + right: 15px; +} + +/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ +.ui-select-bootstrap4 > .ui-select-choices ,.ui-select-bootstrap4 > .ui-select-no-choice { + width: 100%; + height: auto; + max-height: 200px; + overflow-x: hidden; + margin-top: -1px; +} + +body > .ui-select-bootstrap4.open { + z-index: 1000; /* Standard Bootstrap dropdown z-index */ +} + +.ui-select-multiple.ui-select-bootstrap4 { + height: auto; + padding: 3px 0 0 0; +} + +.ui-select-multiple.ui-select-bootstrap4-1 { + padding: 0 !important; +} + + + +.ui-select-multiple.ui-select-bootstrap4 input.ui-select-search { + background-color: transparent !important; /* To prevent double background when disabled */ + border: none; + outline: none; + height: 1.666666em; + margin-bottom: 3px; +} + +.ui-select-multiple.ui-select-bootstrap4 .ui-select-match .close { + font-size: 1.6em; + line-height: 0.75; +} + +.ui-select-multiple.ui-select-bootstrap4 .ui-select-match-item { + outline: 0; + margin: 0 3px 3px 0; +} + +.ui-select-multiple .ui-select-match-item { + position: relative; +} + +.ui-select-multiple .ui-select-match-item.dropping .ui-select-match-close { + pointer-events: none; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-before:before { + content: ""; + position: absolute; + top: 0; + right: 100%; + height: 100%; + margin-right: 2px; + border-left: 1px solid #428bca; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-after:after { + content: ""; + position: absolute; + top: 0; + left: 100%; + height: 100%; + margin-left: 2px; + border-right: 1px solid #428bca; +} + +.ui-select-bootstrap4 .ui-select-choices-row>span { + cursor: pointer; + display: block; + padding: 3px 20px; + clear: both; + font-weight: 400; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} + +.ui-select-bootstrap4 .ui-select-choices-row>span:hover, .ui-select-bootstrap4 .ui-select-choices-row>span:focus { + text-decoration: none; + color: #262626; + background-color: #f5f5f5; +} + +.ui-select-bootstrap4 .ui-select-choices-row.active>span { + color: #fff; + text-decoration: none; + outline: 0; + background-color: #428bca; +} + +.ui-select-bootstrap4 .ui-select-choices-row.disabled>span, +.ui-select-bootstrap4 .ui-select-choices-row.active.disabled>span { + color: #777; + cursor: not-allowed; + background-color: #fff; +} + +/* fix hide/show angular animation */ +.ui-select-match.ng-hide-add, +.ui-select-search.ng-hide-add { + display: none !important; +} + +/* Mark invalid Bootstrap */ +.ui-select-bootstrap4.ng-dirty.ng-invalid > button.btn.ui-select-match { + border-color: #D44950; +} + +/* Handle up direction Bootstrap */ +.ui-select-container[theme="bootstrap4"].direction-up .ui-select-dropdown { + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); +} + +.ui-select-bootstrap4 .ui-select-match-text { + width: 100%; +} + +.ui-select-bootstrap4 .ui-select-match-text span, .ui-select-bootstrap4 .ui-select-placeholder span { + display: inline-block; + width: 100%; +} + +.ui-select-bootstrap4 .ui-select-toggle > a.btn { + position: absolute; + height: 10px; + right: 10px; + margin-top: -2px; + padding: 3px 10px 0 0; +} + +.ui-select-bootstrap4-1 .ui-select-toggle > a.btn { + margin-right: 10px; + font-weight: bold; + top:-2px; + font-size: 1.5rem; } /* Spinner */ @@ -329,34 +533,38 @@ body > .ui-select-bootstrap.open { position: absolute; right: 0; padding: 8px 27px; - } +} @-webkit-keyframes ui-select-spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } @keyframes ui-select-spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } } .ui-select-spin { - -webkit-animation: ui-select-spin 2s infinite linear; - animation: ui-select-spin 2s infinite linear; + -webkit-animation: ui-select-spin 2s infinite linear; + animation: ui-select-spin 2s infinite linear; } .ui-select-refreshing.ng-animate { - -webkit-animation: none 0s; + -webkit-animation: none 0s; +} + +.ui-select-bootstrap4 .ui-select-placeholder { + width: 100%; } diff --git a/dist/select.js b/dist/select.js index 5ac4e0b70..9c0bccedd 100644 --- a/dist/select.js +++ b/dist/select.js @@ -1,7 +1,7 @@ /*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.7 - 2017-04-15T14:28:36.649Z + * ui-select-bs4 + * https://github.com/bmontgomery/ui-select + * Version: 0.19.8 - 2019-08-12T21:29:30.322Z * License: MIT */ @@ -184,31 +184,6 @@ var uis = angular.module('ui.select', []) }; }]); -/** - * Debounces functions - * - * Taken from UI Bootstrap $$debounce source code - * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js - * - */ -uis.factory('$$uisDebounce', ['$timeout', function($timeout) { - return function(callback, debounceTime) { - var timeoutPromise; - - return function() { - var self = this; - var args = Array.prototype.slice.call(arguments); - if (timeoutPromise) { - $timeout.cancel(timeoutPromise); - } - - timeoutPromise = $timeout(function() { - callback.apply(self, args); - }, debounceTime); - }; - }; -}]); - uis.directive('uiSelectChoices', ['uiSelectConfig', 'uisRepeatParser', 'uiSelectMinErr', '$compile', '$window', function(uiSelectConfig, RepeatParser, uiSelectMinErr, $compile, $window) { @@ -836,7 +811,7 @@ uis.controller('uiSelectCtrl', if (containerWidth === 0) { return false; } - var inputWidth = containerWidth - input.offsetLeft; + var inputWidth = containerWidth - input.offsetLeft - 1 - 20; // - 1 for rounding error, -20 for scroll bar; if (inputWidth < 50) inputWidth = containerWidth; ctrl.searchInput.css('width', inputWidth+'px'); return true; @@ -2302,6 +2277,31 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f }; }]); +/** + * Debounces functions + * + * Taken from UI Bootstrap $$debounce source code + * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js + * + */ +uis.factory('$$uisDebounce', ['$timeout', function($timeout) { + return function(callback, debounceTime) { + var timeoutPromise; + + return function() { + var self = this; + var args = Array.prototype.slice.call(arguments); + if (timeoutPromise) { + $timeout.cancel(timeoutPromise); + } + + timeoutPromise = $timeout(function() { + callback.apply(self, args); + }, debounceTime); + }; + }; +}]); + uis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) { return { restrict: 'A', @@ -2411,8 +2411,20 @@ angular.module("ui.select").run(["$templateCache", function($templateCache) {$te $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); $templateCache.put("bootstrap/match.tpl.html","
"); $templateCache.put("bootstrap/no-choice.tpl.html","