diff --git a/dist/select.js b/dist/select.js index 5ac4e0b70..699aad6d8 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 + * Version: 0.19.8 - 2018-04-23T19:03:31.128Z * 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) { @@ -367,6 +342,11 @@ uis.controller('uiSelectCtrl', return isNil(ctrl.selected) || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0); }; + ctrl.getPlaceholder = function(){ + if(ctrl.selected && ctrl.selected.length) return; + return ctrl.placeholder; + }; + function _findIndex(collection, predicate, thisArg){ if (collection.findIndex){ return collection.findIndex(predicate, thisArg); @@ -390,10 +370,14 @@ uis.controller('uiSelectCtrl', if (ctrl.resetSearchInput) { ctrl.search = EMPTY_SEARCH; //reset activeIndex - if (ctrl.selected && ctrl.items.length && !ctrl.multiple) { - ctrl.activeIndex = _findIndex(ctrl.items, function(item){ - return angular.equals(this, item); - }, ctrl.selected); + if (!ctrl.multiple) { + if (ctrl.selected && ctrl.items.length) { + ctrl.activeIndex = _findIndex(ctrl.items, function(item){ + return angular.equals(this, item); + }, ctrl.selected); + } else { + ctrl.activeIndex = 0; + } } } } @@ -451,7 +435,7 @@ uis.controller('uiSelectCtrl', } else { $timeout(function () { ctrl.focusSearchInput(initSearchValue); - if(!ctrl.tagging.isActivated && ctrl.items.length > 1) { + if(!ctrl.tagging.isActivated && ctrl.items.length > 1 && ctrl.open) { _ensureHighlightVisible(); } }); @@ -468,9 +452,12 @@ uis.controller('uiSelectCtrl', ctrl.searchInput[0].focus(); }; - ctrl.findGroupByName = function(name) { + ctrl.findGroupByName = function(name, noStrict) { return ctrl.groups && ctrl.groups.filter(function(group) { - return group.name === name; + if (noStrict) + return group.name == name; + else + return group.name === name; })[0]; }; @@ -767,11 +754,11 @@ uis.controller('uiSelectCtrl', ctrl.toggle = function(e) { if (ctrl.open) { ctrl.close(); - e.preventDefault(); - e.stopPropagation(); } else { ctrl.activate(); } + e.preventDefault(); + e.stopPropagation(); }; // Set default function for locked choices - avoids unnecessary @@ -874,11 +861,10 @@ uis.controller('uiSelectCtrl', } break; case KEY.UP: - var minActiveIndex = (ctrl.search.length === 0 && ctrl.tagging.isActivated) ? -1 : 0; if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode - else if (ctrl.activeIndex > minActiveIndex) { + else if (ctrl.activeIndex > 0) { var idxmin = --ctrl.activeIndex; - while(_isItemDisabled(ctrl.items[idxmin]) && idxmin > minActiveIndex) { + while(_isItemDisabled(ctrl.items[idxmin]) && idxmin > 0) { ctrl.activeIndex = --idxmin; } } @@ -1058,8 +1044,8 @@ uis.controller('uiSelectCtrl', }]); uis.directive('uiSelect', - ['$document', 'uiSelectConfig', 'uiSelectMinErr', 'uisOffset', '$compile', '$parse', '$timeout', - function($document, uiSelectConfig, uiSelectMinErr, uisOffset, $compile, $parse, $timeout) { + ['$document', 'uiSelectConfig', 'uiSelectMinErr', 'uisOffset', '$compile', '$parse', '$timeout', '$window', + function($document, uiSelectConfig, uiSelectMinErr, uisOffset, $compile, $parse, $timeout, $window) { return { restrict: 'EA', @@ -1265,11 +1251,15 @@ uis.directive('uiSelect', $select.clickTriggeredSelect = false; } - // See Click everywhere but here event http://stackoverflow.com/questions/12931369 - $document.on('click', onDocumentClick); + // See Click everywhere but here. Similar approach to http://stackoverflow.com/questions/12931369 + // but using the capture phase instead of bubble phase of the event propagation. + // + // Using the capture phase avoids problems that araise when event.stopPropatagion() + // is called before the event reaches the `document`. + $window.document.addEventListener('click', onDocumentClick, true); scope.$on('$destroy', function() { - $document.off('click', onDocumentClick); + $window.document.removeEventListener('click', onDocumentClick, true); }); // Move transcluded elements to their correct position in main template @@ -1303,6 +1293,24 @@ uis.directive('uiSelect', if (transcludedNoChoice.length == 1) { element.querySelectorAll('.ui-select-no-choice').replaceWith(transcludedNoChoice); } + + var transcludedHeader = transcluded.querySelectorAll('.ui-select-header'); + transcludedHeader.removeAttr('ui-select-header'); // To avoid loop in case directive as attr + transcludedHeader.removeAttr('data-ui-select-header'); // Properly handle HTML5 data-attributes + if (transcludedHeader.length == 1) { + element.querySelectorAll('.ui-select-header').replaceWith(transcludedHeader); + } else { + element.querySelectorAll('.ui-select-header').remove(); + } + + var transcludedFooter = transcluded.querySelectorAll('.ui-select-footer'); + transcludedFooter.removeAttr('ui-select-footer'); // To avoid loop in case directive as attr + transcludedFooter.removeAttr('data-ui-select-footer'); // Properly handle HTML5 data-attributes + if (transcludedFooter.length == 1) { + element.querySelectorAll('.ui-select-footer').replaceWith(transcludedFooter); + } else { + element.querySelectorAll('.ui-select-footer').remove(); + } }); // Support for appending the select field to the body when its open @@ -1437,7 +1445,7 @@ uis.directive('uiSelect', }; var opened = false; - + scope.calculateDropdownPos = function() { if ($select.open) { dropdown = angular.element(element).querySelectorAll('.ui-select-dropdown'); @@ -1481,6 +1489,117 @@ uis.directive('uiSelect', }; }]); +uis.directive('uiSelectFooter', ['uiSelectConfig', function (uiSelectConfig) { + return { + templateUrl: function (tElement) { + // Needed so the uiSelect can detect the transcluded content + tElement.addClass('ui-select-footer'); + + // Gets theme attribute from parent (ui-select) + var theme = tElement.parent().attr('theme') || uiSelectConfig.theme; + return theme + '/footer.tpl.html'; + }, + restrict: 'EA', + transclude: true, + replace: true + }; +}]); + +uis.directive('uiSelectHeader', ['uiSelectConfig', function (uiSelectConfig) { + return { + templateUrl: function (tElement) { + // Needed so the uiSelect can detect the transcluded content + tElement.addClass('ui-select-header'); + + // Gets theme attribute from parent (ui-select) + var theme = tElement.parent().attr('theme') || uiSelectConfig.theme; + return theme + '/header.tpl.html'; + }, + restrict: 'EA', + transclude: true, + replace: true + }; +}]); + +uis.directive('uiSelectHeaderGroupSelectable', ['$timeout', function($timeout) { + return { + restrict: 'EA', + require: ['^uiSelect'], + scope: { + isEnabled: " 0\">
  • 0\">
  • "); +angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html",""); +$templateCache.put("bootstrap/footer.tpl.html","
    "); +$templateCache.put("bootstrap/header.tpl.html","
    "); $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); -$templateCache.put("bootstrap/match.tpl.html","
    {{$select.placeholder}}
    "); +$templateCache.put("bootstrap/match.tpl.html","
    {{$select.placeholder}}
    "); $templateCache.put("bootstrap/no-choice.tpl.html",""); -$templateCache.put("bootstrap/select-multiple.tpl.html","
    "); -$templateCache.put("bootstrap/select.tpl.html","
    "); +$templateCache.put("bootstrap/select-multiple.tpl.html","
    0\" class=\"ui-select-dropdown dropdown-menu\">
    "); +$templateCache.put("bootstrap/select.tpl.html","
    0\" class=\"ui-select-dropdown dropdown-menu\">
    "); $templateCache.put("select2/choices.tpl.html",""); +$templateCache.put("select2/footer.tpl.html","
    "); +$templateCache.put("select2/header.tpl.html","
    "); $templateCache.put("select2/match-multiple.tpl.html","
  • "); $templateCache.put("select2/match.tpl.html","{{$select.placeholder}} "); $templateCache.put("select2/no-choice.tpl.html","
    "); -$templateCache.put("select2/select-multiple.tpl.html","
    "); -$templateCache.put("select2/select.tpl.html","
    "); -$templateCache.put("selectize/choices.tpl.html","
    "); +$templateCache.put("select2/select-multiple.tpl.html","
    "); +$templateCache.put("select2/select.tpl.html","
    "); +$templateCache.put("selectize/choices.tpl.html","
    "); +$templateCache.put("selectize/footer.tpl.html","
    "); +$templateCache.put("selectize/header.tpl.html","
    "); $templateCache.put("selectize/match-multiple.tpl.html","
    ×
    "); $templateCache.put("selectize/match.tpl.html","
    {{$select.placeholder}}
    "); $templateCache.put("selectize/no-choice.tpl.html","
    "); -$templateCache.put("selectize/select-multiple.tpl.html","
    "); -$templateCache.put("selectize/select.tpl.html","
    ");}]); \ No newline at end of file +$templateCache.put("selectize/select-multiple.tpl.html","
    "); +$templateCache.put("selectize/select.tpl.html","
    ");}]); \ No newline at end of file diff --git a/dist/select.min.js b/dist/select.min.js index 61be14d25..b2bab4754 100644 --- a/dist/select.min.js +++ b/dist/select.min.js @@ -1,9 +1,9 @@ /*! * ui-select * http://github.com/angular-ui/ui-select - * Version: 0.19.7 - 2017-04-15T14:28:36.649Z + * Version: 0.19.8 - 2018-04-23T19:03:31.128Z * License: MIT */ -!function(){"use strict";function e(e){return angular.isUndefined(e)||null===e}var t={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(e){var s=e.which;switch(s){case t.COMMAND:case t.SHIFT:case t.CTRL:case t.ALT:return!0}return!!(e.metaKey||e.ctrlKey||e.altKey)},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&e<=123},isVerticalMovement:function(e){return~[t.UP,t.DOWN].indexOf(e)},isHorizontalMovement:function(e){return~[t.LEFT,t.RIGHT,t.BACKSPACE,t.DELETE].indexOf(e)},toSeparator:function(e){var s={ENTER:"\n",TAB:"\t",SPACE:" "}[e];return s?s:t[e]?void 0:e}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(e){return angular.element(this[0].querySelectorAll(e))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(e){for(var t=this[0],s=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(s.bind(t)(e))return t;t=t.parentElement}return!1});var s=0,i=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return s++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon glyphicon-refresh ui-select-spin",backspaceReset:!0}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),s=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(s)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,s,i,c){c(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return(""+e).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,s){return s&&t?(""+t).replace(new RegExp(e(s),"gi"),'$&'):t}}).factory("uisOffset",["$document","$window",function(e,t){return function(s){var i=s[0].getBoundingClientRect();return{width:i.width||s.prop("offsetWidth"),height:i.height||s.prop("offsetHeight"),top:i.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:i.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}]);i.factory("$$uisDebounce",["$timeout",function(e){return function(t,s){var i;return function(){var c=this,n=Array.prototype.slice.call(arguments);i&&e.cancel(i),i=e(function(){t.apply(c,n)},s)}}}]),i.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(e,t,s,i,c){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-choices");var s=t.parent().attr("theme")||e.theme;return s+"/choices.tpl.html"},compile:function(i,n){if(!n.repeat)throw s("repeat","Expected 'repeat' expression.");var l=n.groupBy,a=n.groupFilter;if(l){var r=i.querySelectorAll(".ui-select-choices-group");if(1!==r.length)throw s("rows","Expected 1 .ui-select-choices-group but got '{0}'.",r.length);r.attr("ng-repeat",t.getGroupNgRepeatExpression())}var o=t.parse(n.repeat),u=i.querySelectorAll(".ui-select-choices-row");if(1!==u.length)throw s("rows","Expected 1 .ui-select-choices-row but got '{0}'.",u.length);u.attr("ng-repeat",o.repeatExpression(l)).attr("ng-if","$select.open");var d=i.querySelectorAll(".ui-select-choices-row-inner");if(1!==d.length)throw s("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",d.length);d.attr("uis-transclude-append","");var p=c.document.addEventListener?u:d;return p.attr("ng-click","$select.select("+o.itemName+",$select.skipFocusser,$event)"),function(t,s,c,n){n.parseRepeatAttr(c.repeat,l,a),n.disableChoiceExpression=c.uiDisableChoice,n.onHighlightCallback=c.onHighlight,n.minimumInputLength=parseInt(c.minimumInputLength)||0,n.dropdownPosition=c.position?c.position.toLowerCase():e.dropdownPosition,t.$watch("$select.search",function(e){e&&!n.open&&n.multiple&&n.activate(!1,!0),n.activeIndex=n.tagging.isActivated?-1:0,!c.minimumInputLength||n.search.length>=c.minimumInputLength?n.refresh(c.refresh):n.items=[]}),c.$observe("refreshDelay",function(){var s=t.$eval(c.refreshDelay);n.refreshDelay=void 0!==s?s:e.refreshDelay}),t.$watch("$select.open",function(e){e?(i.attr("role","listbox"),n.refresh(c.refresh)):s.removeAttr("role")})}}}}]),i.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(s,i,c,n,l,a,r,o,u,d,p){function h(e,t,s){if(e.findIndex)return e.findIndex(t,s);for(var i,c=Object(e),n=c.length>>>0,l=0;l-1&&I.splice(s,1)}function m(e){return I.indexOf(e)>-1}function $(e){function t(e,t){var s=i.indexOf(e);t&&s===-1&&i.push(e),!t&&s>-1&&i.splice(s,1)}function s(e){return i.indexOf(e)>-1}if(e){var i=[];y.isLocked=function(e,i){var c=!1,n=y.selected[i];return n&&(e?(c=!!e.$eval(y.lockChoiceExpression),t(n,c)):c=s(n)),c}}}function b(e){var s=!0;switch(e){case t.DOWN:if(!y.open&&y.multiple)y.activate(!1,!0);else if(y.activeIndexc)for(var n=--y.activeIndex;m(y.items[n])&&n>c;)y.activeIndex=--n;break;case t.TAB:y.multiple&&!y.open||y.select(y.items[y.activeIndex],!0);break;case t.ENTER:y.open&&(y.tagging.isActivated||y.activeIndex>=0)?y.select(y.items[y.activeIndex],y.skipFocusser):y.activate(!1,!0);break;case t.ESC:y.close();break;default:s=!1}return s}function w(){var e=i.querySelectorAll(".ui-select-choices-content"),t=e.querySelectorAll(".ui-select-choices-row");if(t.length<1)throw r("choices","Expected multiple .ui-select-choices-row but got '{0}'.",t.length);if(!(y.activeIndex<0)){var s=t[y.activeIndex],c=s.offsetTop+s.clientHeight-e[0].scrollTop,n=e[0].offsetHeight;c>n?e[0].scrollTop+=c-n:c=y.items.length?0:y.activeIndex,y.activeIndex===-1&&y.taggingLabel!==!1&&(y.activeIndex=0);var n=i.querySelectorAll(".ui-select-choices-content"),l=i.querySelectorAll(".ui-select-search");if(y.$animate&&y.$animate.on&&y.$animate.enabled(n[0])){var a=function(t,s){"start"===s&&0===y.items.length?(y.$animate.off("removeClass",l[0],a),c(function(){y.focusSearchInput(e)})):"close"===s&&(y.$animate.off("enter",n[0],a),c(function(){y.focusSearchInput(e)}))};y.items.length>0?y.$animate.on("enter",n[0],a):y.$animate.on("removeClass",l[0],a)}else c(function(){y.focusSearchInput(e),!y.tagging.isActivated&&y.items.length>1&&w()})}},y.focusSearchInput=function(e){y.search=e||y.search,y.searchInput[0].focus()},y.findGroupByName=function(e){return y.groups&&y.groups.filter(function(t){return t.name===e})[0]},y.parseRepeatAttr=function(e,t,i){function c(e){var c=s.$eval(t);if(y.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(c)?c(e):e[c],s=y.findGroupByName(t);s?s.items.push(e):y.groups.push({name:t,items:[e]})}),i){var n=s.$eval(i);angular.isFunction(n)?y.groups=n(y.groups):angular.isArray(n)&&(y.groups=f(y.groups,n))}y.items=[],y.groups.forEach(function(e){y.items=y.items.concat(e.items)})}function n(e){y.items=e||[]}y.setItemsFn=t?c:n,y.parserResult=a.parse(e),y.isGrouped=!!t,y.itemProperty=y.parserResult.itemName;var l=y.parserResult.source,o=function(){var e=l(s);s.$uisSource=Object.keys(e).map(function(t){var s={};return s[y.parserResult.keyName]=t,s.value=e[t],s})};y.parserResult.keyName&&(o(),y.parserResult.source=u("$uisSource"+y.parserResult.filters),s.$watch(l,function(e,t){e!==t&&o()},!0)),y.refreshItems=function(e){e=e||y.parserResult.source(s);var t=y.selected;if(y.isEmpty()||angular.isArray(t)&&!t.length||!y.multiple||!y.removeSelected)y.setItemsFn(e);else if(void 0!==e&&null!==e){var i=e.filter(function(e){return angular.isArray(t)?t.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,t)});y.setItemsFn(i)}"auto"!==y.dropdownPosition&&"up"!==y.dropdownPosition||s.calculateDropdownPos(),s.$broadcast("uis:refresh")},s.$watchCollection(y.parserResult.source,function(e){if(void 0===e||null===e)y.items=[];else{if(!angular.isArray(e))throw r("items","Expected an array but got '{0}'.",e);y.refreshItems(e),angular.isDefined(y.ngModel.$modelValue)&&(y.ngModel.$modelValue=null)}})};var E;y.refresh=function(e){void 0!==e&&(E&&c.cancel(E),E=c(function(){if(s.$select.search.length>=s.$select.minimumInputLength){var t=s.$eval(e);t&&angular.isFunction(t.then)&&!y.refreshing&&(y.refreshing=!0,t["finally"](function(){y.refreshing=!1}))}},y.refreshDelay))},y.isActive=function(e){if(!y.open)return!1;var t=y.items.indexOf(e[y.itemProperty]),s=t==y.activeIndex;return!(!s||t<0)&&(s&&!angular.isUndefined(y.onHighlightCallback)&&e.$eval(y.onHighlightCallback),s)};var S=function(e){return y.selected&&angular.isArray(y.selected)&&y.selected.filter(function(t){return angular.equals(t,e)}).length>0},I=[];y.isDisabled=function(e){if(y.open){var t=e[y.itemProperty],s=y.items.indexOf(t),i=!1;if(s>=0&&(angular.isDefined(y.disableChoiceExpression)||y.multiple)){if(t.isTag)return!1;y.multiple&&(i=S(t)),!i&&angular.isDefined(y.disableChoiceExpression)&&(i=!!e.$eval(y.disableChoiceExpression)),v(t,i)}return i}},y.select=function(t,i,c){if(e(t)||!m(t)){if(!y.items&&!y.search&&!y.tagging.isActivated)return;if(!t||!m(t)){if(y.clickTriggeredSelect=!1,c&&("click"===c.type||"touchend"===c.type)&&t&&(y.clickTriggeredSelect=!0),y.tagging.isActivated&&y.clickTriggeredSelect===!1){if(y.taggingLabel===!1)if(y.activeIndex<0){if(void 0===t&&(t=void 0!==y.tagging.fct?y.tagging.fct(y.search):y.search),!t||angular.equals(y.items[0],t))return}else t=y.items[y.activeIndex];else if(0===y.activeIndex){if(void 0===t)return;if(void 0!==y.tagging.fct&&"string"==typeof t){if(t=y.tagging.fct(t),!t)return}else"string"==typeof t&&(t=t.replace(y.taggingLabel,"").trim())}if(S(t))return void y.close(i)}g(),s.$broadcast("uis:select",t),y.closeOnSelect&&y.close(i)}}},y.close=function(e){y.open&&(y.ngModel&&y.ngModel.$setTouched&&y.ngModel.$setTouched(),y.open=!1,g(),s.$broadcast("uis:close",e))},y.setFocus=function(){y.focus||y.focusInput[0].focus()},y.clear=function(e){y.select(null),e.stopPropagation(),c(function(){y.focusser[0].focus()},0,!1)},y.toggle=function(e){y.open?(y.close(),e.preventDefault(),e.stopPropagation()):y.activate()},y.isLocked=function(){return!1},s.$watch(function(){return angular.isDefined(y.lockChoiceExpression)&&""!==y.lockChoiceExpression},$);var C=null,k=!1;y.sizeSearchInput=function(){var e=y.searchInput[0],t=y.$element[0],i=function(){return t.clientWidth*!!e.offsetParent},n=function(t){if(0===t)return!1;var s=t-e.offsetLeft;return s<50&&(s=t),y.searchInput.css("width",s+"px"),!0};y.searchInput.css("width","10px"),c(function(){null!==C||n(i())||(C=s.$watch(function(){k||(k=!0,s.$$postDigest(function(){k=!1,n(i())&&(C(),C=null)}))},angular.noop))})},y.searchInput.on("keydown",function(e){var i=e.which;~[t.ENTER,t.ESC].indexOf(i)&&(e.preventDefault(),e.stopPropagation()),s.$apply(function(){var s=!1;if((y.items.length>0||y.tagging.isActivated)&&(b(i)||y.searchEnabled||(e.preventDefault(),e.stopPropagation()),y.taggingTokens.isActivated)){for(var n=0;n0&&(s=!0);s&&c(function(){y.searchInput.triggerHandler("tagged");var s=y.search.replace(t.MAP[e.keyCode],"").trim();y.tagging.fct&&(s=y.tagging.fct(s)),s&&y.select(s,!0)})}}),t.isVerticalMovement(i)&&y.items.length>0&&w(),i!==t.ENTER&&i!==t.ESC||(e.preventDefault(),e.stopPropagation())}),y.searchInput.on("paste",function(e){var s;if(s=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(e.originalEvent||e).clipboardData.getData("text/plain"),s=y.search+s,s&&s.length>0)if(y.taggingTokens.isActivated){for(var i=[],c=0;c-1){i=s.split(n);break}}0===i.length&&(i=[s]);var l=y.search;angular.forEach(i,function(e){var t=y.tagging.fct?y.tagging.fct(e):e;t&&y.select(t,!0)}),y.search=l||x,e.preventDefault(),e.stopPropagation()}else y.paste&&(y.paste(s),y.search=x,e.preventDefault(),e.stopPropagation())}),y.searchInput.on("tagged",function(){c(function(){g()})});var A=l(function(){y.sizeSearchInput()},50);angular.element(p).bind("resize",A),s.$on("$destroy",function(){y.searchInput.off("keyup keydown tagged blur paste"),angular.element(p).off("resize",A)}),s.$watch("$select.activeIndex",function(e){e&&i.find("input").attr("aria-activedescendant","ui-select-choices-row-"+y.generatedId+"-"+e)}),s.$watch("$select.open",function(e){e||i.find("input").removeAttr("aria-activedescendant")})}]),i.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(e,t,s,i,c,n,l){return{restrict:"EA",templateUrl:function(e,s){var i=s.theme||t.theme;return i+(angular.isDefined(s.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(c,a){var r=/{(.*)}\s*{(.*)}/.exec(a.ngClass);if(r){var o="{"+r[1]+", "+r[2]+"}";a.ngClass=o,c.attr("ng-class",o)}return angular.isDefined(a.multiple)?c.append("").removeAttr("multiple"):c.append(""),a.inputId&&(c.querySelectorAll("input.ui-select-search")[0].id=a.inputId),function(c,a,r,o,u){function d(e){if(g.open){var t=!1;if(t=window.jQuery?window.jQuery.contains(a[0],e.target):a[0].contains(e.target),!t&&!g.clickTriggeredSelect){var s;if(g.skipFocusser)s=!0;else{var i=["input","button","textarea","select"],n=angular.element(e.target).controller("uiSelect");s=n&&n!==g,s||(s=~i.indexOf(e.target.tagName.toLowerCase()))}g.close(s),c.$digest()}g.clickTriggeredSelect=!1}}function p(){var t=i(a);m=angular.element('
    '),m[0].style.width=t.width+"px",m[0].style.height=t.height+"px",a.after(m),$=a[0].style.width,e.find("body").append(a),a[0].style.position="absolute",a[0].style.left=t.left+"px",a[0].style.top=t.top+"px",a[0].style.width=t.width+"px"}function h(){null!==m&&(m.replaceWith(a),m=null,a[0].style.position="",a[0].style.left="",a[0].style.top="",a[0].style.width=$,g.setFocus())}var g=o[0],f=o[1];g.generatedId=t.generateId(),g.baseTitle=r.title||"Select box",g.focusserTitle=g.baseTitle+" focus",g.focusserId="focusser-"+g.generatedId,g.closeOnSelect=function(){return angular.isDefined(r.closeOnSelect)?n(r.closeOnSelect)():t.closeOnSelect}(),c.$watch("skipFocusser",function(){var e=c.$eval(r.skipFocusser);g.skipFocusser=void 0!==e?e:t.skipFocusser}),g.onSelectCallback=n(r.onSelect),g.onRemoveCallback=n(r.onRemove),g.ngModel=f,g.choiceGrouped=function(e){return g.isGrouped&&e&&e.name},r.tabindex&&r.$observe("tabindex",function(e){g.focusInput.attr("tabindex",e),a.removeAttr("tabindex")}),c.$watch(function(){return c.$eval(r.searchEnabled)},function(e){g.searchEnabled=void 0!==e?e:t.searchEnabled}),c.$watch("sortable",function(){var e=c.$eval(r.sortable);g.sortable=void 0!==e?e:t.sortable}),r.$observe("backspaceReset",function(){var e=c.$eval(r.backspaceReset);g.backspaceReset=void 0===e||e}),r.$observe("limit",function(){g.limit=angular.isDefined(r.limit)?parseInt(r.limit,10):void 0}),c.$watch("removeSelected",function(){var e=c.$eval(r.removeSelected);g.removeSelected=void 0!==e?e:t.removeSelected}),r.$observe("disabled",function(){g.disabled=void 0!==r.disabled&&r.disabled}),r.$observe("resetSearchInput",function(){var e=c.$eval(r.resetSearchInput);g.resetSearchInput=void 0===e||e}),r.$observe("paste",function(){g.paste=c.$eval(r.paste)}),r.$observe("tagging",function(){if(void 0!==r.tagging){var e=c.$eval(r.tagging);g.tagging={isActivated:!0,fct:e!==!0?e:void 0}}else g.tagging={isActivated:!1,fct:void 0}}),r.$observe("taggingLabel",function(){void 0!==r.tagging&&("false"===r.taggingLabel?g.taggingLabel=!1:g.taggingLabel=void 0!==r.taggingLabel?r.taggingLabel:"(new)")}),r.$observe("taggingTokens",function(){if(void 0!==r.tagging){var e=void 0!==r.taggingTokens?r.taggingTokens.split("|"):[",","ENTER"];g.taggingTokens={isActivated:!0,tokens:e}}}),r.$observe("spinnerEnabled",function(){var e=c.$eval(r.spinnerEnabled);g.spinnerEnabled=void 0!==e?e:t.spinnerEnabled}),r.$observe("spinnerClass",function(){var e=r.spinnerClass;g.spinnerClass=void 0!==e?r.spinnerClass:t.spinnerClass}),angular.isDefined(r.autofocus)&&l(function(){g.setFocus()}),angular.isDefined(r.focusOn)&&c.$on(r.focusOn,function(){l(function(){g.setFocus()})}),e.on("click",d),c.$on("$destroy",function(){e.off("click",d)}),u(c,function(e){var t=angular.element("
    ").append(e),i=t.querySelectorAll(".ui-select-match");if(i.removeAttr("ui-select-match"),i.removeAttr("data-ui-select-match"),1!==i.length)throw s("transcluded","Expected 1 .ui-select-match but got '{0}'.",i.length);a.querySelectorAll(".ui-select-match").replaceWith(i);var c=t.querySelectorAll(".ui-select-choices");if(c.removeAttr("ui-select-choices"),c.removeAttr("data-ui-select-choices"),1!==c.length)throw s("transcluded","Expected 1 .ui-select-choices but got '{0}'.",c.length);a.querySelectorAll(".ui-select-choices").replaceWith(c);var n=t.querySelectorAll(".ui-select-no-choice");n.removeAttr("ui-select-no-choice"),n.removeAttr("data-ui-select-no-choice"),1==n.length&&a.querySelectorAll(".ui-select-no-choice").replaceWith(n)});var v=c.$eval(r.appendToBody);(void 0!==v?v:t.appendToBody)&&(c.$watch("$select.open",function(e){e?p():h()}),c.$on("$destroy",function(){h()}));var m=null,$="",b=null,w="direction-up";c.$watch("$select.open",function(){"auto"!==g.dropdownPosition&&"up"!==g.dropdownPosition||c.calculateDropdownPos()});var y=function(e,t){e=e||i(a),t=t||i(b),b[0].style.position="absolute",b[0].style.top=t.height*-1+"px",a.addClass(w)},x=function(e,t){a.removeClass(w),e=e||i(a),t=t||i(b),b[0].style.position="",b[0].style.top=""},E=function(){l(function(){if("up"===g.dropdownPosition)y();else{a.removeClass(w);var t=i(a),s=i(b),c=e[0].documentElement.scrollTop||e[0].body.scrollTop;t.top+t.height+s.height>c+e[0].documentElement.clientHeight?y(t,s):x(t,s)}b[0].style.opacity=1})},S=!1;c.calculateDropdownPos=function(){if(g.open){if(b=angular.element(a).querySelectorAll(".ui-select-dropdown"),0===b.length)return;if(""!==g.search||S||(b[0].style.opacity=0,S=!0),!i(b).height&&g.$animate&&g.$animate.on&&g.$animate.enabled(b)){var e=!0;g.$animate.on("enter",b,function(t,s){"close"===s&&e&&(E(),e=!1)})}else E()}else{if(null===b||0===b.length)return;b[0].style.opacity=0,b[0].style.position="",b[0].style.top="",a.removeClass(w)}}}}}}]),i.directive("uiSelectMatch",["uiSelectConfig",function(e){function t(e,t){return e[0].hasAttribute(t)?e.attr(t):e[0].hasAttribute("data-"+t)?e.attr("data-"+t):e[0].hasAttribute("x-"+t)?e.attr("x-"+t):void 0}return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(s){s.addClass("ui-select-match");var i=s.parent(),c=t(i,"theme")||e.theme,n=angular.isDefined(t(i,"multiple"));return c+(n?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,s,i,c){function n(e){c.allowClear=!!angular.isDefined(e)&&(""===e||"true"===e.toLowerCase())}c.lockChoiceExpression=i.uiLockChoice,i.$observe("placeholder",function(t){c.placeholder=void 0!==t?t:e.placeholder}),i.$observe("allowClear",n),n(i.allowClear),c.multiple&&c.sizeSearchInput()}}}]),i.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(s,i){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(e,t){var s,i=this,c=e.$select;angular.isUndefined(c.selected)&&(c.selected=[]),e.$evalAsync(function(){s=e.ngModel}),i.activeMatchIndex=-1,i.updateModel=function(){s.$setViewValue(Date.now()),i.refreshComponent()},i.refreshComponent=function(){c.refreshItems&&c.refreshItems(),c.sizeSearchInput&&c.sizeSearchInput()},i.removeChoice=function(s){if(c.isLocked(null,s))return!1;var n=c.selected[s],l={};return l[c.parserResult.itemName]=n,c.selected.splice(s,1),i.activeMatchIndex=-1,c.sizeSearchInput(),t(function(){c.onRemoveCallback(e,{$item:n,$model:c.parserResult.modelMapper(e,l)})}),i.updateModel(),!0},i.getPlaceholder=function(){if(!c.selected||!c.selected.length)return c.placeholder}}],controllerAs:"$selectMultiple",link:function(c,n,l,a){function r(e){return angular.isNumber(e.selectionStart)?e.selectionStart:e.value.length}function o(e){function s(){switch(e){case t.LEFT:return~g.activeMatchIndex?u:l;case t.RIGHT:return~g.activeMatchIndex&&a!==l?o:(p.activate(),!1);case t.BACKSPACE:return~g.activeMatchIndex?g.removeChoice(a)?u:a:l;case t.DELETE:return!!~g.activeMatchIndex&&(g.removeChoice(g.activeMatchIndex),a)}}var i=r(p.searchInput[0]),c=p.selected.length,n=0,l=c-1,a=g.activeMatchIndex,o=g.activeMatchIndex+1,u=g.activeMatchIndex-1,d=a;return!(i>0||p.search.length&&e==t.RIGHT)&&(p.close(),d=s(),p.selected.length&&d!==!1?g.activeMatchIndex=Math.min(l,Math.max(n,d)):g.activeMatchIndex=-1,!0)}function u(e){if(void 0===e||void 0===p.search)return!1;var t=e.filter(function(e){return void 0!==p.search.toUpperCase()&&void 0!==e&&e.toUpperCase()===p.search.toUpperCase()}).length>0;return t}function d(e,t){var s=-1;if(angular.isArray(e))for(var i=angular.copy(e),c=0;c=0;i--)t={},t[p.parserResult.itemName]=p.selected[i],e=p.parserResult.modelMapper(c,t),s.unshift(e);return s}),h.$formatters.unshift(function(e){var t,s=p.parserResult&&p.parserResult.source(c,{$select:{search:""}}),i={};if(!s)return e;var n=[],l=function(e,s){if(e&&e.length){for(var l=e.length-1;l>=0;l--){if(i[p.parserResult.itemName]=e[l],t=p.parserResult.modelMapper(c,i),p.parserResult.trackByExp){var a=/(\w*)\./.exec(p.parserResult.trackByExp),r=/\.([^\s]+)/.exec(p.parserResult.trackByExp);if(a&&a.length>0&&a[1]==p.parserResult.itemName&&r&&r.length>0&&t[r[1]]==s[r[1]])return n.unshift(e[l]),!0}if(angular.equals(t,s))return n.unshift(e[l]),!0}return!1}};if(!e)return n;for(var a=e.length-1;a>=0;a--)l(p.selected,e[a])||l(s,e[a])||n.unshift(e[a]);return n}),c.$watchCollection(function(){return h.$modelValue},function(e,t){t!=e&&(angular.isDefined(h.$modelValue)&&(h.$modelValue=null),g.refreshComponent())}),h.$render=function(){if(!angular.isArray(h.$viewValue)){if(!e(h.$viewValue))throw s("multiarr","Expected model value to be array but got '{0}'",h.$viewValue);h.$viewValue=[]}p.selected=h.$viewValue,g.refreshComponent(),c.$evalAsync()},c.$on("uis:select",function(e,t){if(!(p.selected.length>=p.limit)){p.selected.push(t);var s={};s[p.parserResult.itemName]=t,i(function(){p.onSelectCallback(c,{$item:t,$model:p.parserResult.modelMapper(c,s)})}),g.updateModel()}}),c.$on("uis:activate",function(){g.activeMatchIndex=-1}),c.$watch("$select.disabled",function(e,t){t&&!e&&p.sizeSearchInput()}),p.searchInput.on("keydown",function(e){var s=e.which;c.$apply(function(){var i=!1;t.isHorizontalMovement(s)&&(i=o(s)),i&&s!=t.TAB&&(e.preventDefault(),e.stopPropagation())})}),p.searchInput.on("keyup",function(e){if(t.isVerticalMovement(e.which)||c.$evalAsync(function(){p.activeIndex=p.taggingLabel===!1?-1:0}),p.tagging.isActivated&&p.search.length>0){if(e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||t.isVerticalMovement(e.which))return;if(p.activeIndex=p.taggingLabel===!1?-1:0,p.taggingLabel===!1)return;var s,i,n,l,a=angular.copy(p.items),r=angular.copy(p.items),o=!1,h=-1;if(void 0!==p.tagging.fct){if(n=p.$filter("filter")(a,{isTag:!0}),n.length>0&&(l=n[0]),a.length>0&&l&&(o=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),s=p.tagging.fct(p.search),r.some(function(e){return angular.equals(e,s)})||p.selected.some(function(e){return angular.equals(e,s)}))return void c.$evalAsync(function(){p.activeIndex=0,p.items=a});s&&(s.isTag=!0)}else{if(n=p.$filter("filter")(a,function(e){return e.match(p.taggingLabel)}),n.length>0&&(l=n[0]),i=a[0],void 0!==i&&a.length>0&&l&&(o=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),s=p.search+" "+p.taggingLabel,d(p.selected,p.search)>-1)return;if(u(r.concat(p.selected)))return void(o&&(a=r,c.$evalAsync(function(){p.activeIndex=0,p.items=a})));if(u(r))return void(o&&(p.items=r.slice(1,r.length)))}o&&(h=d(p.selected,s)),h>-1?a=a.slice(h+1,a.length-1):(a=[],s&&a.push(s),a=a.concat(r)),c.$evalAsync(function(){if(p.activeIndex=0,p.items=a,p.isGrouped){var e=s?a.slice(1):a;p.setItemsFn(e),s&&(p.items.unshift(s),p.groups.unshift({name:"",items:[s],tagging:!0}))}})}}),p.searchInput.on("blur",function(){i(function(){g.activeMatchIndex=-1})})}}}]),i.directive("uiSelectNoChoice",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-no-choice");var s=t.parent().attr("theme")||e.theme;return s+"/no-choice.tpl.html"}}}]),i.directive("uiSelectSingle",["$timeout","$compile",function(s,i){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(c,n,l,a){var r=a[0],o=a[1];o.$parsers.unshift(function(t){if(e(t))return t;var s,i={};return i[r.parserResult.itemName]=t,s=r.parserResult.modelMapper(c,i)}),o.$formatters.unshift(function(t){if(e(t))return t;var s,i=r.parserResult&&r.parserResult.source(c,{$select:{search:""}}),n={};if(i){var l=function(e){return n[r.parserResult.itemName]=e,s=r.parserResult.modelMapper(c,n),s===t};if(r.selected&&l(r.selected))return r.selected;for(var a=i.length-1;a>=0;a--)if(l(i[a]))return i[a]}return t}),c.$watch("$select.selected",function(e){o.$viewValue!==e&&o.$setViewValue(e)}),o.$render=function(){r.selected=o.$viewValue},c.$on("uis:select",function(t,i){r.selected=i;var n={};n[r.parserResult.itemName]=i,s(function(){r.onSelectCallback(c,{$item:i,$model:e(i)?i:r.parserResult.modelMapper(c,n)})})}),c.$on("uis:close",function(e,t){s(function(){r.focusser.prop("disabled",!1),t||r.focusser[0].focus()},0,!1)}),c.$on("uis:activate",function(){u.prop("disabled",!0)});var u=angular.element("");i(u)(c),r.focusser=u,r.focusInput=u,n.parent().append(u),u.bind("focus",function(){c.$evalAsync(function(){r.focus=!0})}),u.bind("blur",function(){c.$evalAsync(function(){r.focus=!1})}),u.bind("keydown",function(e){return e.which===t.BACKSPACE&&r.backspaceReset!==!1?(e.preventDefault(),e.stopPropagation(),r.select(void 0),void c.$apply()):void(e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||(e.which!=t.DOWN&&e.which!=t.UP&&e.which!=t.ENTER&&e.which!=t.SPACE||(e.preventDefault(),e.stopPropagation(),r.activate()),c.$digest()))}),u.bind("keyup input",function(e){e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||e.which==t.ENTER||e.which===t.BACKSPACE||(r.activate(u.val()),u.val(""),c.$digest())})}}}]),i.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,s){return{require:["^^uiSelect","^ngModel"],link:function(t,i,c,n){if(null===t[c.uiSelectSort])throw s("sort","Expected a list to sort");var l=n[0],a=n[1],r=angular.extend({axis:"horizontal"},t.$eval(c.uiSelectSortOptions)),o=r.axis,u="dragging",d="dropping",p="dropping-before",h="dropping-after";t.$watch(function(){return l.sortable},function(e){e?i.attr("draggable",!0):i.removeAttr("draggable")}),i.on("dragstart",function(e){i.addClass(u),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text",t.$index.toString())}),i.on("dragend",function(){v(u)});var g,f=function(e,t){this.splice(t,0,this.splice(e,1)[0])},v=function(e){angular.forEach(l.$element.querySelectorAll("."+e),function(t){angular.element(t).removeClass(e)})},m=function(e){e.preventDefault();var t="vertical"===o?e.offsetY||e.layerY||(e.originalEvent?e.originalEvent.offsetY:0):e.offsetX||e.layerX||(e.originalEvent?e.originalEvent.offsetX:0);t
  • '),e.put("bootstrap/match-multiple.tpl.html",' × '),e.put("bootstrap/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("bootstrap/no-choice.tpl.html",''),e.put("bootstrap/select-multiple.tpl.html",''),e.put("bootstrap/select.tpl.html",''),e.put("select2/choices.tpl.html",'
    '),e.put("select2/match-multiple.tpl.html",'
  • '),e.put("select2/match.tpl.html",'{{$select.placeholder}} '),e.put("select2/no-choice.tpl.html",''),e.put("select2/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/match-multiple.tpl.html",'
    ×
    '),e.put("selectize/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("selectize/no-choice.tpl.html",'
    '),e.put("selectize/select-multiple.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]); +!function(){"use strict";function e(e){return angular.isUndefined(e)||null===e}var t={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(e){var s=e.which;switch(s){case t.COMMAND:case t.SHIFT:case t.CTRL:case t.ALT:return!0}return!!(e.metaKey||e.ctrlKey||e.altKey)},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&e<=123},isVerticalMovement:function(e){return~[t.UP,t.DOWN].indexOf(e)},isHorizontalMovement:function(e){return~[t.LEFT,t.RIGHT,t.BACKSPACE,t.DELETE].indexOf(e)},toSeparator:function(e){var s={ENTER:"\n",TAB:"\t",SPACE:" "}[e];return s?s:t[e]?void 0:e}};void 0===angular.element.prototype.querySelectorAll&&(angular.element.prototype.querySelectorAll=function(e){return angular.element(this[0].querySelectorAll(e))}),void 0===angular.element.prototype.closest&&(angular.element.prototype.closest=function(e){for(var t=this[0],s=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(s.bind(t)(e))return t;t=t.parentElement}return!1});var s=0,i=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,skipFocusser:!1,dropdownPosition:"auto",removeSelected:!0,resetSearchInput:!0,generateId:function(){return s++},appendToBody:!1,spinnerEnabled:!1,spinnerClass:"glyphicon glyphicon-refresh ui-select-spin",backspaceReset:!0}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),s=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(s)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,s,i,l){l(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return(""+e).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,s){return s&&t?(""+t).replace(new RegExp(e(s),"gi"),'$&'):t}}).factory("uisOffset",["$document","$window",function(e,t){return function(s){var i=s[0].getBoundingClientRect();return{width:i.width||s.prop("offsetWidth"),height:i.height||s.prop("offsetHeight"),top:i.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:i.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}]);i.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(e,t,s,i,l){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-choices");var s=t.parent().attr("theme")||e.theme;return s+"/choices.tpl.html"},compile:function(i,c){if(!c.repeat)throw s("repeat","Expected 'repeat' expression.");var n=c.groupBy,a=c.groupFilter;if(n){var r=i.querySelectorAll(".ui-select-choices-group");if(1!==r.length)throw s("rows","Expected 1 .ui-select-choices-group but got '{0}'.",r.length);r.attr("ng-repeat",t.getGroupNgRepeatExpression())}var o=t.parse(c.repeat),u=i.querySelectorAll(".ui-select-choices-row");if(1!==u.length)throw s("rows","Expected 1 .ui-select-choices-row but got '{0}'.",u.length);u.attr("ng-repeat",o.repeatExpression(n)).attr("ng-if","$select.open");var d=i.querySelectorAll(".ui-select-choices-row-inner");if(1!==d.length)throw s("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",d.length);d.attr("uis-transclude-append","");var p=l.document.addEventListener?u:d;return p.attr("ng-click","$select.select("+o.itemName+",$select.skipFocusser,$event)"),function(t,s,l,c){c.parseRepeatAttr(l.repeat,n,a),c.disableChoiceExpression=l.uiDisableChoice,c.onHighlightCallback=l.onHighlight,c.minimumInputLength=parseInt(l.minimumInputLength)||0,c.dropdownPosition=l.position?l.position.toLowerCase():e.dropdownPosition,t.$watch("$select.search",function(e){e&&!c.open&&c.multiple&&c.activate(!1,!0),c.activeIndex=c.tagging.isActivated?-1:0,!l.minimumInputLength||c.search.length>=l.minimumInputLength?c.refresh(l.refresh):c.items=[]}),l.$observe("refreshDelay",function(){var s=t.$eval(l.refreshDelay);c.refreshDelay=void 0!==s?s:e.refreshDelay}),t.$watch("$select.open",function(e){e?(i.attr("role","listbox"),c.refresh(l.refresh)):s.removeAttr("role")})}}}}]),i.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(s,i,l,c,n,a,r,o,u,d,p){function h(e,t,s){if(e.findIndex)return e.findIndex(t,s);for(var i,l=Object(e),c=l.length>>>0,n=0;n-1&&C.splice(s,1)}function m(e){return C.indexOf(e)>-1}function $(e){function t(e,t){var s=i.indexOf(e);t&&s===-1&&i.push(e),!t&&s>-1&&i.splice(s,1)}function s(e){return i.indexOf(e)>-1}if(e){var i=[];E.isLocked=function(e,i){var l=!1,c=E.selected[i];return c&&(e?(l=!!e.$eval(E.lockChoiceExpression),t(c,l)):l=s(c)),l}}}function b(e){var s=!0;switch(e){case t.DOWN:if(!E.open&&E.multiple)E.activate(!1,!0);else if(E.activeIndex0)for(var l=--E.activeIndex;m(E.items[l])&&l>0;)E.activeIndex=--l;break;case t.TAB:E.multiple&&!E.open||E.select(E.items[E.activeIndex],!0);break;case t.ENTER:E.open&&(E.tagging.isActivated||E.activeIndex>=0)?E.select(E.items[E.activeIndex],E.skipFocusser):E.activate(!1,!0);break;case t.ESC:E.close();break;default:s=!1}return s}function w(){var e=i.querySelectorAll(".ui-select-choices-content"),t=e.querySelectorAll(".ui-select-choices-row");if(t.length<1)throw r("choices","Expected multiple .ui-select-choices-row but got '{0}'.",t.length);if(!(E.activeIndex<0)){var s=t[E.activeIndex],l=s.offsetTop+s.clientHeight-e[0].scrollTop,c=e[0].offsetHeight;l>c?e[0].scrollTop+=l-c:l=E.items.length?0:E.activeIndex,E.activeIndex===-1&&E.taggingLabel!==!1&&(E.activeIndex=0);var c=i.querySelectorAll(".ui-select-choices-content"),n=i.querySelectorAll(".ui-select-search");if(E.$animate&&E.$animate.on&&E.$animate.enabled(c[0])){var a=function(t,s){"start"===s&&0===E.items.length?(E.$animate.off("removeClass",n[0],a),l(function(){E.focusSearchInput(e)})):"close"===s&&(E.$animate.off("enter",c[0],a),l(function(){E.focusSearchInput(e)}))};E.items.length>0?E.$animate.on("enter",c[0],a):E.$animate.on("removeClass",n[0],a)}else l(function(){E.focusSearchInput(e),!E.tagging.isActivated&&E.items.length>1&&E.open&&w()})}},E.focusSearchInput=function(e){E.search=e||E.search,E.searchInput[0].focus()},E.findGroupByName=function(e,t){return E.groups&&E.groups.filter(function(s){return t?s.name==e:s.name===e})[0]},E.parseRepeatAttr=function(e,t,i){function l(e){var l=s.$eval(t);if(E.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(l)?l(e):e[l],s=E.findGroupByName(t);s?s.items.push(e):E.groups.push({name:t,items:[e]})}),i){var c=s.$eval(i);angular.isFunction(c)?E.groups=c(E.groups):angular.isArray(c)&&(E.groups=f(E.groups,c))}E.items=[],E.groups.forEach(function(e){E.items=E.items.concat(e.items)})}function c(e){E.items=e||[]}E.setItemsFn=t?l:c,E.parserResult=a.parse(e),E.isGrouped=!!t,E.itemProperty=E.parserResult.itemName;var n=E.parserResult.source,o=function(){var e=n(s);s.$uisSource=Object.keys(e).map(function(t){var s={};return s[E.parserResult.keyName]=t,s.value=e[t],s})};E.parserResult.keyName&&(o(),E.parserResult.source=u("$uisSource"+E.parserResult.filters),s.$watch(n,function(e,t){e!==t&&o()},!0)),E.refreshItems=function(e){e=e||E.parserResult.source(s);var t=E.selected;if(E.isEmpty()||angular.isArray(t)&&!t.length||!E.multiple||!E.removeSelected)E.setItemsFn(e);else if(void 0!==e&&null!==e){var i=e.filter(function(e){return angular.isArray(t)?t.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,t)});E.setItemsFn(i)}"auto"!==E.dropdownPosition&&"up"!==E.dropdownPosition||s.calculateDropdownPos(),s.$broadcast("uis:refresh")},s.$watchCollection(E.parserResult.source,function(e){if(void 0===e||null===e)E.items=[];else{if(!angular.isArray(e))throw r("items","Expected an array but got '{0}'.",e);E.refreshItems(e),angular.isDefined(E.ngModel.$modelValue)&&(E.ngModel.$modelValue=null)}})};var x;E.refresh=function(e){void 0!==e&&(x&&l.cancel(x),x=l(function(){if(s.$select.search.length>=s.$select.minimumInputLength){var t=s.$eval(e);t&&angular.isFunction(t.then)&&!E.refreshing&&(E.refreshing=!0,t["finally"](function(){E.refreshing=!1}))}},E.refreshDelay))},E.isActive=function(e){if(!E.open)return!1;var t=E.items.indexOf(e[E.itemProperty]),s=t==E.activeIndex;return!(!s||t<0)&&(s&&!angular.isUndefined(E.onHighlightCallback)&&e.$eval(E.onHighlightCallback),s)};var S=function(e){return E.selected&&angular.isArray(E.selected)&&E.selected.filter(function(t){return angular.equals(t,e)}).length>0},C=[];E.isDisabled=function(e){if(E.open){var t=e[E.itemProperty],s=E.items.indexOf(t),i=!1;if(s>=0&&(angular.isDefined(E.disableChoiceExpression)||E.multiple)){if(t.isTag)return!1;E.multiple&&(i=S(t)),!i&&angular.isDefined(E.disableChoiceExpression)&&(i=!!e.$eval(E.disableChoiceExpression)),v(t,i)}return i}},E.select=function(t,i,l){if(e(t)||!m(t)){if(!E.items&&!E.search&&!E.tagging.isActivated)return;if(!t||!m(t)){if(E.clickTriggeredSelect=!1,l&&("click"===l.type||"touchend"===l.type)&&t&&(E.clickTriggeredSelect=!0),E.tagging.isActivated&&E.clickTriggeredSelect===!1){if(E.taggingLabel===!1)if(E.activeIndex<0){if(void 0===t&&(t=void 0!==E.tagging.fct?E.tagging.fct(E.search):E.search),!t||angular.equals(E.items[0],t))return}else t=E.items[E.activeIndex];else if(0===E.activeIndex){if(void 0===t)return;if(void 0!==E.tagging.fct&&"string"==typeof t){if(t=E.tagging.fct(t),!t)return}else"string"==typeof t&&(t=t.replace(E.taggingLabel,"").trim())}if(S(t))return void E.close(i)}g(),s.$broadcast("uis:select",t),E.closeOnSelect&&E.close(i)}}},E.close=function(e){E.open&&(E.ngModel&&E.ngModel.$setTouched&&E.ngModel.$setTouched(),E.open=!1,g(),s.$broadcast("uis:close",e))},E.setFocus=function(){E.focus||E.focusInput[0].focus()},E.clear=function(e){E.select(null),e.stopPropagation(),l(function(){E.focusser[0].focus()},0,!1)},E.toggle=function(e){E.open?E.close():E.activate(),e.preventDefault(),e.stopPropagation()},E.isLocked=function(){return!1},s.$watch(function(){return angular.isDefined(E.lockChoiceExpression)&&""!==E.lockChoiceExpression},$);var I=null,A=!1;E.sizeSearchInput=function(){var e=E.searchInput[0],t=E.$element[0],i=function(){return t.clientWidth*!!e.offsetParent},c=function(t){if(0===t)return!1;var s=t-e.offsetLeft;return s<50&&(s=t),E.searchInput.css("width",s+"px"),!0};E.searchInput.css("width","10px"),l(function(){null!==I||c(i())||(I=s.$watch(function(){A||(A=!0,s.$$postDigest(function(){A=!1,c(i())&&(I(),I=null)}))},angular.noop))})},E.searchInput.on("keydown",function(e){var i=e.which;~[t.ENTER,t.ESC].indexOf(i)&&(e.preventDefault(),e.stopPropagation()),s.$apply(function(){var s=!1;if((E.items.length>0||E.tagging.isActivated)&&(b(i)||E.searchEnabled||(e.preventDefault(),e.stopPropagation()),E.taggingTokens.isActivated)){for(var c=0;c0&&(s=!0);s&&l(function(){E.searchInput.triggerHandler("tagged");var s=E.search.replace(t.MAP[e.keyCode],"").trim();E.tagging.fct&&(s=E.tagging.fct(s)),s&&E.select(s,!0)})}}),t.isVerticalMovement(i)&&E.items.length>0&&w(),i!==t.ENTER&&i!==t.ESC||(e.preventDefault(),e.stopPropagation())}),E.searchInput.on("paste",function(e){var s;if(s=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(e.originalEvent||e).clipboardData.getData("text/plain"),s=E.search+s,s&&s.length>0)if(E.taggingTokens.isActivated){for(var i=[],l=0;l-1){i=s.split(c);break}}0===i.length&&(i=[s]);var n=E.search;angular.forEach(i,function(e){var t=E.tagging.fct?E.tagging.fct(e):e;t&&E.select(t,!0)}),E.search=n||y,e.preventDefault(),e.stopPropagation()}else E.paste&&(E.paste(s),E.search=y,e.preventDefault(),e.stopPropagation())}),E.searchInput.on("tagged",function(){l(function(){g()})});var k=n(function(){E.sizeSearchInput()},50);angular.element(p).bind("resize",k),s.$on("$destroy",function(){E.searchInput.off("keyup keydown tagged blur paste"),angular.element(p).off("resize",k)}),s.$watch("$select.activeIndex",function(e){e&&i.find("input").attr("aria-activedescendant","ui-select-choices-row-"+E.generatedId+"-"+e)}),s.$watch("$select.open",function(e){e||i.find("input").removeAttr("aria-activedescendant")})}]),i.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout","$window",function(e,t,s,i,l,c,n,a){return{restrict:"EA",templateUrl:function(e,s){var i=s.theme||t.theme;return i+(angular.isDefined(s.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(l,r){var o=/{(.*)}\s*{(.*)}/.exec(r.ngClass);if(o){var u="{"+o[1]+", "+o[2]+"}";r.ngClass=u,l.attr("ng-class",u)}return angular.isDefined(r.multiple)?l.append("").removeAttr("multiple"):l.append(""),r.inputId&&(l.querySelectorAll("input.ui-select-search")[0].id=r.inputId),function(l,r,o,u,d){function p(e){if(f.open){var t=!1;if(t=window.jQuery?window.jQuery.contains(r[0],e.target):r[0].contains(e.target),!t&&!f.clickTriggeredSelect){var s;if(f.skipFocusser)s=!0;else{var i=["input","button","textarea","select"],c=angular.element(e.target).controller("uiSelect");s=c&&c!==f,s||(s=~i.indexOf(e.target.tagName.toLowerCase()))}f.close(s),l.$digest()}f.clickTriggeredSelect=!1}}function h(){var t=i(r);$=angular.element('
    '),$[0].style.width=t.width+"px",$[0].style.height=t.height+"px",r.after($),b=r[0].style.width,e.find("body").append(r),r[0].style.position="absolute",r[0].style.left=t.left+"px",r[0].style.top=t.top+"px",r[0].style.width=t.width+"px"}function g(){null!==$&&($.replaceWith(r),$=null,r[0].style.position="",r[0].style.left="",r[0].style.top="",r[0].style.width=b,f.setFocus())}var f=u[0],v=u[1];f.generatedId=t.generateId(),f.baseTitle=o.title||"Select box",f.focusserTitle=f.baseTitle+" focus",f.focusserId="focusser-"+f.generatedId,f.closeOnSelect=function(){return angular.isDefined(o.closeOnSelect)?c(o.closeOnSelect)():t.closeOnSelect}(),l.$watch("skipFocusser",function(){var e=l.$eval(o.skipFocusser);f.skipFocusser=void 0!==e?e:t.skipFocusser}),f.onSelectCallback=c(o.onSelect),f.onRemoveCallback=c(o.onRemove),f.ngModel=v,f.choiceGrouped=function(e){return f.isGrouped&&e&&e.name},o.tabindex&&o.$observe("tabindex",function(e){f.focusInput.attr("tabindex",e),r.removeAttr("tabindex")}),l.$watch(function(){return l.$eval(o.searchEnabled)},function(e){f.searchEnabled=void 0!==e?e:t.searchEnabled}),l.$watch("sortable",function(){var e=l.$eval(o.sortable);f.sortable=void 0!==e?e:t.sortable}),o.$observe("backspaceReset",function(){var e=l.$eval(o.backspaceReset);f.backspaceReset=void 0===e||e}),o.$observe("limit",function(){f.limit=angular.isDefined(o.limit)?parseInt(o.limit,10):void 0}),l.$watch("removeSelected",function(){var e=l.$eval(o.removeSelected);f.removeSelected=void 0!==e?e:t.removeSelected}),o.$observe("disabled",function(){f.disabled=void 0!==o.disabled&&o.disabled}),o.$observe("resetSearchInput",function(){var e=l.$eval(o.resetSearchInput);f.resetSearchInput=void 0===e||e}),o.$observe("paste",function(){f.paste=l.$eval(o.paste)}),o.$observe("tagging",function(){if(void 0!==o.tagging){var e=l.$eval(o.tagging);f.tagging={isActivated:!0,fct:e!==!0?e:void 0}}else f.tagging={isActivated:!1,fct:void 0}}),o.$observe("taggingLabel",function(){void 0!==o.tagging&&("false"===o.taggingLabel?f.taggingLabel=!1:f.taggingLabel=void 0!==o.taggingLabel?o.taggingLabel:"(new)")}),o.$observe("taggingTokens",function(){if(void 0!==o.tagging){var e=void 0!==o.taggingTokens?o.taggingTokens.split("|"):[",","ENTER"];f.taggingTokens={isActivated:!0,tokens:e}}}),o.$observe("spinnerEnabled",function(){var e=l.$eval(o.spinnerEnabled);f.spinnerEnabled=void 0!==e?e:t.spinnerEnabled}),o.$observe("spinnerClass",function(){var e=o.spinnerClass;f.spinnerClass=void 0!==e?o.spinnerClass:t.spinnerClass}),angular.isDefined(o.autofocus)&&n(function(){f.setFocus()}),angular.isDefined(o.focusOn)&&l.$on(o.focusOn,function(){n(function(){f.setFocus()})}),a.document.addEventListener("click",p,!0),l.$on("$destroy",function(){a.document.removeEventListener("click",p,!0)}),d(l,function(e){var t=angular.element("
    ").append(e),i=t.querySelectorAll(".ui-select-match");if(i.removeAttr("ui-select-match"),i.removeAttr("data-ui-select-match"),1!==i.length)throw s("transcluded","Expected 1 .ui-select-match but got '{0}'.",i.length);r.querySelectorAll(".ui-select-match").replaceWith(i);var l=t.querySelectorAll(".ui-select-choices");if(l.removeAttr("ui-select-choices"),l.removeAttr("data-ui-select-choices"),1!==l.length)throw s("transcluded","Expected 1 .ui-select-choices but got '{0}'.",l.length);r.querySelectorAll(".ui-select-choices").replaceWith(l);var c=t.querySelectorAll(".ui-select-no-choice");c.removeAttr("ui-select-no-choice"),c.removeAttr("data-ui-select-no-choice"),1==c.length&&r.querySelectorAll(".ui-select-no-choice").replaceWith(c);var n=t.querySelectorAll(".ui-select-header");n.removeAttr("ui-select-header"),n.removeAttr("data-ui-select-header"),1==n.length?r.querySelectorAll(".ui-select-header").replaceWith(n):r.querySelectorAll(".ui-select-header").remove();var a=t.querySelectorAll(".ui-select-footer");a.removeAttr("ui-select-footer"),a.removeAttr("data-ui-select-footer"),1==a.length?r.querySelectorAll(".ui-select-footer").replaceWith(a):r.querySelectorAll(".ui-select-footer").remove()});var m=l.$eval(o.appendToBody);(void 0!==m?m:t.appendToBody)&&(l.$watch("$select.open",function(e){e?h():g()}),l.$on("$destroy",function(){g()}));var $=null,b="",w=null,E="direction-up";l.$watch("$select.open",function(){"auto"!==f.dropdownPosition&&"up"!==f.dropdownPosition||l.calculateDropdownPos()});var y=function(e,t){e=e||i(r),t=t||i(w),w[0].style.position="absolute",w[0].style.top=t.height*-1+"px",r.addClass(E)},x=function(e,t){r.removeClass(E),e=e||i(r),t=t||i(w),w[0].style.position="",w[0].style.top=""},S=function(){n(function(){if("up"===f.dropdownPosition)y();else{r.removeClass(E);var t=i(r),s=i(w),l=e[0].documentElement.scrollTop||e[0].body.scrollTop;t.top+t.height+s.height>l+e[0].documentElement.clientHeight?y(t,s):x(t,s)}w[0].style.opacity=1})},C=!1;l.calculateDropdownPos=function(){if(f.open){if(w=angular.element(r).querySelectorAll(".ui-select-dropdown"),0===w.length)return;if(""!==f.search||C||(w[0].style.opacity=0,C=!0),!i(w).height&&f.$animate&&f.$animate.on&&f.$animate.enabled(w)){var e=!0;f.$animate.on("enter",w,function(t,s){"close"===s&&e&&(S(),e=!1)})}else S()}else{if(null===w||0===w.length)return;w[0].style.opacity=0,w[0].style.position="",w[0].style.top="",r.removeClass(E)}}}}}}]),i.directive("uiSelectFooter",["uiSelectConfig",function(e){return{templateUrl:function(t){t.addClass("ui-select-footer");var s=t.parent().attr("theme")||e.theme;return s+"/footer.tpl.html"},restrict:"EA",transclude:!0,replace:!0}}]),i.directive("uiSelectHeader",["uiSelectConfig",function(e){return{templateUrl:function(t){t.addClass("ui-select-header");var s=t.parent().attr("theme")||e.theme;return s+"/header.tpl.html"},restrict:"EA",transclude:!0,replace:!0}}]),i.directive("uiSelectHeaderGroupSelectable",["$timeout",function(e){return{restrict:"EA",require:["^uiSelect"],scope:{isEnabled:"0||p.search.length&&e==t.RIGHT)&&(p.close(),d=s(),p.selected.length&&d!==!1?g.activeMatchIndex=Math.min(n,Math.max(c,d)):g.activeMatchIndex=-1,!0)}function u(e){if(void 0===e||void 0===p.search)return!1;var t=e.filter(function(e){return void 0!==p.search.toUpperCase()&&void 0!==e&&e.toUpperCase()===p.search.toUpperCase()}).length>0;return t}function d(e,t){var s=-1;if(angular.isArray(e))for(var i=angular.copy(e),l=0;l=0;i--)t={},t[p.parserResult.itemName]=p.selected[i],e=p.parserResult.modelMapper(l,t),s.unshift(e);return s}),h.$formatters.unshift(function(e){var t,s=p.parserResult&&p.parserResult.source(l,{$select:{search:""}}),i={};if(!s)return e;var c=[],n=function(e,s){if(e&&e.length){for(var n=e.length-1;n>=0;n--){if(i[p.parserResult.itemName]=e[n],t=p.parserResult.modelMapper(l,i),p.parserResult.trackByExp){var a=/(\w*)\./.exec(p.parserResult.trackByExp),r=/\.([^\s]+)/.exec(p.parserResult.trackByExp);if(a&&a.length>0&&a[1]==p.parserResult.itemName&&r&&r.length>0&&t[r[1]]==s[r[1]])return c.unshift(e[n]),!0}if(angular.equals(t,s))return c.unshift(e[n]),!0}return!1}};if(!e)return c;for(var a=e.length-1;a>=0;a--)n(p.selected,e[a])||n(s,e[a])||c.unshift(e[a]);return c}),l.$watchCollection(function(){return h.$modelValue},function(e,t){t!=e&&(angular.isDefined(h.$modelValue)&&(h.$modelValue=null),g.refreshComponent())}),h.$render=function(){if(!angular.isArray(h.$viewValue)){if(!e(h.$viewValue))throw s("multiarr","Expected model value to be array but got '{0}'",h.$viewValue);h.$viewValue=[]}p.selected=h.$viewValue,g.refreshComponent(),l.$evalAsync()},l.$on("uis:select",function(e,t){if(!(p.selected.length>=p.limit)){p.selected.push(t);var s={};s[p.parserResult.itemName]=t,i(function(){p.onSelectCallback(l,{$item:t,$model:p.parserResult.modelMapper(l,s)})}),g.updateModel()}}),l.$on("uis:activate",function(){g.activeMatchIndex=-1}),l.$watch("$select.disabled",function(e,t){t&&!e&&p.sizeSearchInput()}),p.searchInput.on("keydown",function(e){var s=e.which;l.$apply(function(){var i=!1;t.isHorizontalMovement(s)&&(i=o(s)),i&&s!=t.TAB&&(e.preventDefault(),e.stopPropagation())})}),p.searchInput.on("keyup",function(e){if(t.isVerticalMovement(e.which)||l.$evalAsync(function(){p.activeIndex=p.taggingLabel===!1?-1:0}),p.tagging.isActivated&&p.search.length>0){if(e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||t.isVerticalMovement(e.which))return;if(p.activeIndex=p.taggingLabel===!1?-1:0,p.taggingLabel===!1)return;var s,i,c,n,a=angular.copy(p.items),r=angular.copy(p.items),o=!1,h=-1;if(void 0!==p.tagging.fct){if(c=p.$filter("filter")(a,{isTag:!0}),c.length>0&&(n=c[0]),a.length>0&&n&&(o=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),s=p.tagging.fct(p.search),r.some(function(e){return angular.equals(e,s)})||p.selected.some(function(e){return angular.equals(e,s)}))return void l.$evalAsync(function(){p.activeIndex=0,p.items=a});s&&(s.isTag=!0)}else{if(c=p.$filter("filter")(a,function(e){return e.match(p.taggingLabel)}),c.length>0&&(n=c[0]),i=a[0],void 0!==i&&a.length>0&&n&&(o=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),s=p.search+" "+p.taggingLabel,d(p.selected,p.search)>-1)return;if(u(r.concat(p.selected)))return void(o&&(a=r,l.$evalAsync(function(){p.activeIndex=0,p.items=a})));if(u(r))return void(o&&(p.items=r.slice(1,r.length)))}o&&(h=d(p.selected,s)),h>-1?a=a.slice(h+1,a.length-1):(a=[],s&&a.push(s),a=a.concat(r)),l.$evalAsync(function(){if(p.activeIndex=0,p.items=a,p.isGrouped){var e=s?a.slice(1):a;p.setItemsFn(e),s&&(p.items.unshift(s),p.groups.unshift({name:"",items:[s],tagging:!0}))}})}}),p.searchInput.on("blur",function(){i(function(){g.activeMatchIndex=-1})})}}}]),i.directive("uiSelectNoChoice",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-no-choice");var s=t.parent().attr("theme")||e.theme;return s+"/no-choice.tpl.html"}}}]),i.directive("uiSelectSingle",["$timeout","$compile",function(s,i){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(l,c,n,a){var r=a[0],o=a[1];o.$parsers.unshift(function(t){if(e(t))return t;var s,i={};return i[r.parserResult.itemName]=t,s=r.parserResult.modelMapper(l,i)}),o.$formatters.unshift(function(t){if(e(t))return t;var s,i=r.parserResult&&r.parserResult.source(l,{$select:{search:""}}),c={};if(i){var n=function(e){return c[r.parserResult.itemName]=e,s=r.parserResult.modelMapper(l,c),s===t};if(r.selected&&n(r.selected))return r.selected;for(var a=i.length-1;a>=0;a--)if(n(i[a]))return i[a]}return t}),l.$watch("$select.selected",function(e){o.$viewValue!==e&&o.$setViewValue(e)}),o.$render=function(){r.selected=o.$viewValue},l.$on("uis:select",function(t,i){r.selected=i;var c={};c[r.parserResult.itemName]=i,s(function(){r.onSelectCallback(l,{$item:i,$model:e(i)?i:r.parserResult.modelMapper(l,c)})})}),l.$on("uis:close",function(e,t){s(function(){r.focusser.prop("disabled",!1),t||r.focusser[0].focus()},0,!1)}),l.$on("uis:activate",function(){u.prop("disabled",!0)});var u=angular.element("");i(u)(l),r.focusser=u,r.focusInput=u,c.parent().append(u),u.bind("focus",function(){l.$evalAsync(function(){r.focus=!0})}),u.bind("blur",function(){l.$evalAsync(function(){r.focus=!1})}),u.bind("keydown",function(e){return e.which===t.BACKSPACE&&r.backspaceReset!==!1?(e.preventDefault(),e.stopPropagation(),r.select(void 0),void l.$apply()):void(e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||(e.which!=t.DOWN&&e.which!=t.UP&&e.which!=t.ENTER&&e.which!=t.SPACE||(e.preventDefault(),e.stopPropagation(),r.activate()),l.$digest()))}),u.bind("keyup input",function(e){e.which===t.TAB||t.isControl(e)||t.isFunctionKey(e)||e.which===t.ESC||e.which==t.ENTER||e.which===t.BACKSPACE||(r.activate(u.val()),u.val(""),l.$digest())})}}}]),i.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,s){return{ +require:["^^uiSelect","^ngModel"],link:function(t,i,l,c){if(null===t[l.uiSelectSort])throw s("sort","Expected a list to sort");var n=c[0],a=c[1],r=angular.extend({axis:"horizontal"},t.$eval(l.uiSelectSortOptions)),o=r.axis,u="dragging",d="dropping",p="dropping-before",h="dropping-after";if(t.$watch(function(){return n.sortable},function(e){e?i.attr("draggable",!0):i.removeAttr("draggable")}),!i.data("disallowDrop")){i.on("dragstart",function(e){i.addClass(u),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text",t.$index.toString())}),i.on("dragend",function(){v(u)});var g,f=function(e,t){this.splice(t,0,this.splice(e,1)[0])},v=function(e){angular.forEach(n.$element.querySelectorAll("."+e),function(t){angular.element(t).removeClass(e)})},m=function(e){e.preventDefault();var t="vertical"===o?e.offsetY||e.layerY||(e.originalEvent?e.originalEvent.offsetY:0):e.offsetX||e.layerX||(e.originalEvent?e.originalEvent.offsetX:0);t
  • '),e.put("bootstrap/footer.tpl.html",''),e.put("bootstrap/header.tpl.html",'
    '),e.put("bootstrap/match-multiple.tpl.html",' × '),e.put("bootstrap/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("bootstrap/no-choice.tpl.html",''),e.put("bootstrap/select-multiple.tpl.html",''),e.put("bootstrap/select.tpl.html",''),e.put("select2/choices.tpl.html",'
    '),e.put("select2/footer.tpl.html",''),e.put("select2/header.tpl.html",'
    '),e.put("select2/match-multiple.tpl.html",'
  • '),e.put("select2/match.tpl.html",'{{$select.placeholder}} '),e.put("select2/no-choice.tpl.html",''),e.put("select2/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/footer.tpl.html",''),e.put("selectize/header.tpl.html",'
    '),e.put("selectize/match-multiple.tpl.html",'
    ×
    '),e.put("selectize/match.tpl.html",'
    {{$select.placeholder}}
    '),e.put("selectize/no-choice.tpl.html",'
    '),e.put("selectize/select-multiple.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]); //# sourceMappingURL=select.min.js.map