From 032b15213a61c2bae79e25e020231bc2fc7a5328 Mon Sep 17 00:00:00 2001 From: Wladimir Coka Date: Mon, 9 Mar 2015 09:31:09 -0500 Subject: [PATCH] chore(build): v0.11.1 --- bower.json | 2 +- dist/select.css | 2 +- dist/select.js | 8 +++++--- dist/select.min.css | 2 +- dist/select.min.js | 4 ++-- package.json | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index 49fcdf231..e2d222a4a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ui-select", - "version": "0.11.0", + "version": "0.11.1", "homepage": "https://github.com/angular-ui/ui-select", "authors": [ "AngularUI" diff --git a/dist/select.css b/dist/select.css index 3b389278d..26498e0f4 100644 --- a/dist/select.css +++ b/dist/select.css @@ -1,7 +1,7 @@ /*! * ui-select * http://github.com/angular-ui/ui-select - * Version: 0.11.0 - 2015-03-09T00:55:08.444Z + * Version: 0.11.1 - 2015-03-09T14:30:26.112Z * License: MIT */ diff --git a/dist/select.js b/dist/select.js index 62c75f2be..027e14489 100644 --- a/dist/select.js +++ b/dist/select.js @@ -1,7 +1,7 @@ /*! * ui-select * http://github.com/angular-ui/ui-select - * Version: 0.11.0 - 2015-03-09T00:55:08.441Z + * Version: 0.11.1 - 2015-03-09T14:30:26.109Z * License: MIT */ @@ -1236,8 +1236,10 @@ uis.directive('uiSelect', attrs.$observe('disabled', function() { // No need to use $eval() (thanks to ng-disabled) since we already get a boolean instead of a string $select.disabled = attrs.disabled !== undefined ? attrs.disabled : false; - // As the search input field may now become visible, it may be necessary to recompute its size - $select.sizeSearchInput(); + if ($select.multiple) { + // As the search input field may now become visible, it may be necessary to recompute its size + $select.sizeSearchInput(); + } }); attrs.$observe('resetSearchInput', function() { diff --git a/dist/select.min.css b/dist/select.min.css index 7129e2ff7..522304493 100644 --- a/dist/select.min.css +++ b/dist/select.min.css @@ -1,6 +1,6 @@ /*! * ui-select * http://github.com/angular-ui/ui-select - * Version: 0.11.0 - 2015-03-09T00:55:08.444Z + * Version: 0.11.1 - 2015-03-09T14:30:26.112Z * License: MIT */.ui-select-highlight{font-weight:700}.ui-select-offscreen{clip:rect(0 0 0 0)!important;width:1px!important;height:1px!important;border:0!important;margin:0!important;padding:0!important;overflow:hidden!important;position:absolute!important;outline:0!important;left:0!important;top:0!important}.ng-dirty.ng-invalid>a.select2-choice{border-color:#D44950}.select2-result-single{padding-left:0}.select-locked>.ui-select-match-close,.select2-locked>.select2-search-choice-close{display:none}.selectize-input.selectize-focus{border-color:#007FBB!important}.selectize-control>.selectize-dropdown,.selectize-control>.selectize-input>input{width:100%}.ng-dirty.ng-invalid>div.selectize-input{border-color:#D44950}.btn-default-focus{color:#333;background-color:#EBEBEB;border-color:#ADADAD;text-decoration:none;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.ui-select-bootstrap .ui-select-toggle{position:relative}.ui-select-bootstrap .ui-select-toggle>.caret{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.input-group>.ui-select-bootstrap.dropdown{position:static}.input-group>.ui-select-bootstrap>input.ui-select-search.form-control{border-radius:4px 0 0 4px}.ui-select-bootstrap>.ui-select-match{text-align:left}.ui-select-bootstrap>.ui-select-match>.caret{position:absolute;top:45%;right:15px}.ui-select-bootstrap>.ui-select-choices{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:-1px}.ui-select-multiple.ui-select-bootstrap{height:auto;padding:3px 3px 0}.ui-select-multiple.ui-select-bootstrap input.ui-select-search{background-color:transparent!important;border:none;outline:0;height:1.666666em;margin-bottom:3px}.ui-select-multiple.ui-select-bootstrap .ui-select-match .close{font-size:1.6em;line-height:.75}.ui-select-multiple.ui-select-bootstrap .ui-select-match-item{outline:0;margin:0 3px 3px 0}.ui-select-multiple .ui-select-match-item{position:relative}.ui-select-multiple .ui-select-match-item.dropping-before:before{content:"";position:absolute;top:0;right:100%;height:100%;margin-right:2px;border-left:1px solid #428bca}.ui-select-multiple .ui-select-match-item.dropping-after:after{content:"";position:absolute;top:0;left:100%;height:100%;margin-left:2px;border-right:1px solid #428bca}.ui-select-bootstrap .ui-select-choices-row>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-bootstrap .ui-select-choices-row>a:focus,.ui-select-bootstrap .ui-select-choices-row>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.ui-select-bootstrap .ui-select-choices-row.active>a{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.ui-select-bootstrap .ui-select-choices-row.active.disabled>a,.ui-select-bootstrap .ui-select-choices-row.disabled>a{color:#777;cursor:not-allowed;background-color:#fff}.ui-select-match.ng-hide-add,.ui-select-search.ng-hide-add{display:none!important}.ui-select-bootstrap.ng-dirty.ng-invalid>button.btn.ui-select-match{border-color:#D44950} \ No newline at end of file diff --git a/dist/select.min.js b/dist/select.min.js index d9d1acb13..e0d9a6725 100644 --- a/dist/select.min.js +++ b/dist/select.min.js @@ -1,7 +1,7 @@ /*! * ui-select * http://github.com/angular-ui/ui-select - * Version: 0.11.0 - 2015-03-09T00:55:08.441Z + * Version: 0.11.1 - 2015-03-09T14:30:26.109Z * 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 c=t.which;switch(c){case e.COMMAND:case e.SHIFT:case e.CTRL:case e.ALT:return!0}return t.metaKey?!0:!1},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)}};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],c=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(c.bind(t)(e))return t;t=t.parentElement}return!1});var t=0,c=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,generateId:function(){return t++}}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),c=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(c)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,c,i,l){l(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,c){return c&&t?t.replace(new RegExp(e(c),"gi"),'$&'):t}});c.service("RepeatParser",["uiSelectMinErr","$parse",function(e,t){var c=this;c.parse=function(c){var i=c.match(/^\s*(?:([\s\S]+?)\s+as\s+)?([\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!i)throw e("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",c);return{itemName:i[2],source:t(i[3]),trackByExp:i[4],modelMapper:t(i[1]||i[2])}},c.getGroupNgRepeatExpression=function(){return"$group in $select.groups"},c.getNgRepeatExpression=function(e,t,c,i){var l=e+" in "+(i?"$group.items":t);return c&&(l+=" track by "+c),l}}]),c.directive("uiSelectChoices",["uiSelectConfig","RepeatParser","uiSelectMinErr","$compile",function(e,t,c,i){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){var c=t.parent().attr("theme")||e.theme;return c+"/choices.tpl.html"},compile:function(l,s){if(!s.repeat)throw c("repeat","Expected 'repeat' expression.");return function(l,s,a,n,r){var o=a.groupBy;if(n.parseRepeatAttr(a.repeat,o),n.disableChoiceExpression=a.uiDisableChoice,n.onHighlightCallback=a.onHighlight,o){var u=s.querySelectorAll(".ui-select-choices-group");if(1!==u.length)throw c("rows","Expected 1 .ui-select-choices-group but got '{0}'.",u.length);u.attr("ng-repeat",t.getGroupNgRepeatExpression())}var d=s.querySelectorAll(".ui-select-choices-row");if(1!==d.length)throw c("rows","Expected 1 .ui-select-choices-row but got '{0}'.",d.length);d.attr("ng-repeat",t.getNgRepeatExpression(n.parserResult.itemName,"$select.items",n.parserResult.trackByExp,o)).attr("ng-if","$select.open").attr("ng-mouseenter","$select.setActiveItem("+n.parserResult.itemName+")").attr("ng-click","$select.select("+n.parserResult.itemName+",false,$event)");var p=s.querySelectorAll(".ui-select-choices-row-inner");if(1!==p.length)throw c("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",p.length);p.attr("uis-transclude-append",""),i(s,r)(l),l.$watch("$select.search",function(e){e&&!n.open&&n.multiple&&n.activate(!1,!0),n.activeIndex=n.tagging.isActivated?-1:0,n.refresh(a.refresh)}),a.$observe("refreshDelay",function(){var t=l.$eval(a.refreshDelay);n.refreshDelay=void 0!==t?t:e.refreshDelay})}}}}]),c.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","RepeatParser","uiSelectMinErr","uiSelectConfig",function(t,c,i,l,s,a,n){function r(){(f.resetSearchInput||void 0===f.resetSearchInput&&n.resetSearchInput)&&(f.search=v,f.selected&&f.items.length&&!f.multiple&&(f.activeIndex=f.items.indexOf(f.selected)))}function o(t){var c=!0;switch(t){case e.DOWN:!f.open&&f.multiple?f.activate(!1,!0):f.activeIndex0||0===f.search.length&&f.tagging.isActivated&&f.activeIndex>-1)&&f.activeIndex--;break;case e.TAB:(!f.multiple||f.open)&&f.select(f.items[f.activeIndex],!0);break;case e.ENTER:f.open&&f.activeIndex>=0?f.select(f.items[f.activeIndex]):f.activate(!1,!0);break;case e.ESC:f.close();break;default:c=!1}return c}function u(t){function c(){switch(t){case e.LEFT:return~f.activeMatchIndex?o:a;case e.RIGHT:return~f.activeMatchIndex&&n!==a?r:(f.activate(),!1);case e.BACKSPACE:return~f.activeMatchIndex?(f.removeChoice(n),o):a;case e.DELETE:return~f.activeMatchIndex?(f.removeChoice(f.activeMatchIndex),n):!1}}var i=g(m[0]),l=f.selected.length,s=0,a=l-1,n=f.activeMatchIndex,r=f.activeMatchIndex+1,o=f.activeMatchIndex-1,u=n;return i>0||f.search.length&&t==e.RIGHT?!1:(f.close(),u=c(),f.activeMatchIndex=f.selected.length&&u!==!1?Math.min(a,Math.max(s,u)):-1,!0)}function d(e){if(void 0===e||void 0===f.search)return!1;var t=e.filter(function(e){return void 0===f.search.toUpperCase()||void 0===e?!1:e.toUpperCase()===f.search.toUpperCase()}).length>0;return t}function p(e,t){var c=-1;if(angular.isArray(e))for(var i=angular.copy(e),l=0;ls?e[0].scrollTop+=l-s:l=f.items.length?0:f.activeIndex,-1===f.activeIndex&&f.taggingLabel!==!1&&(f.activeIndex=0),i(function(){f.search=e||f.search,m[0].focus()}))},f.findGroupByName=function(e){return f.groups&&f.groups.filter(function(t){return t.name===e})[0]},f.parseRepeatAttr=function(e,c){function i(e){f.groups=[],angular.forEach(e,function(e){var i=t.$eval(c),l=angular.isFunction(i)?i(e):e[i],s=f.findGroupByName(l);s?s.items.push(e):f.groups.push({name:l,items:[e]})}),f.items=[],f.groups.forEach(function(e){f.items=f.items.concat(e.items)})}function l(e){f.items=e}var n=c?i:l;f.parserResult=s.parse(e),f.isGrouped=!!c,f.itemProperty=f.parserResult.itemName,t.$watchCollection(f.parserResult.source,function(e){if(void 0===e||null===e)f.items=[];else{if(!angular.isArray(e))throw a("items","Expected an array but got '{0}'.",e);if(f.multiple){var t=e.filter(function(e){return f.selected.indexOf(e)<0});n(t)}else n(e);f.ngModel.$modelValue=null}}),f.multiple&&t.$watchCollection("$select.selected",function(e){var c=f.parserResult.source(t);if(e.length){if(void 0!==c){var i=c.filter(function(t){return e.indexOf(t)<0});n(i)}}else n(c);f.sizeSearchInput()})};var $;f.refresh=function(e){void 0!==e&&($&&i.cancel($),$=i(function(){t.$eval(e)},f.refreshDelay))},f.setActiveItem=function(e){f.activeIndex=f.items.indexOf(e)},f.isActive=function(e){if(!f.open)return!1;var t=f.items.indexOf(e[f.itemProperty]),c=t===f.activeIndex;return!c||0>t&&f.taggingLabel!==!1||0>t&&f.taggingLabel===!1?!1:(c&&!angular.isUndefined(f.onHighlightCallback)&&e.$eval(f.onHighlightCallback),c)},f.isDisabled=function(e){if(f.open){var t,c=f.items.indexOf(e[f.itemProperty]),i=!1;return c>=0&&!angular.isUndefined(f.disableChoiceExpression)&&(t=f.items[c],i=!!e.$eval(f.disableChoiceExpression),t._uiSelectChoiceDisabled=i),i}},f.select=function(e,c,l){if(void 0===e||!e._uiSelectChoiceDisabled){if(!f.items&&!f.search)return;if(!e||!e._uiSelectChoiceDisabled){if(f.tagging.isActivated){if(f.taggingLabel===!1)if(f.activeIndex<0){if(e=void 0!==f.tagging.fct?f.tagging.fct(f.search):f.search,!e||angular.equals(f.items[0],e))return}else e=f.items[f.activeIndex];else if(0===f.activeIndex){if(void 0===e)return;if(void 0!==f.tagging.fct&&"string"==typeof e){if(e=f.tagging.fct(f.search),!e)return}else"string"==typeof e&&(e=e.replace(f.taggingLabel,"").trim())}if(f.selected&&angular.isArray(f.selected)&&f.selected.filter(function(t){return angular.equals(t,e)}).length>0)return f.close(c),void 0}var s={};s[f.parserResult.itemName]=e,f.multiple?(f.selected.push(e),f.sizeSearchInput()):f.selected=e,i(function(){f.onSelectCallback(t,{$item:e,$model:f.parserResult.modelMapper(t,s)})}),(!f.multiple||f.closeOnSelect)&&f.close(c),l&&"click"===l.type&&(f.clickTriggeredSelect=!0)}}},f.close=function(e){f.open&&(f.ngModel&&f.ngModel.$setTouched&&f.ngModel.$setTouched(),r(),f.open=!1,f.multiple||i(function(){f.focusser.prop("disabled",!1),e||f.focusser[0].focus()},0,!1))},f.setFocus=function(){f.focus||f.multiple||f.focusser[0].focus(),!f.focus&&f.multiple&&m[0].focus()},f.clear=function(e){f.select(void 0),e.stopPropagation(),f.focusser[0].focus()},f.toggle=function(e){f.open?(f.close(),e.preventDefault(),e.stopPropagation()):f.activate()},f.isLocked=function(e,t){var c,i=f.selected[t];return i&&!angular.isUndefined(f.lockChoiceExpression)&&(c=!!e.$eval(f.lockChoiceExpression),i._uiSelectChoiceLocked=c),c},f.removeChoice=function(e){var c=f.selected[e];if(!c._uiSelectChoiceLocked){var l={};l[f.parserResult.itemName]=c,f.selected.splice(e,1),f.activeMatchIndex=-1,f.sizeSearchInput(),i(function(){f.onRemoveCallback(t,{$item:c,$model:f.parserResult.modelMapper(t,l)})})}},f.getPlaceholder=function(){return f.multiple&&f.selected.length?void 0:f.placeholder};var b=null;f.sizeSearchInput=function(){var e=m[0],c=m.parent().parent()[0],l=function(){return c.clientWidth*!!e.offsetParent},s=function(t){if(0===t)return!1;var c=t-e.offsetLeft-10;return 50>c&&(c=t),m.css("width",c+"px"),!0};m.css("width","10px"),i(function(){null!==b||s(l())||(b=t.$watch(l,function(e){s(e)&&(b(),b=null)}))})},m.on("keydown",function(c){var l=c.which;t.$apply(function(){var t=!1,s=!1;if(f.multiple&&e.isHorizontalMovement(l)&&(t=u(l)),!t&&(f.items.length>0||f.tagging.isActivated)&&(t=o(l),f.taggingTokens.isActivated)){for(var a=0;a0&&(s=!0);s&&i(function(){m.triggerHandler("tagged");var t=f.search.replace(e.MAP[c.keyCode],"").trim();f.tagging.fct&&(t=f.tagging.fct(t)),t&&f.select(t,!0)})}t&&l!=e.TAB&&(c.preventDefault(),c.stopPropagation())}),e.isVerticalMovement(l)&&f.items.length>0&&h()}),m.on("paste",function(e){var t=e.originalEvent.clipboardData.getData("text/plain");if(t&&t.length>0&&f.taggingTokens.isActivated&&f.tagging.fct){var c=t.split(f.taggingTokens.tokens[0]);c&&c.length>0&&(angular.forEach(c,function(e){var t=f.tagging.fct(e);t&&f.select(t,!0)}),e.preventDefault(),e.stopPropagation())}}),m.on("keyup",function(c){if(e.isVerticalMovement(c.which)||t.$evalAsync(function(){f.activeIndex=f.taggingLabel===!1?-1:0}),f.tagging.isActivated&&f.search.length>0){if(c.which===e.TAB||e.isControl(c)||e.isFunctionKey(c)||c.which===e.ESC||e.isVerticalMovement(c.which))return;if(f.activeIndex=f.taggingLabel===!1?-1:0,f.taggingLabel===!1)return;var i,l,s,a,n=angular.copy(f.items),r=angular.copy(f.items),o=!1,u=-1;if(void 0!==f.tagging.fct){if(s=f.$filter("filter")(n,{isTag:!0}),s.length>0&&(a=s[0]),n.length>0&&a&&(o=!0,n=n.slice(1,n.length),r=r.slice(1,r.length)),i=f.tagging.fct(f.search),i.isTag=!0,r.filter(function(e){return angular.equals(e,f.tagging.fct(f.search))}).length>0)return;i.isTag=!0}else{if(s=f.$filter("filter")(n,function(e){return e.match(f.taggingLabel)}),s.length>0&&(a=s[0]),l=n[0],void 0!==l&&n.length>0&&a&&(o=!0,n=n.slice(1,n.length),r=r.slice(1,r.length)),i=f.search+" "+f.taggingLabel,p(f.selected,f.search)>-1)return;if(d(r.concat(f.selected)))return o&&(n=r,t.$evalAsync(function(){f.activeIndex=0,f.items=n})),void 0;if(d(r))return o&&(f.items=r.slice(1,r.length)),void 0}o&&(u=p(f.selected,i)),u>-1?n=n.slice(u+1,n.length-1):(n=[],n.push(i),n=n.concat(r)),t.$evalAsync(function(){f.activeIndex=0,f.items=n})}}),m.on("tagged",function(){i(function(){r()})}),m.on("blur",function(){i(function(){f.activeMatchIndex=-1})}),t.$on("$destroy",function(){m.off("keyup keydown tagged blur paste")})}]),c.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","$compile","$parse","$timeout",function(t,c,i,l,s,a){return{restrict:"EA",templateUrl:function(e,t){var i=t.theme||c.theme;return i+(angular.isDefined(t.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",link:function(n,r,o,u,d){function p(e){if(g.open){var t=!1;if(t=window.jQuery?window.jQuery.contains(r[0],e.target):r[0].contains(e.target),!t&&!g.clickTriggeredSelect){var c=["input","button","textarea"],i=angular.element(e.target).scope(),l=i&&i.$select&&i.$select!==g;l||(l=~c.indexOf(e.target.tagName.toLowerCase())),g.close(l),n.$digest()}g.clickTriggeredSelect=!1}}var g=u[0],h=u[1],f=r.querySelectorAll("input.ui-select-search");g.generatedId=c.generateId(),g.baseTitle=o.title||"Select box",g.focusserTitle=g.baseTitle+" focus",g.focusserId="focusser-"+g.generatedId,g.multiple=angular.isDefined(o.multiple)&&(""===o.multiple||"multiple"===o.multiple.toLowerCase()||"true"===o.multiple.toLowerCase()),g.closeOnSelect=function(){return angular.isDefined(o.closeOnSelect)?s(o.closeOnSelect)():c.closeOnSelect}(),g.onSelectCallback=s(o.onSelect),g.onRemoveCallback=s(o.onRemove),h.$parsers.unshift(function(e){var t,c={};if(g.multiple){for(var i=[],l=g.selected.length-1;l>=0;l--)c={},c[g.parserResult.itemName]=g.selected[l],t=g.parserResult.modelMapper(n,c),i.unshift(t);return i}return c={},c[g.parserResult.itemName]=e,t=g.parserResult.modelMapper(n,c)}),h.$formatters.unshift(function(e){var t,c=g.parserResult.source(n,{$select:{search:""}}),i={};if(c){if(g.multiple){var l=[],s=function(e,c){if(!e||!e.length)return l.unshift(c),!0;for(var s=e.length-1;s>=0;s--){if(i[g.parserResult.itemName]=e[s],t=g.parserResult.modelMapper(n,i),g.parserResult.trackByExp){var a=/\.(.+)/.exec(g.parserResult.trackByExp);if(a.length>0&&t[a[1]]==c[a[1]])return l.unshift(e[s]),!0}if(t==c)return l.unshift(e[s]),!0}return!1};if(!e)return l;for(var a=e.length-1;a>=0;a--)s(g.selected,e[a])||s(c,e[a]);return l}var r=function(c){return i[g.parserResult.itemName]=c,t=g.parserResult.modelMapper(n,i),t==e};if(g.selected&&r(g.selected))return g.selected;for(var o=c.length-1;o>=0;o--)if(r(c[o]))return c[o]}return e}),g.ngModel=h,g.choiceGrouped=function(e){return g.isGrouped&&e&&e.name};var v=angular.element("");o.tabindex&&o.$observe("tabindex",function(e){g.multiple?f.attr("tabindex",e):v.attr("tabindex",e),r.removeAttr("tabindex")}),l(v)(n),g.focusser=v,g.multiple||(r.append(v),v.bind("focus",function(){n.$evalAsync(function(){g.focus=!0})}),v.bind("blur",function(){n.$evalAsync(function(){g.focus=!1})}),v.bind("keydown",function(t){return t.which===e.BACKSPACE?(t.preventDefault(),t.stopPropagation(),g.select(void 0),n.$apply(),void 0):(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(),g.activate()),n.$digest()),void 0)}),v.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||(g.activate(v.val()),v.val(""),n.$digest())})),n.$watch("searchEnabled",function(){var e=n.$eval(o.searchEnabled);g.searchEnabled=void 0!==e?e:c.searchEnabled}),n.$watch("sortable",function(){var e=n.$eval(o.sortable);g.sortable=void 0!==e?e:c.sortable}),o.$observe("disabled",function(){g.disabled=void 0!==o.disabled?o.disabled:!1,g.sizeSearchInput()}),o.$observe("resetSearchInput",function(){var e=n.$eval(o.resetSearchInput);g.resetSearchInput=void 0!==e?e:!0}),o.$observe("tagging",function(){if(void 0!==o.tagging){var e=n.$eval(o.tagging);g.tagging={isActivated:!0,fct:e!==!0?e:void 0}}else g.tagging={isActivated:!1,fct:void 0}}),o.$observe("taggingLabel",function(){void 0!==o.tagging&&(g.taggingLabel="false"===o.taggingLabel?!1: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"];g.taggingTokens={isActivated:!0,tokens:e}}}),angular.isDefined(o.autofocus)&&a(function(){g.setFocus()}),angular.isDefined(o.focusOn)&&n.$on(o.focusOn,function(){a(function(){g.setFocus()})}),g.multiple?(n.$watchCollection(function(){return h.$modelValue},function(e,t){t!=e&&(h.$modelValue=null)}),g.firstPass=!0,n.$watchCollection("$select.selected",function(){g.firstPass?g.firstPass=!1:h.$setViewValue(Date.now())}),v.prop("disabled",!0)):n.$watch("$select.selected",function(e){h.$viewValue!==e&&h.$setViewValue(e)}),h.$render=function(){if(g.multiple&&!angular.isArray(h.$viewValue)){if(!angular.isUndefined(h.$viewValue)&&null!==h.$viewValue)throw i("multiarr","Expected model value to be array but got '{0}'",h.$viewValue);g.selected=[]}g.selected=h.$viewValue},t.on("click",p),n.$on("$destroy",function(){t.off("click",p)}),d(n,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);r.querySelectorAll(".ui-select-match").replaceWith(c);var l=t.querySelectorAll(".ui-select-choices");if(l.removeAttr("ui-select-choices"),l.removeAttr("data-ui-select-choices"),1!==l.length)throw i("transcluded","Expected 1 .ui-select-choices but got '{0}'.",l.length);r.querySelectorAll(".ui-select-choices").replaceWith(l)})}}}]),c.directive("uiSelectMatch",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){var c=t.parent().attr("theme")||e.theme,i=t.parent().attr("multiple");return c+(i?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,c,i,l){l.lockChoiceExpression=i.uiLockChoice,i.$observe("placeholder",function(t){l.placeholder=void 0!==t?t:e.placeholder}),l.allowClear=angular.isDefined(i.allowClear)?""===i.allowClear?!0:"true"===i.allowClear.toLowerCase():!1,l.multiple&&l.sizeSearchInput()}}}]),c.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,c){return{require:"^uiSelect",link:function(t,i,l,s){if(null===t[l.uiSelectSort])throw c("sort","Expected a list to sort");var a=angular.extend({axis:"horizontal"},t.$eval(l.uiSelectSortOptions)),n=a.axis,r="dragging",o="dropping",u="dropping-before",d="dropping-after";t.$watch(function(){return s.sortable},function(e){e?i.attr("draggable",!0):i.removeAttr("draggable")}),i.on("dragstart",function(e){i.addClass(r),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text/plain",t.$index)}),i.on("dragend",function(){i.removeClass(r)});var p,g=function(e,t){this.splice(t,0,this.splice(e,1)[0])},h=function(e){e.preventDefault();var t="vertical"===n?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/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/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/match.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]); \ No newline at end of file +!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 c=t.which;switch(c){case e.COMMAND:case e.SHIFT:case e.CTRL:case e.ALT:return!0}return t.metaKey?!0:!1},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)}};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],c=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(c.bind(t)(e))return t;t=t.parentElement}return!1});var t=0,c=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:!0,sortable:!1,placeholder:"",refreshDelay:1e3,closeOnSelect:!0,generateId:function(){return t++}}).service("uiSelectMinErr",function(){var e=angular.$$minErr("ui.select");return function(){var t=e.apply(this,arguments),c=t.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(c)}}).directive("uisTranscludeAppend",function(){return{link:function(e,t,c,i,l){l(e,function(e){t.append(e)})}}}).filter("highlight",function(){function e(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(t,c){return c&&t?t.replace(new RegExp(e(c),"gi"),'$&'):t}});c.service("RepeatParser",["uiSelectMinErr","$parse",function(e,t){var c=this;c.parse=function(c){var i=c.match(/^\s*(?:([\s\S]+?)\s+as\s+)?([\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!i)throw e("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",c);return{itemName:i[2],source:t(i[3]),trackByExp:i[4],modelMapper:t(i[1]||i[2])}},c.getGroupNgRepeatExpression=function(){return"$group in $select.groups"},c.getNgRepeatExpression=function(e,t,c,i){var l=e+" in "+(i?"$group.items":t);return c&&(l+=" track by "+c),l}}]),c.directive("uiSelectChoices",["uiSelectConfig","RepeatParser","uiSelectMinErr","$compile",function(e,t,c,i){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){var c=t.parent().attr("theme")||e.theme;return c+"/choices.tpl.html"},compile:function(l,s){if(!s.repeat)throw c("repeat","Expected 'repeat' expression.");return function(l,s,a,n,r){var o=a.groupBy;if(n.parseRepeatAttr(a.repeat,o),n.disableChoiceExpression=a.uiDisableChoice,n.onHighlightCallback=a.onHighlight,o){var u=s.querySelectorAll(".ui-select-choices-group");if(1!==u.length)throw c("rows","Expected 1 .ui-select-choices-group but got '{0}'.",u.length);u.attr("ng-repeat",t.getGroupNgRepeatExpression())}var d=s.querySelectorAll(".ui-select-choices-row");if(1!==d.length)throw c("rows","Expected 1 .ui-select-choices-row but got '{0}'.",d.length);d.attr("ng-repeat",t.getNgRepeatExpression(n.parserResult.itemName,"$select.items",n.parserResult.trackByExp,o)).attr("ng-if","$select.open").attr("ng-mouseenter","$select.setActiveItem("+n.parserResult.itemName+")").attr("ng-click","$select.select("+n.parserResult.itemName+",false,$event)");var p=s.querySelectorAll(".ui-select-choices-row-inner");if(1!==p.length)throw c("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",p.length);p.attr("uis-transclude-append",""),i(s,r)(l),l.$watch("$select.search",function(e){e&&!n.open&&n.multiple&&n.activate(!1,!0),n.activeIndex=n.tagging.isActivated?-1:0,n.refresh(a.refresh)}),a.$observe("refreshDelay",function(){var t=l.$eval(a.refreshDelay);n.refreshDelay=void 0!==t?t:e.refreshDelay})}}}}]),c.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","RepeatParser","uiSelectMinErr","uiSelectConfig",function(t,c,i,l,s,a,n){function r(){(f.resetSearchInput||void 0===f.resetSearchInput&&n.resetSearchInput)&&(f.search=v,f.selected&&f.items.length&&!f.multiple&&(f.activeIndex=f.items.indexOf(f.selected)))}function o(t){var c=!0;switch(t){case e.DOWN:!f.open&&f.multiple?f.activate(!1,!0):f.activeIndex0||0===f.search.length&&f.tagging.isActivated&&f.activeIndex>-1)&&f.activeIndex--;break;case e.TAB:(!f.multiple||f.open)&&f.select(f.items[f.activeIndex],!0);break;case e.ENTER:f.open&&f.activeIndex>=0?f.select(f.items[f.activeIndex]):f.activate(!1,!0);break;case e.ESC:f.close();break;default:c=!1}return c}function u(t){function c(){switch(t){case e.LEFT:return~f.activeMatchIndex?o:a;case e.RIGHT:return~f.activeMatchIndex&&n!==a?r:(f.activate(),!1);case e.BACKSPACE:return~f.activeMatchIndex?(f.removeChoice(n),o):a;case e.DELETE:return~f.activeMatchIndex?(f.removeChoice(f.activeMatchIndex),n):!1}}var i=g(m[0]),l=f.selected.length,s=0,a=l-1,n=f.activeMatchIndex,r=f.activeMatchIndex+1,o=f.activeMatchIndex-1,u=n;return i>0||f.search.length&&t==e.RIGHT?!1:(f.close(),u=c(),f.activeMatchIndex=f.selected.length&&u!==!1?Math.min(a,Math.max(s,u)):-1,!0)}function d(e){if(void 0===e||void 0===f.search)return!1;var t=e.filter(function(e){return void 0===f.search.toUpperCase()||void 0===e?!1:e.toUpperCase()===f.search.toUpperCase()}).length>0;return t}function p(e,t){var c=-1;if(angular.isArray(e))for(var i=angular.copy(e),l=0;ls?e[0].scrollTop+=l-s:l=f.items.length?0:f.activeIndex,-1===f.activeIndex&&f.taggingLabel!==!1&&(f.activeIndex=0),i(function(){f.search=e||f.search,m[0].focus()}))},f.findGroupByName=function(e){return f.groups&&f.groups.filter(function(t){return t.name===e})[0]},f.parseRepeatAttr=function(e,c){function i(e){f.groups=[],angular.forEach(e,function(e){var i=t.$eval(c),l=angular.isFunction(i)?i(e):e[i],s=f.findGroupByName(l);s?s.items.push(e):f.groups.push({name:l,items:[e]})}),f.items=[],f.groups.forEach(function(e){f.items=f.items.concat(e.items)})}function l(e){f.items=e}var n=c?i:l;f.parserResult=s.parse(e),f.isGrouped=!!c,f.itemProperty=f.parserResult.itemName,t.$watchCollection(f.parserResult.source,function(e){if(void 0===e||null===e)f.items=[];else{if(!angular.isArray(e))throw a("items","Expected an array but got '{0}'.",e);if(f.multiple){var t=e.filter(function(e){return f.selected.indexOf(e)<0});n(t)}else n(e);f.ngModel.$modelValue=null}}),f.multiple&&t.$watchCollection("$select.selected",function(e){var c=f.parserResult.source(t);if(e.length){if(void 0!==c){var i=c.filter(function(t){return e.indexOf(t)<0});n(i)}}else n(c);f.sizeSearchInput()})};var $;f.refresh=function(e){void 0!==e&&($&&i.cancel($),$=i(function(){t.$eval(e)},f.refreshDelay))},f.setActiveItem=function(e){f.activeIndex=f.items.indexOf(e)},f.isActive=function(e){if(!f.open)return!1;var t=f.items.indexOf(e[f.itemProperty]),c=t===f.activeIndex;return!c||0>t&&f.taggingLabel!==!1||0>t&&f.taggingLabel===!1?!1:(c&&!angular.isUndefined(f.onHighlightCallback)&&e.$eval(f.onHighlightCallback),c)},f.isDisabled=function(e){if(f.open){var t,c=f.items.indexOf(e[f.itemProperty]),i=!1;return c>=0&&!angular.isUndefined(f.disableChoiceExpression)&&(t=f.items[c],i=!!e.$eval(f.disableChoiceExpression),t._uiSelectChoiceDisabled=i),i}},f.select=function(e,c,l){if(void 0===e||!e._uiSelectChoiceDisabled){if(!f.items&&!f.search)return;if(!e||!e._uiSelectChoiceDisabled){if(f.tagging.isActivated){if(f.taggingLabel===!1)if(f.activeIndex<0){if(e=void 0!==f.tagging.fct?f.tagging.fct(f.search):f.search,!e||angular.equals(f.items[0],e))return}else e=f.items[f.activeIndex];else if(0===f.activeIndex){if(void 0===e)return;if(void 0!==f.tagging.fct&&"string"==typeof e){if(e=f.tagging.fct(f.search),!e)return}else"string"==typeof e&&(e=e.replace(f.taggingLabel,"").trim())}if(f.selected&&angular.isArray(f.selected)&&f.selected.filter(function(t){return angular.equals(t,e)}).length>0)return f.close(c),void 0}var s={};s[f.parserResult.itemName]=e,f.multiple?(f.selected.push(e),f.sizeSearchInput()):f.selected=e,i(function(){f.onSelectCallback(t,{$item:e,$model:f.parserResult.modelMapper(t,s)})}),(!f.multiple||f.closeOnSelect)&&f.close(c),l&&"click"===l.type&&(f.clickTriggeredSelect=!0)}}},f.close=function(e){f.open&&(f.ngModel&&f.ngModel.$setTouched&&f.ngModel.$setTouched(),r(),f.open=!1,f.multiple||i(function(){f.focusser.prop("disabled",!1),e||f.focusser[0].focus()},0,!1))},f.setFocus=function(){f.focus||f.multiple||f.focusser[0].focus(),!f.focus&&f.multiple&&m[0].focus()},f.clear=function(e){f.select(void 0),e.stopPropagation(),f.focusser[0].focus()},f.toggle=function(e){f.open?(f.close(),e.preventDefault(),e.stopPropagation()):f.activate()},f.isLocked=function(e,t){var c,i=f.selected[t];return i&&!angular.isUndefined(f.lockChoiceExpression)&&(c=!!e.$eval(f.lockChoiceExpression),i._uiSelectChoiceLocked=c),c},f.removeChoice=function(e){var c=f.selected[e];if(!c._uiSelectChoiceLocked){var l={};l[f.parserResult.itemName]=c,f.selected.splice(e,1),f.activeMatchIndex=-1,f.sizeSearchInput(),i(function(){f.onRemoveCallback(t,{$item:c,$model:f.parserResult.modelMapper(t,l)})})}},f.getPlaceholder=function(){return f.multiple&&f.selected.length?void 0:f.placeholder};var b=null;f.sizeSearchInput=function(){var e=m[0],c=m.parent().parent()[0],l=function(){return c.clientWidth*!!e.offsetParent},s=function(t){if(0===t)return!1;var c=t-e.offsetLeft-10;return 50>c&&(c=t),m.css("width",c+"px"),!0};m.css("width","10px"),i(function(){null!==b||s(l())||(b=t.$watch(l,function(e){s(e)&&(b(),b=null)}))})},m.on("keydown",function(c){var l=c.which;t.$apply(function(){var t=!1,s=!1;if(f.multiple&&e.isHorizontalMovement(l)&&(t=u(l)),!t&&(f.items.length>0||f.tagging.isActivated)&&(t=o(l),f.taggingTokens.isActivated)){for(var a=0;a0&&(s=!0);s&&i(function(){m.triggerHandler("tagged");var t=f.search.replace(e.MAP[c.keyCode],"").trim();f.tagging.fct&&(t=f.tagging.fct(t)),t&&f.select(t,!0)})}t&&l!=e.TAB&&(c.preventDefault(),c.stopPropagation())}),e.isVerticalMovement(l)&&f.items.length>0&&h()}),m.on("paste",function(e){var t=e.originalEvent.clipboardData.getData("text/plain");if(t&&t.length>0&&f.taggingTokens.isActivated&&f.tagging.fct){var c=t.split(f.taggingTokens.tokens[0]);c&&c.length>0&&(angular.forEach(c,function(e){var t=f.tagging.fct(e);t&&f.select(t,!0)}),e.preventDefault(),e.stopPropagation())}}),m.on("keyup",function(c){if(e.isVerticalMovement(c.which)||t.$evalAsync(function(){f.activeIndex=f.taggingLabel===!1?-1:0}),f.tagging.isActivated&&f.search.length>0){if(c.which===e.TAB||e.isControl(c)||e.isFunctionKey(c)||c.which===e.ESC||e.isVerticalMovement(c.which))return;if(f.activeIndex=f.taggingLabel===!1?-1:0,f.taggingLabel===!1)return;var i,l,s,a,n=angular.copy(f.items),r=angular.copy(f.items),o=!1,u=-1;if(void 0!==f.tagging.fct){if(s=f.$filter("filter")(n,{isTag:!0}),s.length>0&&(a=s[0]),n.length>0&&a&&(o=!0,n=n.slice(1,n.length),r=r.slice(1,r.length)),i=f.tagging.fct(f.search),i.isTag=!0,r.filter(function(e){return angular.equals(e,f.tagging.fct(f.search))}).length>0)return;i.isTag=!0}else{if(s=f.$filter("filter")(n,function(e){return e.match(f.taggingLabel)}),s.length>0&&(a=s[0]),l=n[0],void 0!==l&&n.length>0&&a&&(o=!0,n=n.slice(1,n.length),r=r.slice(1,r.length)),i=f.search+" "+f.taggingLabel,p(f.selected,f.search)>-1)return;if(d(r.concat(f.selected)))return o&&(n=r,t.$evalAsync(function(){f.activeIndex=0,f.items=n})),void 0;if(d(r))return o&&(f.items=r.slice(1,r.length)),void 0}o&&(u=p(f.selected,i)),u>-1?n=n.slice(u+1,n.length-1):(n=[],n.push(i),n=n.concat(r)),t.$evalAsync(function(){f.activeIndex=0,f.items=n})}}),m.on("tagged",function(){i(function(){r()})}),m.on("blur",function(){i(function(){f.activeMatchIndex=-1})}),t.$on("$destroy",function(){m.off("keyup keydown tagged blur paste")})}]),c.directive("uiSelect",["$document","uiSelectConfig","uiSelectMinErr","$compile","$parse","$timeout",function(t,c,i,l,s,a){return{restrict:"EA",templateUrl:function(e,t){var i=t.theme||c.theme;return i+(angular.isDefined(t.multiple)?"/select-multiple.tpl.html":"/select.tpl.html")},replace:!0,transclude:!0,require:["uiSelect","^ngModel"],scope:!0,controller:"uiSelectCtrl",controllerAs:"$select",link:function(n,r,o,u,d){function p(e){if(g.open){var t=!1;if(t=window.jQuery?window.jQuery.contains(r[0],e.target):r[0].contains(e.target),!t&&!g.clickTriggeredSelect){var c=["input","button","textarea"],i=angular.element(e.target).scope(),l=i&&i.$select&&i.$select!==g;l||(l=~c.indexOf(e.target.tagName.toLowerCase())),g.close(l),n.$digest()}g.clickTriggeredSelect=!1}}var g=u[0],h=u[1],f=r.querySelectorAll("input.ui-select-search");g.generatedId=c.generateId(),g.baseTitle=o.title||"Select box",g.focusserTitle=g.baseTitle+" focus",g.focusserId="focusser-"+g.generatedId,g.multiple=angular.isDefined(o.multiple)&&(""===o.multiple||"multiple"===o.multiple.toLowerCase()||"true"===o.multiple.toLowerCase()),g.closeOnSelect=function(){return angular.isDefined(o.closeOnSelect)?s(o.closeOnSelect)():c.closeOnSelect}(),g.onSelectCallback=s(o.onSelect),g.onRemoveCallback=s(o.onRemove),h.$parsers.unshift(function(e){var t,c={};if(g.multiple){for(var i=[],l=g.selected.length-1;l>=0;l--)c={},c[g.parserResult.itemName]=g.selected[l],t=g.parserResult.modelMapper(n,c),i.unshift(t);return i}return c={},c[g.parserResult.itemName]=e,t=g.parserResult.modelMapper(n,c)}),h.$formatters.unshift(function(e){var t,c=g.parserResult.source(n,{$select:{search:""}}),i={};if(c){if(g.multiple){var l=[],s=function(e,c){if(!e||!e.length)return l.unshift(c),!0;for(var s=e.length-1;s>=0;s--){if(i[g.parserResult.itemName]=e[s],t=g.parserResult.modelMapper(n,i),g.parserResult.trackByExp){var a=/\.(.+)/.exec(g.parserResult.trackByExp);if(a.length>0&&t[a[1]]==c[a[1]])return l.unshift(e[s]),!0}if(t==c)return l.unshift(e[s]),!0}return!1};if(!e)return l;for(var a=e.length-1;a>=0;a--)s(g.selected,e[a])||s(c,e[a]);return l}var r=function(c){return i[g.parserResult.itemName]=c,t=g.parserResult.modelMapper(n,i),t==e};if(g.selected&&r(g.selected))return g.selected;for(var o=c.length-1;o>=0;o--)if(r(c[o]))return c[o]}return e}),g.ngModel=h,g.choiceGrouped=function(e){return g.isGrouped&&e&&e.name};var v=angular.element("");o.tabindex&&o.$observe("tabindex",function(e){g.multiple?f.attr("tabindex",e):v.attr("tabindex",e),r.removeAttr("tabindex")}),l(v)(n),g.focusser=v,g.multiple||(r.append(v),v.bind("focus",function(){n.$evalAsync(function(){g.focus=!0})}),v.bind("blur",function(){n.$evalAsync(function(){g.focus=!1})}),v.bind("keydown",function(t){return t.which===e.BACKSPACE?(t.preventDefault(),t.stopPropagation(),g.select(void 0),n.$apply(),void 0):(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(),g.activate()),n.$digest()),void 0)}),v.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||(g.activate(v.val()),v.val(""),n.$digest())})),n.$watch("searchEnabled",function(){var e=n.$eval(o.searchEnabled);g.searchEnabled=void 0!==e?e:c.searchEnabled}),n.$watch("sortable",function(){var e=n.$eval(o.sortable);g.sortable=void 0!==e?e:c.sortable}),o.$observe("disabled",function(){g.disabled=void 0!==o.disabled?o.disabled:!1,g.multiple&&g.sizeSearchInput()}),o.$observe("resetSearchInput",function(){var e=n.$eval(o.resetSearchInput);g.resetSearchInput=void 0!==e?e:!0}),o.$observe("tagging",function(){if(void 0!==o.tagging){var e=n.$eval(o.tagging);g.tagging={isActivated:!0,fct:e!==!0?e:void 0}}else g.tagging={isActivated:!1,fct:void 0}}),o.$observe("taggingLabel",function(){void 0!==o.tagging&&(g.taggingLabel="false"===o.taggingLabel?!1: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"];g.taggingTokens={isActivated:!0,tokens:e}}}),angular.isDefined(o.autofocus)&&a(function(){g.setFocus()}),angular.isDefined(o.focusOn)&&n.$on(o.focusOn,function(){a(function(){g.setFocus()})}),g.multiple?(n.$watchCollection(function(){return h.$modelValue},function(e,t){t!=e&&(h.$modelValue=null)}),g.firstPass=!0,n.$watchCollection("$select.selected",function(){g.firstPass?g.firstPass=!1:h.$setViewValue(Date.now())}),v.prop("disabled",!0)):n.$watch("$select.selected",function(e){h.$viewValue!==e&&h.$setViewValue(e)}),h.$render=function(){if(g.multiple&&!angular.isArray(h.$viewValue)){if(!angular.isUndefined(h.$viewValue)&&null!==h.$viewValue)throw i("multiarr","Expected model value to be array but got '{0}'",h.$viewValue);g.selected=[]}g.selected=h.$viewValue},t.on("click",p),n.$on("$destroy",function(){t.off("click",p)}),d(n,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);r.querySelectorAll(".ui-select-match").replaceWith(c);var l=t.querySelectorAll(".ui-select-choices");if(l.removeAttr("ui-select-choices"),l.removeAttr("data-ui-select-choices"),1!==l.length)throw i("transcluded","Expected 1 .ui-select-choices but got '{0}'.",l.length);r.querySelectorAll(".ui-select-choices").replaceWith(l)})}}}]),c.directive("uiSelectMatch",["uiSelectConfig",function(e){return{restrict:"EA",require:"^uiSelect",replace:!0,transclude:!0,templateUrl:function(t){var c=t.parent().attr("theme")||e.theme,i=t.parent().attr("multiple");return c+(i?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(t,c,i,l){l.lockChoiceExpression=i.uiLockChoice,i.$observe("placeholder",function(t){l.placeholder=void 0!==t?t:e.placeholder}),l.allowClear=angular.isDefined(i.allowClear)?""===i.allowClear?!0:"true"===i.allowClear.toLowerCase():!1,l.multiple&&l.sizeSearchInput()}}}]),c.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function(e,t,c){return{require:"^uiSelect",link:function(t,i,l,s){if(null===t[l.uiSelectSort])throw c("sort","Expected a list to sort");var a=angular.extend({axis:"horizontal"},t.$eval(l.uiSelectSortOptions)),n=a.axis,r="dragging",o="dropping",u="dropping-before",d="dropping-after";t.$watch(function(){return s.sortable},function(e){e?i.attr("draggable",!0):i.removeAttr("draggable")}),i.on("dragstart",function(e){i.addClass(r),(e.dataTransfer||e.originalEvent.dataTransfer).setData("text/plain",t.$index)}),i.on("dragend",function(){i.removeClass(r)});var p,g=function(e,t){this.splice(t,0,this.splice(e,1)[0])},h=function(e){e.preventDefault();var t="vertical"===n?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/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/select-multiple.tpl.html",'
    '),e.put("select2/select.tpl.html",'
    '),e.put("selectize/choices.tpl.html",'
    '),e.put("selectize/match.tpl.html",'
    '),e.put("selectize/select.tpl.html",'
    ')}]); \ No newline at end of file diff --git a/package.json b/package.json index 16b45da83..7c03e5ddd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "repository": { "url": "git://github.com/angular-ui/ui-select.git" }, - "version": "0.11.0", + "version": "0.11.1", "devDependencies": { "bower": "~1.3", "del": "~0.1.1",