/*! * ui-select * http://github.com/angular-ui/ui-select * Version: 0.19.3 - 2016-08-17T06:16:41.345Z * License: MIT */ !function(){"use strict";var e={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(t){var i=t.which;switch(i){case e.COMMAND:case e.SHIFT:case e.CTRL:case e.ALT:return!0}return!!(t.metaKey||t.ctrlKey||t.altKey)},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e},isVerticalMovement:function(t){return~[e.UP,e.DOWN].indexOf(t)},isHorizontalMovement:function(t){return~[e.LEFT,e.RIGHT,e.BACKSPACE,e.DELETE].indexOf(t)},toSeparator:function(t){var i={ENTER:"\n",TAB:" ",SPACE:" "}[t];return i?i:e[t]?void 0:t}};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],i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(i.bind(t)(e))return t;t=t.parentElement}return!1});var t=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 t++},appendToBody:!1}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),i=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(i)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,i,c,s){s(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return(""+e).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,i){return i&&t?(""+t).replace(new RegExp(e(i),"gi"),'$&'):t}}).factory("uisOffset",["$document","$window",function(e,t){return function(i){var c=i[0].getBoundingClientRect();return{width:c.width||i.prop("offsetWidth"),height:c.height||i.prop("offsetHeight"),top:c.top+(t.pageYOffset||e[0].documentElement.scrollTop),left:c.left+(t.pageXOffset||e[0].documentElement.scrollLeft)}}}]);i.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(e,t,i,c,s){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){t.addClass("ui-select-choices");var i=t.parent().attr("theme")||e.theme;return i+"/choices.tpl.html"},compile:function(c,n){if(!n.repeat)throw i("repeat","Expected 'repeat' expression.");var l=n.groupBy,a=n.groupFilter;if(l){var r=c.querySelectorAll(".ui-select-choices-group");if(1!==r.length)throw i("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=c.querySelectorAll(".ui-select-choices-row");if(1!==u.length)throw i("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=c.querySelectorAll(".ui-select-choices-row-inner");if(1!==d.length)throw i("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",d.length);d.attr("uis-transclude-append","");var p=s.document.addEventListener?u:d;return p.attr("ng-click","$select.select("+o.itemName+",$select.skipFocusser,$event)"),function(t,i,c,s){s.parseRepeatAttr(c.repeat,l,a),s.disableChoiceExpression=c.uiDisableChoice,s.onHighlightCallback=c.onHighlight,s.dropdownPosition=c.position?c.position.toLowerCase():e.dropdownPosition,t.$on("$destroy",function(){u.remove()}),t.$watch("$select.search",function(e){e&&!s.open&&s.multiple&&s.activate(!1,!0),s.activeIndex=s.tagging.isActivated?-1:0,!c.minimumInputLength||s.search.length>=c.minimumInputLength?s.refresh(c.refresh):s.items=[]}),c.$observe("refreshDelay",function(){var i=t.$eval(c.refreshDelay);s.refreshDelay=void 0!==i?i:e.refreshDelay})}}}}]),i.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(t,i,c,s,n,l,a,r,o,u,d){function p(e,t,i){if(e.findIndex)return e.findIndex(t,i);for(var c,s=Object(e),n=s.length>>>0,l=0;n>l;l++)if(c=s[l],t.call(i,c,l,s))return l;return-1}function h(){w.resetSearchInput&&(w.search=y,w.selected&&w.items.length&&!w.multiple&&(w.activeIndex=p(w.items,function(e){return angular.equals(this,e)},w.selected)))}function g(e,t){var i,c,s=[];for(i=0;i-1&&S.splice(i,1)}function v(e){return S.indexOf(e)>-1}function m(e){function t(e,t){var i=c.indexOf(e);t&&-1===i&&c.push(e),!t&&i>-1&&c.splice(i,0)}function i(e){return c.indexOf(e)>-1}if(e){var c=[];w.isLocked=function(e,c){var s=!1,n=w.selected[c];return n&&(e?(s=!!e.$eval(w.lockChoiceExpression),t(n,s)):s=i(n)),s}}}function $(t){var i=!0;switch(t){case e.DOWN:!w.open&&w.multiple?w.activate(!1,!0):w.activeIndex0||0===w.search.length&&w.tagging.isActivated&&w.activeIndex>-1)&&w.activeIndex--;break;case e.TAB:w.multiple&&!w.open||w.select(w.items[w.activeIndex],!0);break;case e.ENTER:w.open&&(w.tagging.isActivated||w.activeIndex>=0)?w.select(w.items[w.activeIndex],w.skipFocusser):w.activate(!1,!0);break;case e.ESC:w.close();break;default:i=!1}return i}function b(){var e=i.querySelectorAll(".ui-select-choices-content"),t=e.querySelectorAll(".ui-select-choices-row");if(t.length<1)throw a("choices","Expected multiple .ui-select-choices-row but got '{0}'.",t.length);if(!(w.activeIndex<0)){var c=t[w.activeIndex],s=c.offsetTop+c.clientHeight-e[0].scrollTop,n=e[0].offsetHeight;s>n?e[0].scrollTop+=s-n:s=w.items.length?0:w.activeIndex,-1===w.activeIndex&&w.taggingLabel!==!1&&(w.activeIndex=0);var n=i.querySelectorAll(".ui-select-choices-content"),l=i.querySelectorAll(".ui-select-search");if(w.$animate&&w.$animate.on&&w.$animate.enabled(n[0])){var a=function(t,i){"start"===i&&0===w.items.length?(w.$animate.off("removeClass",l[0],a),c(function(){w.focusSearchInput(e)})):"close"===i&&(w.$animate.off("enter",n[0],a),c(function(){w.focusSearchInput(e)}))};w.items.length>0?w.$animate.on("enter",n[0],a):w.$animate.on("removeClass",l[0],a)}else c(function(){w.focusSearchInput(e),!w.tagging.isActivated&&w.items.length>1&&b()})}},w.focusSearchInput=function(e){w.search=e||w.search,w.searchInput[0].focus()},w.findGroupByName=function(e){return w.groups&&w.groups.filter(function(t){return t.name===e})[0]},w.parseRepeatAttr=function(e,i,c){function s(e){var s=t.$eval(i);if(w.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(s)?s(e):e[s],i=w.findGroupByName(t);i?i.items.push(e):w.groups.push({name:t,items:[e]})}),c){var n=t.$eval(c);angular.isFunction(n)?w.groups=n(w.groups):angular.isArray(n)&&(w.groups=g(w.groups,n))}w.items=[],w.groups.forEach(function(e){w.items=w.items.concat(e.items)})}function n(e){w.items=e}w.setItemsFn=i?s:n,w.parserResult=l.parse(e),w.isGrouped=!!i,w.itemProperty=w.parserResult.itemName;var r=w.parserResult.source,u=function(){var e=r(t);t.$uisSource=Object.keys(e).map(function(t){var i={};return i[w.parserResult.keyName]=t,i.value=e[t],i})};w.parserResult.keyName&&(u(),w.parserResult.source=o("$uisSource"+w.parserResult.filters),t.$watch(r,function(e,t){e!==t&&u()},!0)),w.refreshItems=function(e){e=e||w.parserResult.source(t);var i=w.selected;if(w.isEmpty()||angular.isArray(i)&&!i.length||!w.multiple||!w.removeSelected)w.setItemsFn(e);else if(void 0!==e&&null!==e){var c=e.filter(function(e){return angular.isArray(i)?i.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,i)});w.setItemsFn(c)}"auto"!==w.dropdownPosition&&"up"!==w.dropdownPosition||t.calculateDropdownPos(),t.$broadcast("uis:refresh")},t.$watchCollection(w.parserResult.source,function(e){if(void 0===e||null===e)w.items=[];else{if(!angular.isArray(e))throw a("items","Expected an array but got '{0}'.",e);w.refreshItems(e),angular.isDefined(w.ngModel.$modelValue)&&(w.ngModel.$modelValue=null)}})};var x;w.refresh=function(e){void 0!==e&&(x&&c.cancel(x),x=c(function(){t.$eval(e)},w.refreshDelay))},w.isActive=function(e){if(!w.open)return!1;var t=w.items.indexOf(e[w.itemProperty]),i=t==w.activeIndex;return!i||0>t?!1:(i&&!angular.isUndefined(w.onHighlightCallback)&&e.$eval(w.onHighlightCallback),i)};var E=function(e){return w.selected&&angular.isArray(w.selected)&&w.selected.filter(function(t){return angular.equals(t,e)}).length>0},S=[];w.isDisabled=function(e){if(w.open){var t=e[w.itemProperty],i=w.items.indexOf(t),c=!1;if(i>=0&&(angular.isDefined(w.disableChoiceExpression)||w.multiple)){if(t.isTag)return!1;w.multiple&&(c=E(t)),!c&&angular.isDefined(w.disableChoiceExpression)&&(c=!!e.$eval(w.disableChoiceExpression)),f(t,c)}return c}},w.select=function(e,i,s){if(void 0===e||!v(e)){if(!w.items&&!w.search&&!w.tagging.isActivated)return;if(!e||!v(e)){if(w.clickTriggeredSelect=!1,s&&"click"===s.type&&e&&(w.clickTriggeredSelect=!0),w.tagging.isActivated&&w.clickTriggeredSelect===!1){if(w.taggingLabel===!1)if(w.activeIndex<0){if(void 0===e&&(e=void 0!==w.tagging.fct?w.tagging.fct(w.search):w.search),!e||angular.equals(w.items[0],e))return}else e=w.items[w.activeIndex];else if(0===w.activeIndex){if(void 0===e)return;if(void 0!==w.tagging.fct&&"string"==typeof e){if(e=w.tagging.fct(e),!e)return}else"string"==typeof e&&(e=e.replace(w.taggingLabel,"").trim())}if(E(e))return void w.close(i)}h(),t.$broadcast("uis:select",e);var n={};n[w.parserResult.itemName]=e,c(function(){w.onSelectCallback(t,{$item:e,$model:w.parserResult.modelMapper(t,n)})}),w.closeOnSelect&&w.close(i)}}},w.close=function(e){w.open&&(w.ngModel&&w.ngModel.$setTouched&&w.ngModel.$setTouched(),w.open=!1,h(),t.$broadcast("uis:close",e))},w.setFocus=function(){w.focus||w.focusInput[0].focus()},w.clear=function(e){w.select(void 0),e.stopPropagation(),c(function(){w.focusser[0].focus()},0,!1)},w.toggle=function(e){w.open?(w.close(),e.preventDefault(),e.stopPropagation()):w.activate()},w.isLocked=function(){return!1},t.$watch(function(){return angular.isDefined(w.lockChoiceExpression)&&""!==w.lockChoiceExpression},m);var I=null,C=!1;w.sizeSearchInput=function(){var e=w.searchInput[0],i=w.searchInput.parent().parent()[0],s=function(){return i.clientWidth*!!e.offsetParent},n=function(t){if(0===t)return!1;var i=t-e.offsetLeft-10;return 50>i&&(i=t),w.searchInput.css("width",i+"px"),!0};w.searchInput.css("width","10px"),c(function(){null!==I||n(s())||(I=t.$watch(function(){C||(C=!0,t.$$postDigest(function(){C=!1,n(s())&&(I(),I=null)}))},angular.noop))})},w.searchInput.on("keydown",function(i){var s=i.which;~[e.ENTER,e.ESC].indexOf(s)&&(i.preventDefault(),i.stopPropagation()),t.$apply(function(){var t=!1;if((w.items.length>0||w.tagging.isActivated)&&($(s)||w.searchEnabled||(i.preventDefault(),i.stopPropagation()),w.taggingTokens.isActivated)){for(var n=0;n0&&(t=!0);t&&c(function(){w.searchInput.triggerHandler("tagged");var t=w.search.replace(e.MAP[i.keyCode],"").trim();w.tagging.fct&&(t=w.tagging.fct(t)),t&&w.select(t,!0)})}}),e.isVerticalMovement(s)&&w.items.length>0&&b(),s!==e.ENTER&&s!==e.ESC||(i.preventDefault(),i.stopPropagation())}),w.searchInput.on("paste",function(t){var i;if(i=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(t.originalEvent||t).clipboardData.getData("text/plain"),i=w.search+i,i&&i.length>0)if(w.taggingTokens.isActivated){for(var c=[],s=0;s-1){c=i.split(n);break}}0===c.length&&(c=[i]);var l=w.search;angular.forEach(c,function(e){var t=w.tagging.fct?w.tagging.fct(e):e;t&&w.select(t,!0)}),w.search=l||y,t.preventDefault(),t.stopPropagation()}else w.paste&&(w.paste(i),w.search=y,t.preventDefault(),t.stopPropagation())}),w.searchInput.on("tagged",function(){c(function(){h()})});var A=n(function(){w.sizeSearchInput()},50);angular.element(d).bind("resize",A),t.$on("$destroy",function(){w.searchInput.off("keyup keydown tagged blur paste"),angular.element(d).off("resize",A)})}]),i.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","uisOffset","$compile","$parse","$timeout",function(e,t,i,c,s,n,l){return{restrict:"EA",templateUrl:function(e,i){var c=i.theme||t.theme;return c+(angular.isDefined(i.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",compile:function(s,a){var r=/{(.*)}\s*{(.*)}/.exec(a.ngClass);if(r){var o="{"+r[1]+", "+r[2]+"}";a.ngClass=o,s.attr("ng-class",o)}return angular.isDefined(a.multiple)?s.append("").removeAttr("multiple"):s.append(""),a.inputId&&(s.querySelectorAll("input.ui-select-search")[0].id=a.inputId),function(s,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 i;if(g.skipFocusser)i=!0;else{var c=["input","button","textarea","select"],n=angular.element(e.target).controller("uiSelect");i=n&&n!==g,i||(i=~c.indexOf(e.target.tagName.toLowerCase()))}g.close(i),s.$digest()}g.clickTriggeredSelect=!1}}function p(){var t=c(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}(),s.$watch("skipFocusser",function(){var e=s.$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")}),s.$watch(function(){return s.$eval(r.searchEnabled)},function(e){g.searchEnabled=void 0!==e?e:t.searchEnabled}),s.$watch("sortable",function(){var e=s.$eval(r.sortable);g.sortable=void 0!==e?e:t.sortable}),r.$observe("limit",function(){g.limit=angular.isDefined(r.limit)?parseInt(r.limit,10):void 0}),s.$watch("removeSelected",function(){var e=s.$eval(r.removeSelected);g.removeSelected=void 0!==e?e:t.removeSelected}),r.$observe("disabled",function(){g.disabled=void 0!==r.disabled?r.disabled:!1}),r.$observe("resetSearchInput",function(){var e=s.$eval(r.resetSearchInput);g.resetSearchInput=void 0!==e?e:!0}),r.$observe("paste",function(){g.paste=s.$eval(r.paste)}),r.$observe("tagging",function(){if(void 0!==r.tagging){var e=s.$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}}}),angular.isDefined(r.autofocus)&&l(function(){g.setFocus()}),angular.isDefined(r.focusOn)&&s.$on(r.focusOn,function(){l(function(){g.setFocus()})}),e.on("click",d),s.$on("$destroy",function(){e.off("click",d)}),u(s,function(e){var t=angular.element("
").append(e),c=t.querySelectorAll(".ui-select-match");if(c.removeAttr("ui-select-match"),c.removeAttr("data-ui-select-match"),1!==c.length)throw i("transcluded","Expected 1 .ui-select-match but got '{0}'.",c.length);a.querySelectorAll(".ui-select-match").replaceWith(c);var s=t.querySelectorAll(".ui-select-choices");if(s.removeAttr("ui-select-choices"),s.removeAttr("data-ui-select-choices"),1!==s.length)throw i("transcluded","Expected 1 .ui-select-choices but got '{0}'.",s.length);a.querySelectorAll(".ui-select-choices").replaceWith(s);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=s.$eval(r.appendToBody);(void 0!==v?v:t.appendToBody)&&(s.$watch("$select.open",function(e){e?p():h()}),s.$on("$destroy",function(){h()}));var m=null,$="",b=null,w="direction-up";s.$watch("$select.open",function(){"auto"!==g.dropdownPosition&&"up"!==g.dropdownPosition||s.calculateDropdownPos()});var y=function(e,t){e=e||c(a),t=t||c(b),b[0].style.position="absolute",b[0].style.top=-1*t.height+"px",a.addClass(w)},x=function(e,t){a.removeClass(w),e=e||c(a),t=t||c(b),b[0].style.position="",b[0].style.top=""},E=function(){l(function(){if("up"===g.dropdownPosition)y();else{a.removeClass(w);var t=c(a),i=c(b),s=e[0].documentElement.scrollTop||e[0].body.scrollTop;t.top+t.height+i.height>s+e[0].documentElement.clientHeight?y(t,i):x(t,i)}b[0].style.opacity=1})},S=!1;s.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),!c(b).height&&g.$animate&&g.$animate.on&&g.$animate.enabled(b)){var e=!0;g.$animate.on("enter",b,function(t,i){"close"===i&&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(i){i.addClass("ui-select-match");var c=i.parent(),s=t(c,"theme")||e.theme,n=angular.isDefined(t(c,"multiple"));return s+(n?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,i,c,s){function n(e){s.allowClear=angular.isDefined(e)?""===e?!0:"true"===e.toLowerCase():!1}s.lockChoiceExpression=c.uiLockChoice,c.$observe("placeholder",function(t){s.placeholder=void 0!==t?t:e.placeholder}),c.$observe("allowClear",n),n(c.allowClear),s.multiple&&s.sizeSearchInput()}}}]),i.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(t,i){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function(e,t){var i,c=this,s=e.$select;angular.isUndefined(s.selected)&&(s.selected=[]),e.$evalAsync(function(){i=e.ngModel}),c.activeMatchIndex=-1,c.updateModel=function(){i.$setViewValue(Date.now()),c.refreshComponent()},c.refreshComponent=function(){s.refreshItems&&s.refreshItems(),s.sizeSearchInput&&s.sizeSearchInput()},c.removeChoice=function(i){if(s.isLocked(null,i))return!1;var n=s.selected[i],l={};return l[s.parserResult.itemName]=n,s.selected.splice(i,1),c.activeMatchIndex=-1,s.sizeSearchInput(),t(function(){s.onRemoveCallback(e,{$item:n,$model:s.parserResult.modelMapper(e,l)})}),c.updateModel(),!0},c.getPlaceholder=function(){return s.selected&&s.selected.length?void 0:s.placeholder}}],controllerAs:"$selectMultiple",link:function(c,s,n,l){function a(e){return angular.isNumber(e.selectionStart)?e.selectionStart:e.value.length}function r(t){function i(){switch(t){case e.LEFT:return~h.activeMatchIndex?u:l;case e.RIGHT:return~h.activeMatchIndex&&r!==l?o:(d.activate(),!1);case e.BACKSPACE:return~h.activeMatchIndex?h.removeChoice(r)?u:r:l;case e.DELETE:return~h.activeMatchIndex?(h.removeChoice(h.activeMatchIndex),r):!1}}var c=a(d.searchInput[0]),s=d.selected.length,n=0,l=s-1,r=h.activeMatchIndex,o=h.activeMatchIndex+1,u=h.activeMatchIndex-1,p=r;return c>0||d.search.length&&t==e.RIGHT?!1:(d.close(),p=i(),d.selected.length&&p!==!1?h.activeMatchIndex=Math.min(l,Math.max(n,p)):h.activeMatchIndex=-1,!0)}function o(e){if(void 0===e||void 0===d.search)return!1;var t=e.filter(function(e){return void 0===d.search.toUpperCase()||void 0===e?!1:e.toUpperCase()===d.search.toUpperCase()}).length>0;return t}function u(e,t){var i=-1;if(angular.isArray(e))for(var c=angular.copy(e),s=0;s=0;s--)t={},t[d.parserResult.itemName]=d.selected[s],e=d.parserResult.modelMapper(c,t),i.unshift(e);return i}),p.$formatters.unshift(function(e){var t,i=d.parserResult&&d.parserResult.source(c,{$select:{search:""}}),s={};if(!i)return e;var n=[],l=function(e,i){if(e&&e.length){for(var l=e.length-1;l>=0;l--){if(s[d.parserResult.itemName]=e[l],t=d.parserResult.modelMapper(c,s),d.parserResult.trackByExp){var a=/(\w*)\./.exec(d.parserResult.trackByExp),r=/\.([^\s]+)/.exec(d.parserResult.trackByExp);if(a&&a.length>0&&a[1]==d.parserResult.itemName&&r&&r.length>0&&t[r[1]]==i[r[1]])return n.unshift(e[l]),!0}if(angular.equals(t,i))return n.unshift(e[l]),!0}return!1}};if(!e)return n;for(var a=e.length-1;a>=0;a--)l(d.selected,e[a])||l(i,e[a])||n.unshift(e[a]);return n}),c.$watchCollection(function(){return p.$modelValue},function(e,t){t!=e&&(angular.isDefined(p.$modelValue)&&(p.$modelValue=null),h.refreshComponent())}),p.$render=function(){if(!angular.isArray(p.$viewValue)){if(!angular.isUndefined(p.$viewValue)&&null!==p.$viewValue)throw t("multiarr","Expected model value to be array but got '{0}'",p.$viewValue);p.$viewValue=[]}d.selected=p.$viewValue,h.refreshComponent(),c.$evalAsync()},c.$on("uis:select",function(e,t){d.selected.length>=d.limit||(d.selected.push(t),h.updateModel())}),c.$on("uis:activate",function(){h.activeMatchIndex=-1}),c.$watch("$select.disabled",function(e,t){t&&!e&&d.sizeSearchInput()}),d.searchInput.on("keydown",function(t){var i=t.which;c.$apply(function(){var c=!1;e.isHorizontalMovement(i)&&(c=r(i)),c&&i!=e.TAB&&(t.preventDefault(),t.stopPropagation())})}),d.searchInput.on("keyup",function(t){if(e.isVerticalMovement(t.which)||c.$evalAsync(function(){d.activeIndex=d.taggingLabel===!1?-1:0}),d.tagging.isActivated&&d.search.length>0){if(t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||e.isVerticalMovement(t.which))return;if(d.activeIndex=d.taggingLabel===!1?-1:0,d.taggingLabel===!1)return;var i,s,n,l,a=angular.copy(d.items),r=angular.copy(d.items),p=!1,h=-1;if(void 0!==d.tagging.fct){if(n=d.$filter("filter")(a,{isTag:!0}),n.length>0&&(l=n[0]),a.length>0&&l&&(p=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),i=d.tagging.fct(d.search),r.some(function(e){return angular.equals(e,i)})||d.selected.some(function(e){return angular.equals(e,i)}))return void c.$evalAsync(function(){d.activeIndex=0,d.items=a});i&&(i.isTag=!0)}else{if(n=d.$filter("filter")(a,function(e){return e.match(d.taggingLabel)}),n.length>0&&(l=n[0]),s=a[0],void 0!==s&&a.length>0&&l&&(p=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),i=d.search+" "+d.taggingLabel,u(d.selected,d.search)>-1)return;if(o(r.concat(d.selected)))return void(p&&(a=r,c.$evalAsync(function(){d.activeIndex=0,d.items=a})));if(o(r))return void(p&&(d.items=r.slice(1,r.length)))}p&&(h=u(d.selected,i)),h>-1?a=a.slice(h+1,a.length-1):(a=[],i&&a.push(i),a=a.concat(r)),c.$evalAsync(function(){if(d.activeIndex=0,d.items=a,d.isGrouped){var e=i?a.slice(1):a;d.setItemsFn(e),i&&(d.items.unshift(i),d.groups.unshift({name:"",items:[i],tagging:!0}))}})}}),d.searchInput.on("blur",function(){i(function(){h.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 i=t.parent().attr("theme")||e.theme;return i+"/no-choice.tpl.html"}}}]),i.directive("uiSelectSingle",["$timeout","$compile",function(t,i){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(c,s,n,l){var a=l[0],r=l[1];r.$parsers.unshift(function(e){var t,i={};return i[a.parserResult.itemName]=e,t=a.parserResult.modelMapper(c,i)}),r.$formatters.unshift(function(e){var t,i=a.parserResult&&a.parserResult.source(c,{$select:{search:""}}),s={};if(i){var n=function(i){return s[a.parserResult.itemName]=i,t=a.parserResult.modelMapper(c,s),t===e};if(a.selected&&n(a.selected))return a.selected;for(var l=i.length-1;l>=0;l--)if(n(i[l]))return i[l]}return e}),c.$watch("$select.selected",function(e){r.$viewValue!==e&&r.$setViewValue(e)}),r.$render=function(){a.selected=r.$viewValue},c.$on("uis:select",function(e,t){a.selected=t}),c.$on("uis:close",function(e,i){t(function(){a.focusser.prop("disabled",!1),i||a.focusser[0].focus()},0,!1)}),c.$on("uis:activate",function(){o.prop("disabled",!0)});var o=angular.element("");i(o)(c),a.focusser=o,a.focusInput=o,s.parent().append(o),o.bind("focus",function(){c.$evalAsync(function(){a.focus=!0})}),o.bind("blur",function(){c.$evalAsync(function(){a.focus=!1})}),o.bind("keydown",function(t){return t.which===e.BACKSPACE?(t.preventDefault(),t.stopPropagation(),a.select(void 0),void c.$apply()):void(t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||(t.which!=e.DOWN&&t.which!=e.UP&&t.which!=e.ENTER&&t.which!=e.SPACE||(t.preventDefault(),t.stopPropagation(),a.activate()),c.$digest()))}),o.bind("keyup input",function(t){t.which===e.TAB||e.isControl(t)||e.isFunctionKey(t)||t.which===e.ESC||t.which==e.ENTER||t.which===e.BACKSPACE||(a.activate(o.val()),o.val(""),c.$digest())})}}}]),i.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,i){return{require:["^^uiSelect","^ngModel"],link:function(t,c,s,n){if(null===t[s.uiSelectSort])throw i("sort","Expected a list to sort");var l=n[0],a=n[1],r=angular.extend({axis:"horizontal"},t.$eval(s.uiSelectSortOptions)),o=r.axis,u="dragging",d="dropping",p="dropping-before",h="dropping-after";t.$watch(function(){return l.sortable},function(e){e?c.attr("draggable",!0):c.removeAttr("draggable")}),c.on("dragstart",function(e){c.addClass(u),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text",t.$index.toString())}),c.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.tpl.html",'
    {{$select.placeholder}}
    '),e.put("selectize/no-choice.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]); //# sourceMappingURL=select.min.js.map