From e05041527ed459fed4710c498e551e0fd74d3cf1 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Wed, 7 Dec 2016 11:50:54 +0500 Subject: [PATCH 01/10] commit --- README.md | 57 +-------------------------- npm-debug.log | 104 -------------------------------------------------- 2 files changed, 1 insertion(+), 160 deletions(-) delete mode 100644 npm-debug.log diff --git a/README.md b/README.md index 71e423934..53f9dd227 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,2 @@ -# AngularJS ui-select [![Build Status](https://travis-ci.org/angular-ui/ui-select.svg?branch=master)](https://travis-ci.org/angular-ui/ui-select) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-select?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# Fork of AngularJS ui-select [](https://github.com/angular-ui/ui-select) -AngularJS-native version of [Select2](http://ivaynberg.github.io/select2/) and [Selectize](http://brianreavis.github.io/selectize.js/). [http://angular-ui.github.io/ui-select/](http://angular-ui.github.io/ui-select/) - -[Getting Started](https://github.com/angular-ui/ui-select/wiki/Getting-Started) - -- [Examples](http://angular-ui.github.io/ui-select/#examples) -- [Examples Source](./docs/examples) -- [Documentation](https://github.com/angular-ui/ui-select/wiki) - -## Latest Changes - -- Check [CHANGELOG.md](/CHANGELOG.md) - -## Features - -- Search, Select, Multi-select and Tagging -- Multiple Themes: Bootstrap, Select2 and Selectize -- Keyboard support -- No jQuery required (except for old browsers) -- Small code base: 4.57KB min/gzipped vs 20KB for select2 - -For the roadmap, check [issue #3](https://github.com/angular-ui/ui-select/issues/3) and the [Wiki page](https://github.com/angular-ui/ui-select/wiki/Roadmap). - -## Installation Methods - -### npm -``` -$ npm install ui-select -``` -### bower -``` -$ bower install angular-ui-select -``` - -## Development - -### Prepare your environment -* Install [Node.js](http://nodejs.org/) and NPM (should come with) -* Install global dev dependencies: `npm install -g gulp` -* Install local dev dependencies: `npm install` in repository directory - -### Development Commands - -* `gulp` to jshint, build and test -* `gulp build` to jshint and build -* `gulp test` for one-time test with karma (also build and jshint) -* `gulp watch` to watch src files to jshint, build and test when changed -* `gulp docs` build docs and examples - -## Contributing - -- Check [CONTRIBUTING.md](/CONTRIBUTING.md) -- Run the tests -- Try the [examples](./docs/examples) - -When issuing a pull request, please exclude changes from the "dist" folder to avoid merge conflicts. diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index b55ede2cc..000000000 --- a/npm-debug.log +++ /dev/null @@ -1,104 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ '/usr/local/bin/node', -1 verbose cli '/usr/local/bin/npm', -1 verbose cli 'unpublish', -1 verbose cli 'ui-select@0.19.5' ] -2 info using npm@2.14.4 -3 info using node@v4.1.1 -4 silly unpublish args[0] ui-select@0.19.5 -5 silly unpublish thing Result { -5 silly unpublish raw: 'ui-select@0.19.5', -5 silly unpublish scope: null, -5 silly unpublish name: 'ui-select', -5 silly unpublish rawSpec: '0.19.5', -5 silly unpublish spec: '0.19.5', -5 silly unpublish type: 'version' } -6 verbose getPublishConfig null -7 silly ls normalized ui-select/0.19.5 -8 silly gentlyRm /Users/arob35/.npm/ui-select/0.19.5 is being purged -9 verbose gentlyRm don't care about contents; nuking /Users/arob35/.npm/ui-select/0.19.5 -10 silly vacuum-fs purging /Users/arob35/.npm/ui-select/0.19.5 -11 silly vacuum-fs quitting because other entries in /Users/arob35/.npm/ui-select -12 silly mapToRegistry name ui-select -13 silly mapToRegistry using default registry -14 silly mapToRegistry registry https://registry.npmjs.org/ -15 silly mapToRegistry uri https://registry.npmjs.org/ui-select -16 verbose get GET as part of write; not caching result -17 verbose request uri https://registry.npmjs.org/ui-select?write=true -18 verbose request no auth needed -19 info attempt registry request try #1 at 4:15:12 PM -20 verbose request using bearer token for auth -21 verbose request id 5ca39f33f3f44109 -22 http request GET https://registry.npmjs.org/ui-select?write=true -23 http 200 https://registry.npmjs.org/ui-select?write=true -24 silly get cb [ 200, -24 silly get { server: 'CouchDB/1.6.1 (Erlang OTP/R16B03)', -24 silly get etag: '"3PFJ7OP67OCII47YIYGTYZUSW"', -24 silly get 'content-type': 'application/json', -24 silly get 'content-encoding': 'gzip', -24 silly get 'cache-control': 'max-age=0', -24 silly get 'transfer-encoding': 'chunked', -24 silly get 'accept-ranges': 'bytes', -24 silly get date: 'Mon, 24 Oct 2016 23:15:11 GMT', -24 silly get via: '1.1 varnish', -24 silly get connection: 'keep-alive', -24 silly get 'x-served-by': 'cache-den6025-DEN', -24 silly get 'x-cache': 'MISS', -24 silly get 'x-cache-hits': '0', -24 silly get 'x-timer': 'S1477350911.526110,VS0,VE239', -24 silly get vary: 'Accept-Encoding' } ] -25 verbose get saving ui-select to /Users/arob35/.npm/registry.npmjs.org/ui-select_3Fwrite_3Dtrue/.cache.json -26 verbose unpublish removing attachments { shasum: '95662d8e086ab7800553a9f11cf24523dcf8d7da', -26 verbose unpublish tarball: 'http://registry.npmjs.org/ui-select/-/ui-select-0.19.5.tgz' } -27 verbose request uri https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -28 verbose request sending authorization for write operation -29 info attempt registry request try #1 at 4:15:12 PM -30 verbose request using bearer token for auth -31 http request PUT https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -32 http 500 https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -33 info retry will retry, error on last attempt: Error: "cannot unpublish a version that is >24 hours old" : ui-select -34 info attempt registry request try #2 at 4:15:24 PM -35 verbose request using bearer token for auth -36 http request PUT https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -37 http 500 https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -38 info retry will retry, error on last attempt: Error: "cannot unpublish a version that is >24 hours old" : ui-select -39 info attempt registry request try #3 at 4:16:25 PM -40 verbose request using bearer token for auth -41 http request PUT https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -42 http 500 https://registry.npmjs.org/ui-select/-rev/33-46749c4a981bb9aba3d0bb0008a0117a -43 verbose headers { 'content-type': 'application/json', -43 verbose headers 'cache-control': 'max-age=0', -43 verbose headers 'content-length': '80', -43 verbose headers 'accept-ranges': 'bytes', -43 verbose headers date: 'Mon, 24 Oct 2016 23:16:25 GMT', -43 verbose headers via: '1.1 varnish', -43 verbose headers connection: 'keep-alive', -43 verbose headers 'x-served-by': 'cache-dfw1830-DFW', -43 verbose headers 'x-cache': 'MISS', -43 verbose headers 'x-cache-hits': '0', -43 verbose headers 'x-timer': 'S1477350984.944033,VS0,VE923' } -44 verbose request invalidating /Users/arob35/.npm/registry.npmjs.org/ui-select on PUT -45 error unpublish Failed to update data -46 verbose stack Error: "cannot unpublish a version that is >24 hours old" : ui-select -46 verbose stack at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:263:12) -46 verbose stack at CachingRegistryClient. (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:251:14) -46 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:171:14) -46 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:198:22) -46 verbose stack at emitTwo (events.js:87:13) -46 verbose stack at Request.emit (events.js:172:7) -46 verbose stack at Request. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1073:14) -46 verbose stack at emitOne (events.js:82:20) -46 verbose stack at Request.emit (events.js:169:7) -46 verbose stack at IncomingMessage. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1019:12) -47 verbose statusCode 500 -48 verbose pkgid ui-select -49 verbose cwd /Users/arob35/Sites/forks/ui-select -50 error Darwin 15.6.0 -51 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "unpublish" "ui-select@0.19.5" -52 error node v4.1.1 -53 error npm v2.14.4 -54 error code E500 -55 error "cannot unpublish a version that is >24 hours old" : ui-select -56 error If you need help, you may report this error at: -56 error -57 verbose exit [ 1, true ] From 41ce2e26f8fc471ce8eec0436c443ff2f77fc1f4 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Wed, 7 Dec 2016 12:05:57 +0500 Subject: [PATCH 02/10] commit --- README.md | 7 +++++++ dist/select.js | 52 +++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 53f9dd227..9921240a7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # Fork of AngularJS ui-select [](https://github.com/angular-ui/ui-select) +Шаблоны под materializecss.com - dist/materialize/ + +Заблокированы шаблоны bootstrap, selectize, select2 + +Типовая разработка не пошла, поэтому тупо правка dist/select.js, потом вручную + +`uglifyjs -v dist/select.js > dist/select.min.js` \ No newline at end of file diff --git a/dist/select.js b/dist/select.js index 6061799e1..e8e1948b7 100644 --- a/dist/select.js +++ b/dist/select.js @@ -242,9 +242,9 @@ uis.directive('uiSelectChoices', $select.dropdownPosition = attrs.position ? attrs.position.toLowerCase() : uiSelectConfig.dropdownPosition; - scope.$on('$destroy', function() { - choices.remove(); - }); + //~ scope.$on('$destroy', function() { + //~ choices.remove(); + //~ }); scope.$watch('$select.search', function(newValue) { if(newValue && !$select.open && $select.multiple) $select.activate(false, true); @@ -264,9 +264,9 @@ uis.directive('uiSelectChoices', scope.$watch('$select.open', function(open) { if (open) { - tElement.attr('role', 'listbox'); + element.attr('role', 'listbox'); } else { - tElement.removeAttr('role'); + element.removeAttr('role'); } }); }; @@ -828,7 +828,7 @@ uis.controller('uiSelectCtrl', return true; }; - ctrl.searchInput.css('width', '10px'); + //~ ctrl.searchInput.css('width', '10px');///!!!! хрень!!! $timeout(function() { //Give tags time to render correctly if (sizeWatch === null && !updateIfVisible(calculateContainerWidth())) { sizeWatch = $scope.$watch(function() { @@ -1356,8 +1356,8 @@ uis.directive('uiSelect', offset = offset || uisOffset(element); offsetDropdown = offsetDropdown || uisOffset(dropdown); - dropdown[0].style.position = 'absolute'; - dropdown[0].style.top = (offsetDropdown.height * -1) + 'px'; + //~ dropdown[0].style.position = 'absolute'; + //~ dropdown[0].style.top = (offsetDropdown.height * -1) + 'px'; element.addClass(directionUpClassName); }; @@ -2373,21 +2373,21 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE }]); }()); -angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
    0\">
  • 0\">
"); -$templateCache.put("bootstrap/match-multiple.tpl.html"," × "); -$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("select2/choices.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("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 +//~ angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
      0\">
    • 0\">
    "); +//~ $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); +//~ $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("select2/choices.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("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 From 77e850f91c4c89efcf0742c88944e0b583416375 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Wed, 7 Dec 2016 12:06:48 +0500 Subject: [PATCH 03/10] commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9921240a7..aa4d4d1b5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Fork of AngularJS ui-select [](https://github.com/angular-ui/ui-select) +# Fork of [AngularJS ui-select](https://github.com/angular-ui/ui-select) Шаблоны под materializecss.com - dist/materialize/ From b408f756f15dfcf0d3060dba1a377c1f148b7c67 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Wed, 7 Dec 2016 12:42:22 +0500 Subject: [PATCH 04/10] commit --- dist/from-boostrap.css | 38 +++++++++++++++++++++++ dist/materialize/choices.tpl.html | 13 ++++++++ dist/materialize/match-multiple.tpl.html | 2 ++ dist/materialize/match.tpl.html | 12 +++++++ dist/materialize/no-choice.tpl.html | 3 ++ dist/materialize/select-multiple.tpl.html | 8 +++++ dist/materialize/select.tpl.html | 8 +++++ dist/select.min.js | 11 ++----- 8 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 dist/from-boostrap.css create mode 100644 dist/materialize/choices.tpl.html create mode 100644 dist/materialize/match-multiple.tpl.html create mode 100644 dist/materialize/match.tpl.html create mode 100644 dist/materialize/no-choice.tpl.html create mode 100644 dist/materialize/select-multiple.tpl.html create mode 100644 dist/materialize/select.tpl.html diff --git a/dist/from-boostrap.css b/dist/from-boostrap.css new file mode 100644 index 000000000..4ca0caf6d --- /dev/null +++ b/dist/from-boostrap.css @@ -0,0 +1,38 @@ +.ui-select-match { + +} + +.ui-select-match-text { + border-bottom: 1px solid; + cursor:pointer; +} + +/* copy-paste from the bootstrap.css */ + +.dropdown { + position: relative; +} + +.dropdown-menu { + background-clip: padding-box; + background-color: #fff; + border: 1px solid rgba(0, 0, 0, 0.15); + /*border-radius: 4px;*/ + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176); + display: none; + float: left; + /*font-size: 14px;*/ + left: 0; + list-style: outside none none; + margin: 2px 0 0; + min-width: 160px; + padding: 5px 0; + position: absolute; + top: 100%; + z-index: 1000; +} + + +.open > .dropdown-menu { + display: block; +} diff --git a/dist/materialize/choices.tpl.html b/dist/materialize/choices.tpl.html new file mode 100644 index 000000000..ec5261c89 --- /dev/null +++ b/dist/materialize/choices.tpl.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/dist/materialize/match-multiple.tpl.html b/dist/materialize/match-multiple.tpl.html new file mode 100644 index 000000000..c5139d328 --- /dev/null +++ b/dist/materialize/match-multiple.tpl.html @@ -0,0 +1,2 @@ + × + \ No newline at end of file diff --git a/dist/materialize/match.tpl.html b/dist/materialize/match.tpl.html new file mode 100644 index 000000000..1da23c445 --- /dev/null +++ b/dist/materialize/match.tpl.html @@ -0,0 +1,12 @@ +
    + + {{$select.placeholder}} + + + + + + + + +
    \ No newline at end of file diff --git a/dist/materialize/no-choice.tpl.html b/dist/materialize/no-choice.tpl.html new file mode 100644 index 000000000..4772912fa --- /dev/null +++ b/dist/materialize/no-choice.tpl.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/dist/materialize/select-multiple.tpl.html b/dist/materialize/select-multiple.tpl.html new file mode 100644 index 000000000..53f89be66 --- /dev/null +++ b/dist/materialize/select-multiple.tpl.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/dist/materialize/select.tpl.html b/dist/materialize/select.tpl.html new file mode 100644 index 000000000..dd107c7d9 --- /dev/null +++ b/dist/materialize/select.tpl.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/dist/select.min.js b/dist/select.min.js index 88526eb03..1c364b4f5 100644 --- a/dist/select.min.js +++ b/dist/select.min.js @@ -1,9 +1,2 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.5 - 2016-10-24T23:13:59.434Z - * 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 s=t.which;switch(s){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 s={ENTER:"\n",TAB:" ",SPACE:" "}[t];return s?s: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],s=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;){if(s.bind(t)(e))return t;t=t.parentElement}return!1});var t=0,s=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,spinnerEnabled:!1,spinnerClass:"glyphicon-refresh ui-select-spin"}).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)}}}]);s.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.dropdownPosition=c.position?c.position.toLowerCase():e.dropdownPosition,t.$on("$destroy",function(){u.remove()}),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"):i.removeAttr("role")})}}}}]),s.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function(t,s,i,c,n,l,a,r,o,u,d){function p(e,t,s){if(e.findIndex)return e.findIndex(t,s);for(var i,c=Object(e),n=c.length>>>0,l=0;n>l;l++)if(i=c[l],t.call(s,i,l,c))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 s,i,c=[];for(s=0;s-1&&S.splice(s,1)}function v(e){return S.indexOf(e)>-1}function $(e){function t(e,t){var s=i.indexOf(e);t&&-1===s&&i.push(e),!t&&s>-1&&i.splice(s,0)}function s(e){return i.indexOf(e)>-1}if(e){var i=[];w.isLocked=function(e,i){var c=!1,n=w.selected[i];return n&&(e?(c=!!e.$eval(w.lockChoiceExpression),t(n,c)):c=s(n)),c}}}function m(t){var s=!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:s=!1}return s}function b(){var e=s.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 i=t[w.activeIndex],c=i.offsetTop+i.clientHeight-e[0].scrollTop,n=e[0].offsetHeight;c>n?e[0].scrollTop+=c-n:c=w.items.length?0:w.activeIndex,-1===w.activeIndex&&w.taggingLabel!==!1&&(w.activeIndex=0);var n=s.querySelectorAll(".ui-select-choices-content"),l=s.querySelectorAll(".ui-select-search");if(w.$animate&&w.$animate.on&&w.$animate.enabled(n[0])){var a=function(t,s){"start"===s&&0===w.items.length?(w.$animate.off("removeClass",l[0],a),i(function(){w.focusSearchInput(e)})):"close"===s&&(w.$animate.off("enter",n[0],a),i(function(){w.focusSearchInput(e)}))};w.items.length>0?w.$animate.on("enter",n[0],a):w.$animate.on("removeClass",l[0],a)}else i(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,s,i){function c(e){var c=t.$eval(s);if(w.groups=[],angular.forEach(e,function(e){var t=angular.isFunction(c)?c(e):e[c],s=w.findGroupByName(t);s?s.items.push(e):w.groups.push({name:t,items:[e]})}),i){var n=t.$eval(i);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=s?c:n,w.parserResult=l.parse(e),w.isGrouped=!!s,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 s={};return s[w.parserResult.keyName]=t,s.value=e[t],s})};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 s=w.selected;if(w.isEmpty()||angular.isArray(s)&&!s.length||!w.multiple||!w.removeSelected)w.setItemsFn(e);else if(void 0!==e&&null!==e){var i=e.filter(function(e){return angular.isArray(s)?s.every(function(t){return!angular.equals(e,t)}):!angular.equals(e,s)});w.setItemsFn(i)}"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&&i.cancel(x),x=i(function(){var s=t.$eval(e);s&&angular.isFunction(s.then)&&!w.refreshing&&(w.refreshing=!0,s.then(function(){w.refreshing=!1}))},w.refreshDelay))},w.isActive=function(e){if(!w.open)return!1;var t=w.items.indexOf(e[w.itemProperty]),s=t==w.activeIndex;return!s||0>t?!1:(s&&!angular.isUndefined(w.onHighlightCallback)&&e.$eval(w.onHighlightCallback),s)};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],s=w.items.indexOf(t),i=!1;if(s>=0&&(angular.isDefined(w.disableChoiceExpression)||w.multiple)){if(t.isTag)return!1;w.multiple&&(i=E(t)),!i&&angular.isDefined(w.disableChoiceExpression)&&(i=!!e.$eval(w.disableChoiceExpression)),f(t,i)}return i}},w.select=function(e,s,c){if(void 0===e||!v(e)){if(!w.items&&!w.search&&!w.tagging.isActivated)return;if(!e||!v(e)){if(w.clickTriggeredSelect=!1,c&&("click"===c.type||"touchend"===c.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(s)}h(),t.$broadcast("uis:select",e);var n={};n[w.parserResult.itemName]=e,i(function(){w.onSelectCallback(t,{$item:e,$model:w.parserResult.modelMapper(t,n)})}),w.closeOnSelect&&w.close(s)}}},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(),i(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},$);var C=null,I=!1;w.sizeSearchInput=function(){var e=w.searchInput[0],s=w.searchInput.parent().parent()[0],c=function(){return s.clientWidth*!!e.offsetParent},n=function(t){if(0===t)return!1;var s=t-e.offsetLeft-10;return 50>s&&(s=t),w.searchInput.css("width",s+"px"),!0};w.searchInput.css("width","10px"),i(function(){null!==C||n(c())||(C=t.$watch(function(){I||(I=!0,t.$$postDigest(function(){I=!1,n(c())&&(C(),C=null)}))},angular.noop))})},w.searchInput.on("keydown",function(s){var c=s.which;~[e.ENTER,e.ESC].indexOf(c)&&(s.preventDefault(),s.stopPropagation()),t.$apply(function(){var t=!1;if((w.items.length>0||w.tagging.isActivated)&&(m(c)||w.searchEnabled||(s.preventDefault(),s.stopPropagation()),w.taggingTokens.isActivated)){for(var n=0;n0&&(t=!0);t&&i(function(){w.searchInput.triggerHandler("tagged");var t=w.search.replace(e.MAP[s.keyCode],"").trim();w.tagging.fct&&(t=w.tagging.fct(t)),t&&w.select(t,!0)})}}),e.isVerticalMovement(c)&&w.items.length>0&&b(),c!==e.ENTER&&c!==e.ESC||(s.preventDefault(),s.stopPropagation())}),w.searchInput.on("paste",function(t){var s;if(s=window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):(t.originalEvent||t).clipboardData.getData("text/plain"),s=w.search+s,s&&s.length>0)if(w.taggingTokens.isActivated){for(var i=[],c=0;c-1){i=s.split(n);break}}0===i.length&&(i=[s]);var l=w.search;angular.forEach(i,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(s),w.search=y,t.preventDefault(),t.stopPropagation())}),w.searchInput.on("tagged",function(){i(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)}),t.$watch("$select.activeIndex",function(e){e&&s.find("input").attr("aria-activedescendant","ui-select-choices-row-"+w.generatedId+"-"+e)}),t.$watch("$select.open",function(e){e||s.find("input").removeAttr("aria-activedescendant")})}]),s.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);$=angular.element('
    '),$[0].style.width=t.width+"px",$[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!==$&&($.replaceWith(a),$=null,a[0].style.position="",a[0].style.left="",a[0].style.top="",a[0].style.width=m,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("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:!1}),r.$observe("resetSearchInput",function(){var e=c.$eval(r.resetSearchInput);g.resetSearchInput=void 0!==e?e:!0}),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 $=null,m="",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=-1*t.height+"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)}}}}}}]),s.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?!0:"true"===e.toLowerCase():!1}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()}}}]),s.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(t,s){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(){return c.selected&&c.selected.length?void 0:c.placeholder}}],controllerAs:"$selectMultiple",link:function(i,c,n,l){function a(e){return angular.isNumber(e.selectionStart)?e.selectionStart:e.value.length}function r(t){function s(){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 i=a(d.searchInput[0]),c=d.selected.length,n=0,l=c-1,r=h.activeMatchIndex,o=h.activeMatchIndex+1,u=h.activeMatchIndex-1,p=r;return i>0||d.search.length&&t==e.RIGHT?!1:(d.close(),p=s(),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 s=-1;if(angular.isArray(e))for(var i=angular.copy(e),c=0;c=0;c--)t={},t[d.parserResult.itemName]=d.selected[c],e=d.parserResult.modelMapper(i,t),s.unshift(e);return s}),p.$formatters.unshift(function(e){var t,s=d.parserResult&&d.parserResult.source(i,{$select:{search:""}}),c={};if(!s)return e;var n=[],l=function(e,s){if(e&&e.length){for(var l=e.length-1;l>=0;l--){if(c[d.parserResult.itemName]=e[l],t=d.parserResult.modelMapper(i,c),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]]==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(d.selected,e[a])||l(s,e[a])||n.unshift(e[a]);return n}),i.$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(),i.$evalAsync()},i.$on("uis:select",function(e,t){d.selected.length>=d.limit||(d.selected.push(t),h.updateModel())}),i.$on("uis:activate",function(){h.activeMatchIndex=-1}),i.$watch("$select.disabled",function(e,t){t&&!e&&d.sizeSearchInput()}),d.searchInput.on("keydown",function(t){var s=t.which;i.$apply(function(){var i=!1;e.isHorizontalMovement(s)&&(i=r(s)),i&&s!=e.TAB&&(t.preventDefault(),t.stopPropagation())})}),d.searchInput.on("keyup",function(t){if(e.isVerticalMovement(t.which)||i.$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 s,c,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)),s=d.tagging.fct(d.search),r.some(function(e){return angular.equals(e,s)})||d.selected.some(function(e){return angular.equals(e,s)}))return void i.$evalAsync(function(){d.activeIndex=0,d.items=a});s&&(s.isTag=!0)}else{if(n=d.$filter("filter")(a,function(e){return e.match(d.taggingLabel)}),n.length>0&&(l=n[0]),c=a[0],void 0!==c&&a.length>0&&l&&(p=!0,a=a.slice(1,a.length),r=r.slice(1,r.length)),s=d.search+" "+d.taggingLabel,u(d.selected,d.search)>-1)return;if(o(r.concat(d.selected)))return void(p&&(a=r,i.$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,s)),h>-1?a=a.slice(h+1,a.length-1):(a=[],s&&a.push(s),a=a.concat(r)),i.$evalAsync(function(){if(d.activeIndex=0,d.items=a,d.isGrouped){var e=s?a.slice(1):a;d.setItemsFn(e),s&&(d.items.unshift(s),d.groups.unshift({name:"",items:[s],tagging:!0}))}})}}),d.searchInput.on("blur",function(){s(function(){h.activeMatchIndex=-1})})}}}]),s.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"}}}]),s.directive("uiSelectSingle",["$timeout","$compile",function(t,s){return{restrict:"EA",require:["^uiSelect","^ngModel"],link:function(i,c,n,l){var a=l[0],r=l[1];r.$parsers.unshift(function(e){var t,s={};return s[a.parserResult.itemName]=e,t=a.parserResult.modelMapper(i,s)}),r.$formatters.unshift(function(e){var t,s=a.parserResult&&a.parserResult.source(i,{$select:{search:""}}),c={};if(s){var n=function(s){return c[a.parserResult.itemName]=s,t=a.parserResult.modelMapper(i,c),t===e};if(a.selected&&n(a.selected))return a.selected;for(var l=s.length-1;l>=0;l--)if(n(s[l]))return s[l]}return e}),i.$watch("$select.selected",function(e){r.$viewValue!==e&&r.$setViewValue(e)}),r.$render=function(){a.selected=r.$viewValue},i.$on("uis:select",function(e,t){a.selected=t}),i.$on("uis:close",function(e,s){t(function(){a.focusser.prop("disabled",!1),s||a.focusser[0].focus()},0,!1)}),i.$on("uis:activate",function(){o.prop("disabled",!0)});var o=angular.element("");s(o)(i),a.focusser=o,a.focusInput=o,c.parent().append(o),o.bind("focus",function(){i.$evalAsync(function(){a.focus=!0})}),o.bind("blur",function(){i.$evalAsync(function(){a.focus=!1})}),o.bind("keydown",function(t){return t.which===e.BACKSPACE?(t.preventDefault(),t.stopPropagation(),a.select(void 0),void i.$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()),i.$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(""),i.$digest())})}}}]),s.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)})},$=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",'
    ')}]); -//# sourceMappingURL=select.min.js.map +(function(){"use strict";var KEY={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 k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true}if(e.metaKey||e.ctrlKey||e.altKey)return true;return false},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[];$scope.$evalAsync(function(){ +ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset Date: Wed, 7 Dec 2016 12:57:42 +0500 Subject: [PATCH 05/10] commit --- dist/select.js | 2 +- dist/select.js000 | 2393 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2394 insertions(+), 1 deletion(-) create mode 100644 dist/select.js000 diff --git a/dist/select.js b/dist/select.js index e8e1948b7..510fed83f 100644 --- a/dist/select.js +++ b/dist/select.js @@ -339,7 +339,7 @@ uis.controller('uiSelectCtrl', } ctrl.isEmpty = function() { - return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0); + return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0) || (typeof ctrl.selected == "object" && !ctrl.selected.id); }; function _findIndex(collection, predicate, thisArg){ diff --git a/dist/select.js000 b/dist/select.js000 new file mode 100644 index 000000000..e8e1948b7 --- /dev/null +++ b/dist/select.js000 @@ -0,0 +1,2393 @@ +/*! + * ui-select + * http://github.com/angular-ui/ui-select + * Version: 0.19.5 - 2016-10-24T23:13:59.434Z + * License: MIT + */ + + +(function () { +"use strict"; +var KEY = { + 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 k = e.which; + switch (k) { + case KEY.COMMAND: + case KEY.SHIFT: + case KEY.CTRL: + case KEY.ALT: + return true; + } + + if (e.metaKey || e.ctrlKey || e.altKey) return true; + + return false; + }, + isFunctionKey: function (k) { + k = k.which ? k.which : k; + return k >= 112 && k <= 123; + }, + isVerticalMovement: function (k){ + return ~[KEY.UP, KEY.DOWN].indexOf(k); + }, + isHorizontalMovement: function (k){ + return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k); + }, + toSeparator: function (k) { + var sep = {ENTER:"\n",TAB:"\t",SPACE:" "}[k]; + if (sep) return sep; + // return undefined for special keys other than enter, tab or space. + // no way to use them to cut strings. + return KEY[k] ? undefined : k; + } + }; + +/** + * Add querySelectorAll() to jqLite. + * + * jqLite find() is limited to lookups by tag name. + * TODO This will change with future versions of AngularJS, to be removed when this happens + * + * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586 + * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598 + */ +if (angular.element.prototype.querySelectorAll === undefined) { + angular.element.prototype.querySelectorAll = function(selector) { + return angular.element(this[0].querySelectorAll(selector)); + }; +} + +/** + * Add closest() to jqLite. + */ +if (angular.element.prototype.closest === undefined) { + angular.element.prototype.closest = function( selector) { + var elem = this[0]; + var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; + + while (elem) { + if (matchesSelector.bind(elem)(selector)) { + return elem; + } else { + elem = elem.parentElement; + } + } + return false; + }; +} + +var latestId = 0; + +var uis = angular.module('ui.select', []) + +.constant('uiSelectConfig', { + theme: 'bootstrap', + searchEnabled: true, + sortable: false, + placeholder: '', // Empty by default, like HTML tag "); + $compile(focusser)(scope); + $select.focusser = focusser; + + //Input that will handle focus + $select.focusInput = focusser; + + element.parent().append(focusser); + focusser.bind("focus", function(){ + scope.$evalAsync(function(){ + $select.focus = true; + }); + }); + focusser.bind("blur", function(){ + scope.$evalAsync(function(){ + $select.focus = false; + }); + }); + focusser.bind("keydown", function(e){ + + if (e.which === KEY.BACKSPACE) { + e.preventDefault(); + e.stopPropagation(); + $select.select(undefined); + scope.$apply(); + return; + } + + if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) { + return; + } + + if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){ + e.preventDefault(); + e.stopPropagation(); + $select.activate(); + } + + scope.$digest(); + }); + + focusser.bind("keyup input", function(e){ + + if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) { + return; + } + + $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input + focusser.val(''); + scope.$digest(); + + }); + + + } + }; +}]); + +// Make multiple matches sortable +uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) { + return { + require: ['^^uiSelect', '^ngModel'], + link: function(scope, element, attrs, ctrls) { + if (scope[attrs.uiSelectSort] === null) { + throw uiSelectMinErr('sort', 'Expected a list to sort'); + } + + var $select = ctrls[0]; + var $ngModel = ctrls[1]; + + var options = angular.extend({ + axis: 'horizontal' + }, + scope.$eval(attrs.uiSelectSortOptions)); + + var axis = options.axis; + var draggingClassName = 'dragging'; + var droppingClassName = 'dropping'; + var droppingBeforeClassName = 'dropping-before'; + var droppingAfterClassName = 'dropping-after'; + + scope.$watch(function(){ + return $select.sortable; + }, function(newValue){ + if (newValue) { + element.attr('draggable', true); + } else { + element.removeAttr('draggable'); + } + }); + + element.on('dragstart', function(event) { + element.addClass(draggingClassName); + + (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString()); + }); + + element.on('dragend', function() { + removeClass(draggingClassName); + }); + + var move = function(from, to) { + /*jshint validthis: true */ + this.splice(to, 0, this.splice(from, 1)[0]); + }; + + var removeClass = function(className) { + angular.forEach($select.$element.querySelectorAll('.' + className), function(el){ + angular.element(el).removeClass(className); + }); + }; + + var dragOverHandler = function(event) { + event.preventDefault(); + + var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0); + + if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) { + removeClass(droppingAfterClassName); + element.addClass(droppingBeforeClassName); + + } else { + removeClass(droppingBeforeClassName); + element.addClass(droppingAfterClassName); + } + }; + + var dropTimeout; + + var dropHandler = function(event) { + event.preventDefault(); + + var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10); + + // prevent event firing multiple times in firefox + $timeout.cancel(dropTimeout); + dropTimeout = $timeout(function() { + _dropHandler(droppedItemIndex); + }, 20); + }; + + var _dropHandler = function(droppedItemIndex) { + var theList = scope.$eval(attrs.uiSelectSort); + var itemToMove = theList[droppedItemIndex]; + var newIndex = null; + + if (element.hasClass(droppingBeforeClassName)) { + if (droppedItemIndex < scope.$index) { + newIndex = scope.$index - 1; + } else { + newIndex = scope.$index; + } + } else { + if (droppedItemIndex < scope.$index) { + newIndex = scope.$index; + } else { + newIndex = scope.$index + 1; + } + } + + move.apply(theList, [droppedItemIndex, newIndex]); + + $ngModel.$setViewValue(Date.now()); + + scope.$apply(function() { + scope.$emit('uiSelectSort:change', { + array: theList, + item: itemToMove, + from: droppedItemIndex, + to: newIndex + }); + }); + + removeClass(droppingClassName); + removeClass(droppingBeforeClassName); + removeClass(droppingAfterClassName); + + element.off('drop', dropHandler); + }; + + element.on('dragenter', function() { + if (element.hasClass(draggingClassName)) { + return; + } + + element.addClass(droppingClassName); + + element.on('dragover', dragOverHandler); + element.on('drop', dropHandler); + }); + + element.on('dragleave', function(event) { + if (event.target != element) { + return; + } + + removeClass(droppingClassName); + removeClass(droppingBeforeClassName); + removeClass(droppingAfterClassName); + + element.off('dragover', dragOverHandler); + element.off('drop', dropHandler); + }); + } + }; +}]); + +/** + * Debounces functions + * + * Taken from UI Bootstrap $$debounce source code + * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js + * + */ +uis.factory('$$uisDebounce', ['$timeout', function($timeout) { + return function(callback, debounceTime) { + var timeoutPromise; + + return function() { + var self = this; + var args = Array.prototype.slice.call(arguments); + if (timeoutPromise) { + $timeout.cancel(timeoutPromise); + } + + timeoutPromise = $timeout(function() { + callback.apply(self, args); + }, debounceTime); + }; + }; +}]); + +uis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) { + return { + restrict: 'A', + require: 'uiSelect', + link: function (scope, element, attrs, $select) { + $select.onOpenCloseCallback = $parse(attrs.uisOpenClose); + + scope.$watch('$select.open', function (isOpen, previousState) { + if (isOpen !== previousState) { + $timeout(function () { + $select.onOpenCloseCallback(scope, { + isOpen: isOpen + }); + }); + } + }); + } + }; +}]); + +/** + * Parses "repeat" attribute. + * + * Taken from AngularJS ngRepeat source code + * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211 + * + * Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat: + * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697 + */ + +uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) { + var self = this; + + /** + * Example: + * expression = "address in addresses | filter: {street: $select.search} track by $index" + * itemName = "address", + * source = "addresses | filter: {street: $select.search}", + * trackByExp = "$index", + */ + self.parse = function(expression) { + + + var match; + //var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression); + // If an array is used as collection + + // if (isObjectCollection){ + // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000 + match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/); + + // 1 Alias + // 2 Item + // 3 Key on (key,value) + // 4 Value on (key,value) + // 5 Source expression (including filters) + // 6 Track by + + if (!match) { + throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", + expression); + } + + var source = match[5], + filters = ''; + + // When using (key,value) ui-select requires filters to be extracted, since the object + // is converted to an array for $select.items + // (in which case the filters need to be reapplied) + if (match[3]) { + // Remove any enclosing parenthesis + source = match[5].replace(/(^\()|(\)$)/g, ''); + // match all after | but not after || + var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/); + if(filterMatch && filterMatch[1].trim()) { + filters = filterMatch[1]; + source = source.replace(filters, ''); + } + } + + return { + itemName: match[4] || match[2], // (lhs) Left-hand side, + keyName: match[3], //for (key, value) syntax + source: $parse(source), + filters: filters, + trackByExp: match[6], + modelMapper: $parse(match[1] || match[4] || match[2]), + repeatExpression: function (grouped) { + var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items'); + if (this.trackByExp) { + expression += ' track by ' + this.trackByExp; + } + return expression; + } + }; + + }; + + self.getGroupNgRepeatExpression = function() { + return '$group in $select.groups track by $group.name'; + }; + +}]); + +}()); +//~ angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
      0\">
    • 0\">
    "); +//~ $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); +//~ $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("select2/choices.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("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 From a72263d413bef9f2cd6ebcc7d48f87eaa2422679 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Wed, 7 Dec 2016 13:00:13 +0500 Subject: [PATCH 06/10] commit --- dist/select.min.js | 4 ++-- dist/select.min.js000 | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 dist/select.min.js000 diff --git a/dist/select.min.js b/dist/select.min.js index 1c364b4f5..4c855a88b 100644 --- a/dist/select.min.js +++ b/dist/select.min.js @@ -1,2 +1,2 @@ -(function(){"use strict";var KEY={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 k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true}if(e.metaKey||e.ctrlKey||e.altKey)return true;return false},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[];$scope.$evalAsync(function(){ -ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0||typeof ctrl.selected=="object"&&!ctrl.selected.id};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[]; +$scope.$evalAsync(function(){ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[];$scope.$evalAsync(function(){ +ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset Date: Thu, 8 Dec 2016 17:07:54 +0500 Subject: [PATCH 07/10] commit --- dist/materialize.css | 305 +++ dist/materialize.tpl.html | 78 + {dist => dist000}/from-boostrap.css | 0 .../materialize/choices.tpl.html | 0 .../materialize/match-multiple.tpl.html | 0 {dist => dist000}/materialize/match.tpl.html | 0 .../materialize/no-choice.tpl.html | 0 .../materialize/select-multiple.tpl.html | 0 {dist => dist000}/materialize/select.tpl.html | 0 dist000/select.css | 369 +++ dist000/select.js | 2393 +++++++++++++++++ {dist => dist000}/select.js000 | 0 dist000/select.min.css | 7 + dist000/select.min.css.map | 1 + dist000/select.min.js | 2 + dist000/select.min.js.map | 1 + {dist => dist000}/select.min.js000 | 0 17 files changed, 3156 insertions(+) create mode 100644 dist/materialize.css create mode 100644 dist/materialize.tpl.html rename {dist => dist000}/from-boostrap.css (100%) rename {dist => dist000}/materialize/choices.tpl.html (100%) rename {dist => dist000}/materialize/match-multiple.tpl.html (100%) rename {dist => dist000}/materialize/match.tpl.html (100%) rename {dist => dist000}/materialize/no-choice.tpl.html (100%) rename {dist => dist000}/materialize/select-multiple.tpl.html (100%) rename {dist => dist000}/materialize/select.tpl.html (100%) create mode 100644 dist000/select.css create mode 100644 dist000/select.js rename {dist => dist000}/select.js000 (100%) create mode 100644 dist000/select.min.css create mode 100644 dist000/select.min.css.map create mode 100644 dist000/select.min.js create mode 100644 dist000/select.min.js.map rename {dist => dist000}/select.min.js000 (100%) diff --git a/dist/materialize.css b/dist/materialize.css new file mode 100644 index 000000000..65599e148 --- /dev/null +++ b/dist/materialize.css @@ -0,0 +1,305 @@ + +/* Style when highlighting a search. */ +.ui-select-highlight { + font-weight: bold; +} + +.ui-select-offscreen { + clip: rect(0 0 0 0) !important; + width: 1px !important; + height: 1px !important; + border: 0 !important; + margin: 0 !important; + padding: 0 !important; + overflow: hidden !important; + position: absolute !important; + outline: 0 !important; + left: 0px !important; + top: 0px !important; +} + + +.ui-select-choices-row:hover { + background-color: #f5f5f5; +} + + +/* Bootstrap theme */ + +/* Helper class to show styles when focus */ +/*.btn-default-focus { + color: #333; + background-color: #EBEBEB; + border-color: #ADADAD; + text-decoration: none; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); +}*/ + +.ui-select-container .ui-select-toggle { + position: relative; +} + +/*.ui-select-bootstrap .ui-select-toggle > .caret { + position: absolute; + height: 10px; + top: 50%; + right: 10px; + margin-top: -2px; +}*/ + +/* Fix Bootstrap dropdown position when inside a input-group */ +/*.input-group > .ui-select-bootstrap.dropdown { + position: static; +}*/ + +/*.input-group > .ui-select-bootstrap > input.ui-select-search.form-control { + border-radius: 4px; + border-top-right-radius: 0; + border-bottom-right-radius: 0; +}*/ +/*.input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up { + border-radius: 4px !important; + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; +}*/ + +.ui-select-container .ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + +/*.ui-select-bootstrap > .ui-select-match > .btn{ + text-align: left !important; +}*/ + +/*.ui-select-bootstrap > .ui-select-match > .caret { + position: absolute; + top: 45%; + right: 15px; +}*/ + +/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ +.ui-select-container > .ui-select-choices ,.ui-select-container > .ui-select-no-choice { + width: 100%; + height: auto; + max-height: 200px; + overflow-x: hidden; + margin-top: -1px; +} + +/*body > .ui-select-bootstrap.open {*/ +body > .ui-select-container.open { + z-index: 1000; /* Standard Bootstrap dropdown z-index */ +} + +.ui-select-multiple.ui-select-container { + height: auto; + padding: 3px 3px 0 3px; +} + +.ui-select-multiple.ui-select-container input.ui-select-search { + background-color: transparent !important; /* To prevent double background when disabled */ + border: none; + outline: none; + height: 1.666666em; + margin-bottom: 3px; +} + +/*.ui-select-multiple.ui-select-bootstrap .ui-select-match .close { + font-size: 1.6em; + line-height: 0.75; +}*/ + +.ui-select-multiple.ui-select-container .ui-select-match-item { + outline: 0; + margin: 0 3px 3px 0; +} + +.ui-select-multiple .ui-select-match-item { + position: relative; +} + +.ui-select-multiple .ui-select-match-item.dropping .ui-select-match-close { + pointer-events: none; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-before:before { + content: ""; + position: absolute; + top: 0; + right: 100%; + height: 100%; + margin-right: 2px; + border-left: 1px solid #428bca; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-after:after { + content: ""; + position: absolute; + top: 0; + left: 100%; + height: 100%; + margin-left: 2px; + border-right: 1px solid #428bca; +} + +.ui-select-container .ui-select-choices-row>span { + cursor: pointer; + display: block; + padding: 3px 20px; + clear: both; + font-weight: 400; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} + +.ui-select-container .ui-select-choices-row>span:hover, .ui-select-container .ui-select-choices-row>span:focus { + text-decoration: none; + color: #262626; + background-color: #f5f5f5; +} + +.ui-select-container .ui-select-choices-row.active>span { + color: #fff; + text-decoration: none; + outline: 0; + background-color: #428bca; +} + +.ui-select-container .ui-select-choices-row.disabled>span, +.ui-select-container .ui-select-choices-row.active.disabled>span { + color: #777; + cursor: not-allowed; + background-color: #fff; +} + +/* fix hide/show angular animation */ +.ui-select-match.ng-hide-add, +.ui-select-search.ng-hide-add { + display: none !important; +} + +/* Mark invalid Bootstrap */ +.ui-select-container.ng-dirty.ng-invalid > button.btn.ui-select-match { + border-color: #D44950; +} + +/* Handle up direction Bootstrap */ +/*.ui-select-container[theme="bootstrap"].direction-up .ui-select-dropdown { + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); +}*/ + +.ui-select-container .ui-select-match-text { + width: 100%; + padding-right: 1em; +} +.ui-select-container .ui-select-match-text span { + display: inline-block; + width: 100%; + overflow: hidden; +} +/*.ui-select-bootstrap .ui-select-toggle > a.btn { + position: absolute; + height: 10px; + right: 10px; + margin-top: -2px; +}*/ + + + +.ui-select-container{ + margin-right: 1rem; +} + +.ui-select-match-text, .ui-select-placeholder { + border-bottom: 1px solid; + display:block; + width: 100%; + /*cursor:pointer;*/ +} + +/* copy-paste from the bootstrap.css */ + +/*.dropdown {*/ +.ui-select-container { + position: relative; +} + +/*.dropdown-menu {*/ +.ui-select-dropdown { + background-clip: padding-box; + background-color: #fff; + border: 1px solid rgba(0, 0, 0, 0.15); + /*border-radius: 4px;*/ + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176); + display: none; + float: left; + /*font-size: 14px;*/ + left: 0; + list-style: outside none none; + margin: 2px 0 0; + min-width: 160px; + padding: 5px 0; + position: absolute; + top: 100%; + z-index: 1000; +} + + +/*.open > .dropdown-menu {*/ +.open > .ui-select-dropdown { + display: block; +} + +/* Spinner */ +/*.ui-select-refreshing { + position: absolute; + right: 0; + padding: 8px 27px; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing:antialiased; + } + +@-webkit-keyframes ui-select-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes ui-select-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +.ui-select-spin { + -webkit-animation: ui-select-spin 2s infinite linear; + animation: ui-select-spin 2s infinite linear; +} + +.ui-select-refreshing.ng-animate { + -webkit-animation: none 0s; +} + +*/ \ No newline at end of file diff --git a/dist/materialize.tpl.html b/dist/materialize.tpl.html new file mode 100644 index 000000000..c82b58406 --- /dev/null +++ b/dist/materialize.tpl.html @@ -0,0 +1,78 @@ +@@@ materialize/select.tpl.html + + + +@@@ materialize/select-multiple.tpl.html + + + +@@@ materialize/match.tpl.html + +
    + + + close + arrow_upward + + + + + {{$select.placeholder}} + + + + + + + + +
    + +@@@ materialize/match-multiple.tpl.html + + + + +  × + + + + + + +@@@ materialize/choices.tpl.html + + + +@@@ materialize/no-choice.tpl.html + + \ No newline at end of file diff --git a/dist/from-boostrap.css b/dist000/from-boostrap.css similarity index 100% rename from dist/from-boostrap.css rename to dist000/from-boostrap.css diff --git a/dist/materialize/choices.tpl.html b/dist000/materialize/choices.tpl.html similarity index 100% rename from dist/materialize/choices.tpl.html rename to dist000/materialize/choices.tpl.html diff --git a/dist/materialize/match-multiple.tpl.html b/dist000/materialize/match-multiple.tpl.html similarity index 100% rename from dist/materialize/match-multiple.tpl.html rename to dist000/materialize/match-multiple.tpl.html diff --git a/dist/materialize/match.tpl.html b/dist000/materialize/match.tpl.html similarity index 100% rename from dist/materialize/match.tpl.html rename to dist000/materialize/match.tpl.html diff --git a/dist/materialize/no-choice.tpl.html b/dist000/materialize/no-choice.tpl.html similarity index 100% rename from dist/materialize/no-choice.tpl.html rename to dist000/materialize/no-choice.tpl.html diff --git a/dist/materialize/select-multiple.tpl.html b/dist000/materialize/select-multiple.tpl.html similarity index 100% rename from dist/materialize/select-multiple.tpl.html rename to dist000/materialize/select-multiple.tpl.html diff --git a/dist/materialize/select.tpl.html b/dist000/materialize/select.tpl.html similarity index 100% rename from dist/materialize/select.tpl.html rename to dist000/materialize/select.tpl.html diff --git a/dist000/select.css b/dist000/select.css new file mode 100644 index 000000000..b4541adec --- /dev/null +++ b/dist000/select.css @@ -0,0 +1,369 @@ +/*! + * ui-select + * http://github.com/angular-ui/ui-select + * Version: 0.19.5 - 2016-10-24T23:13:59.551Z + * License: MIT + */ + + +/* Style when highlighting a search. */ +.ui-select-highlight { + font-weight: bold; +} + +.ui-select-offscreen { + clip: rect(0 0 0 0) !important; + width: 1px !important; + height: 1px !important; + border: 0 !important; + margin: 0 !important; + padding: 0 !important; + overflow: hidden !important; + position: absolute !important; + outline: 0 !important; + left: 0px !important; + top: 0px !important; +} + + +.ui-select-choices-row:hover { + background-color: #f5f5f5; +} + +/* Select2 theme */ + +/* Mark invalid Select2 */ +.ng-dirty.ng-invalid > a.select2-choice { + border-color: #D44950; +} + +.select2-result-single { + padding-left: 0; +} + +.select2-locked > .select2-search-choice-close{ + display:none; +} + +.select-locked > .ui-select-match-close{ + display:none; +} + +body > .select2-container.open { + z-index: 9999; /* The z-index Select2 applies to the select2-drop */ +} + +/* Handle up direction Select2 */ +.ui-select-container[theme="select2"].direction-up .ui-select-match, +.ui-select-container.select2.direction-up .ui-select-match { + border-radius: 4px; /* FIXME hardcoded value :-/ */ + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.ui-select-container[theme="select2"].direction-up .ui-select-dropdown, +.ui-select-container.select2.direction-up .ui-select-dropdown { + border-radius: 4px; /* FIXME hardcoded value :-/ */ + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + + border-top-width: 1px; /* FIXME hardcoded value :-/ */ + border-top-style: solid; + + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); + + margin-top: -4px; /* FIXME hardcoded value :-/ */ +} +.ui-select-container[theme="select2"].direction-up .ui-select-dropdown .select2-search, +.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search { + margin-top: 4px; /* FIXME hardcoded value :-/ */ +} +.ui-select-container[theme="select2"].direction-up.select2-dropdown-open .ui-select-match, +.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match { + border-bottom-color: #5897fb; +} + +.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden, +.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden input{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + +/* Selectize theme */ + +/* Helper class to show styles when focus */ +.selectize-input.selectize-focus{ + border-color: #007FBB !important; +} + +/* Fix input width for Selectize theme */ +.selectize-control.single > .selectize-input > input { + width: 100%; +} + +/* Fix line break when there's at least one item selected with the Selectize theme */ +.selectize-control.multi > .selectize-input > input { + margin: 0 !important; +} + +/* Fix dropdown width for Selectize theme */ +.selectize-control > .selectize-dropdown { + width: 100%; +} + +/* Mark invalid Selectize */ +.ng-dirty.ng-invalid > div.selectize-input { + border-color: #D44950; +} + +/* Handle up direction Selectize */ +.ui-select-container[theme="selectize"].direction-up .ui-select-dropdown { + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); + margin-top: -2px; /* FIXME hardcoded value :-/ */ +} + +.ui-select-container[theme="selectize"] input.ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; + width: 0; +} + +/* Bootstrap theme */ + +/* Helper class to show styles when focus */ +.btn-default-focus { + color: #333; + background-color: #EBEBEB; + border-color: #ADADAD; + text-decoration: none; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); +} + +.ui-select-bootstrap .ui-select-toggle { + position: relative; +} + +.ui-select-bootstrap .ui-select-toggle > .caret { + position: absolute; + height: 10px; + top: 50%; + right: 10px; + margin-top: -2px; +} + +/* Fix Bootstrap dropdown position when inside a input-group */ +.input-group > .ui-select-bootstrap.dropdown { + /* Instead of relative */ + position: static; +} + +.input-group > .ui-select-bootstrap > input.ui-select-search.form-control { + border-radius: 4px; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up { + border-radius: 4px !important; /* FIXME hardcoded value :-/ */ + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; +} + +.ui-select-bootstrap .ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + +.ui-select-bootstrap > .ui-select-match > .btn{ + /* Instead of center because of .btn */ + text-align: left !important; +} + +.ui-select-bootstrap > .ui-select-match > .caret { + position: absolute; + top: 45%; + right: 15px; +} + +/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ +.ui-select-bootstrap > .ui-select-choices ,.ui-select-bootstrap > .ui-select-no-choice { + width: 100%; + height: auto; + max-height: 200px; + overflow-x: hidden; + margin-top: -1px; +} + +body > .ui-select-bootstrap.open { + z-index: 1000; /* Standard Bootstrap dropdown z-index */ +} + +.ui-select-multiple.ui-select-bootstrap { + height: auto; + padding: 3px 3px 0 3px; +} + +.ui-select-multiple.ui-select-bootstrap input.ui-select-search { + background-color: transparent !important; /* To prevent double background when disabled */ + border: none; + outline: none; + height: 1.666666em; + margin-bottom: 3px; +} + +.ui-select-multiple.ui-select-bootstrap .ui-select-match .close { + font-size: 1.6em; + line-height: 0.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 .ui-select-match-close { + pointer-events: none; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-before:before { + content: ""; + position: absolute; + top: 0; + right: 100%; + height: 100%; + margin-right: 2px; + border-left: 1px solid #428bca; +} + +.ui-select-multiple:hover .ui-select-match-item.dropping-after:after { + content: ""; + position: absolute; + top: 0; + left: 100%; + height: 100%; + margin-left: 2px; + border-right: 1px solid #428bca; +} + +.ui-select-bootstrap .ui-select-choices-row>span { + cursor: pointer; + display: block; + padding: 3px 20px; + clear: both; + font-weight: 400; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} + +.ui-select-bootstrap .ui-select-choices-row>span:hover, .ui-select-bootstrap .ui-select-choices-row>span:focus { + text-decoration: none; + color: #262626; + background-color: #f5f5f5; +} + +.ui-select-bootstrap .ui-select-choices-row.active>span { + color: #fff; + text-decoration: none; + outline: 0; + background-color: #428bca; +} + +.ui-select-bootstrap .ui-select-choices-row.disabled>span, +.ui-select-bootstrap .ui-select-choices-row.active.disabled>span { + color: #777; + cursor: not-allowed; + background-color: #fff; +} + +/* fix hide/show angular animation */ +.ui-select-match.ng-hide-add, +.ui-select-search.ng-hide-add { + display: none !important; +} + +/* Mark invalid Bootstrap */ +.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match { + border-color: #D44950; +} + +/* Handle up direction Bootstrap */ +.ui-select-container[theme="bootstrap"].direction-up .ui-select-dropdown { + box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); +} + +.ui-select-bootstrap .ui-select-match-text { + width: 100%; + padding-right: 1em; +} +.ui-select-bootstrap .ui-select-match-text span { + display: inline-block; + width: 100%; + overflow: hidden; +} +.ui-select-bootstrap .ui-select-toggle > a.btn { + position: absolute; + height: 10px; + right: 10px; + margin-top: -2px; +} + +/* Spinner */ +.ui-select-refreshing { + position: absolute; + right: 0; + padding: 8px 27px; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing:antialiased; + } + +@-webkit-keyframes ui-select-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes ui-select-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +.ui-select-spin { + -webkit-animation: ui-select-spin 2s infinite linear; + animation: ui-select-spin 2s infinite linear; +} + +.ui-select-refreshing.ng-animate { + -webkit-animation: none 0s; +} \ No newline at end of file diff --git a/dist000/select.js b/dist000/select.js new file mode 100644 index 000000000..510fed83f --- /dev/null +++ b/dist000/select.js @@ -0,0 +1,2393 @@ +/*! + * ui-select + * http://github.com/angular-ui/ui-select + * Version: 0.19.5 - 2016-10-24T23:13:59.434Z + * License: MIT + */ + + +(function () { +"use strict"; +var KEY = { + 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 k = e.which; + switch (k) { + case KEY.COMMAND: + case KEY.SHIFT: + case KEY.CTRL: + case KEY.ALT: + return true; + } + + if (e.metaKey || e.ctrlKey || e.altKey) return true; + + return false; + }, + isFunctionKey: function (k) { + k = k.which ? k.which : k; + return k >= 112 && k <= 123; + }, + isVerticalMovement: function (k){ + return ~[KEY.UP, KEY.DOWN].indexOf(k); + }, + isHorizontalMovement: function (k){ + return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k); + }, + toSeparator: function (k) { + var sep = {ENTER:"\n",TAB:"\t",SPACE:" "}[k]; + if (sep) return sep; + // return undefined for special keys other than enter, tab or space. + // no way to use them to cut strings. + return KEY[k] ? undefined : k; + } + }; + +/** + * Add querySelectorAll() to jqLite. + * + * jqLite find() is limited to lookups by tag name. + * TODO This will change with future versions of AngularJS, to be removed when this happens + * + * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586 + * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598 + */ +if (angular.element.prototype.querySelectorAll === undefined) { + angular.element.prototype.querySelectorAll = function(selector) { + return angular.element(this[0].querySelectorAll(selector)); + }; +} + +/** + * Add closest() to jqLite. + */ +if (angular.element.prototype.closest === undefined) { + angular.element.prototype.closest = function( selector) { + var elem = this[0]; + var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; + + while (elem) { + if (matchesSelector.bind(elem)(selector)) { + return elem; + } else { + elem = elem.parentElement; + } + } + return false; + }; +} + +var latestId = 0; + +var uis = angular.module('ui.select', []) + +.constant('uiSelectConfig', { + theme: 'bootstrap', + searchEnabled: true, + sortable: false, + placeholder: '', // Empty by default, like HTML tag "); + $compile(focusser)(scope); + $select.focusser = focusser; + + //Input that will handle focus + $select.focusInput = focusser; + + element.parent().append(focusser); + focusser.bind("focus", function(){ + scope.$evalAsync(function(){ + $select.focus = true; + }); + }); + focusser.bind("blur", function(){ + scope.$evalAsync(function(){ + $select.focus = false; + }); + }); + focusser.bind("keydown", function(e){ + + if (e.which === KEY.BACKSPACE) { + e.preventDefault(); + e.stopPropagation(); + $select.select(undefined); + scope.$apply(); + return; + } + + if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) { + return; + } + + if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){ + e.preventDefault(); + e.stopPropagation(); + $select.activate(); + } + + scope.$digest(); + }); + + focusser.bind("keyup input", function(e){ + + if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) { + return; + } + + $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input + focusser.val(''); + scope.$digest(); + + }); + + + } + }; +}]); + +// Make multiple matches sortable +uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) { + return { + require: ['^^uiSelect', '^ngModel'], + link: function(scope, element, attrs, ctrls) { + if (scope[attrs.uiSelectSort] === null) { + throw uiSelectMinErr('sort', 'Expected a list to sort'); + } + + var $select = ctrls[0]; + var $ngModel = ctrls[1]; + + var options = angular.extend({ + axis: 'horizontal' + }, + scope.$eval(attrs.uiSelectSortOptions)); + + var axis = options.axis; + var draggingClassName = 'dragging'; + var droppingClassName = 'dropping'; + var droppingBeforeClassName = 'dropping-before'; + var droppingAfterClassName = 'dropping-after'; + + scope.$watch(function(){ + return $select.sortable; + }, function(newValue){ + if (newValue) { + element.attr('draggable', true); + } else { + element.removeAttr('draggable'); + } + }); + + element.on('dragstart', function(event) { + element.addClass(draggingClassName); + + (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString()); + }); + + element.on('dragend', function() { + removeClass(draggingClassName); + }); + + var move = function(from, to) { + /*jshint validthis: true */ + this.splice(to, 0, this.splice(from, 1)[0]); + }; + + var removeClass = function(className) { + angular.forEach($select.$element.querySelectorAll('.' + className), function(el){ + angular.element(el).removeClass(className); + }); + }; + + var dragOverHandler = function(event) { + event.preventDefault(); + + var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0); + + if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) { + removeClass(droppingAfterClassName); + element.addClass(droppingBeforeClassName); + + } else { + removeClass(droppingBeforeClassName); + element.addClass(droppingAfterClassName); + } + }; + + var dropTimeout; + + var dropHandler = function(event) { + event.preventDefault(); + + var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10); + + // prevent event firing multiple times in firefox + $timeout.cancel(dropTimeout); + dropTimeout = $timeout(function() { + _dropHandler(droppedItemIndex); + }, 20); + }; + + var _dropHandler = function(droppedItemIndex) { + var theList = scope.$eval(attrs.uiSelectSort); + var itemToMove = theList[droppedItemIndex]; + var newIndex = null; + + if (element.hasClass(droppingBeforeClassName)) { + if (droppedItemIndex < scope.$index) { + newIndex = scope.$index - 1; + } else { + newIndex = scope.$index; + } + } else { + if (droppedItemIndex < scope.$index) { + newIndex = scope.$index; + } else { + newIndex = scope.$index + 1; + } + } + + move.apply(theList, [droppedItemIndex, newIndex]); + + $ngModel.$setViewValue(Date.now()); + + scope.$apply(function() { + scope.$emit('uiSelectSort:change', { + array: theList, + item: itemToMove, + from: droppedItemIndex, + to: newIndex + }); + }); + + removeClass(droppingClassName); + removeClass(droppingBeforeClassName); + removeClass(droppingAfterClassName); + + element.off('drop', dropHandler); + }; + + element.on('dragenter', function() { + if (element.hasClass(draggingClassName)) { + return; + } + + element.addClass(droppingClassName); + + element.on('dragover', dragOverHandler); + element.on('drop', dropHandler); + }); + + element.on('dragleave', function(event) { + if (event.target != element) { + return; + } + + removeClass(droppingClassName); + removeClass(droppingBeforeClassName); + removeClass(droppingAfterClassName); + + element.off('dragover', dragOverHandler); + element.off('drop', dropHandler); + }); + } + }; +}]); + +/** + * Debounces functions + * + * Taken from UI Bootstrap $$debounce source code + * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js + * + */ +uis.factory('$$uisDebounce', ['$timeout', function($timeout) { + return function(callback, debounceTime) { + var timeoutPromise; + + return function() { + var self = this; + var args = Array.prototype.slice.call(arguments); + if (timeoutPromise) { + $timeout.cancel(timeoutPromise); + } + + timeoutPromise = $timeout(function() { + callback.apply(self, args); + }, debounceTime); + }; + }; +}]); + +uis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) { + return { + restrict: 'A', + require: 'uiSelect', + link: function (scope, element, attrs, $select) { + $select.onOpenCloseCallback = $parse(attrs.uisOpenClose); + + scope.$watch('$select.open', function (isOpen, previousState) { + if (isOpen !== previousState) { + $timeout(function () { + $select.onOpenCloseCallback(scope, { + isOpen: isOpen + }); + }); + } + }); + } + }; +}]); + +/** + * Parses "repeat" attribute. + * + * Taken from AngularJS ngRepeat source code + * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211 + * + * Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat: + * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697 + */ + +uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) { + var self = this; + + /** + * Example: + * expression = "address in addresses | filter: {street: $select.search} track by $index" + * itemName = "address", + * source = "addresses | filter: {street: $select.search}", + * trackByExp = "$index", + */ + self.parse = function(expression) { + + + var match; + //var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression); + // If an array is used as collection + + // if (isObjectCollection){ + // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000 + match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/); + + // 1 Alias + // 2 Item + // 3 Key on (key,value) + // 4 Value on (key,value) + // 5 Source expression (including filters) + // 6 Track by + + if (!match) { + throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", + expression); + } + + var source = match[5], + filters = ''; + + // When using (key,value) ui-select requires filters to be extracted, since the object + // is converted to an array for $select.items + // (in which case the filters need to be reapplied) + if (match[3]) { + // Remove any enclosing parenthesis + source = match[5].replace(/(^\()|(\)$)/g, ''); + // match all after | but not after || + var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/); + if(filterMatch && filterMatch[1].trim()) { + filters = filterMatch[1]; + source = source.replace(filters, ''); + } + } + + return { + itemName: match[4] || match[2], // (lhs) Left-hand side, + keyName: match[3], //for (key, value) syntax + source: $parse(source), + filters: filters, + trackByExp: match[6], + modelMapper: $parse(match[1] || match[4] || match[2]), + repeatExpression: function (grouped) { + var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items'); + if (this.trackByExp) { + expression += ' track by ' + this.trackByExp; + } + return expression; + } + }; + + }; + + self.getGroupNgRepeatExpression = function() { + return '$group in $select.groups track by $group.name'; + }; + +}]); + +}()); +//~ angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
      0\">
    • 0\">
    "); +//~ $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); +//~ $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("select2/choices.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("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 diff --git a/dist/select.js000 b/dist000/select.js000 similarity index 100% rename from dist/select.js000 rename to dist000/select.js000 diff --git a/dist000/select.min.css b/dist000/select.min.css new file mode 100644 index 000000000..de36293e3 --- /dev/null +++ b/dist000/select.min.css @@ -0,0 +1,7 @@ +/*! + * ui-select + * http://github.com/angular-ui/ui-select + * Version: 0.19.5 - 2016-10-24T23:13:59.551Z + * 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}.selectize-control.single>.selectize-input>input,.selectize-control>.selectize-dropdown{width:100%}.ui-select-choices-row:hover{background-color:#f5f5f5}.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}body>.select2-container.open{z-index:9999}.ui-select-container.select2.direction-up .ui-select-match,.ui-select-container[theme=select2].direction-up .ui-select-match{border-radius:0 0 4px 4px}.ui-select-container.select2.direction-up .ui-select-dropdown,.ui-select-container[theme=select2].direction-up .ui-select-dropdown{border-radius:4px 4px 0 0;border-top-width:1px;border-top-style:solid;box-shadow:0 -4px 8px rgba(0,0,0,.25);margin-top:-4px}.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search,.ui-select-container[theme=select2].direction-up .ui-select-dropdown .select2-search{margin-top:4px}.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match,.ui-select-container[theme=select2].direction-up.select2-dropdown-open .ui-select-match{border-bottom-color:#5897fb}.ui-select-container[theme=select2] .ui-select-dropdown .ui-select-search-hidden,.ui-select-container[theme=select2] .ui-select-dropdown .ui-select-search-hidden input{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0}.selectize-input.selectize-focus{border-color:#007FBB!important}.selectize-control.multi>.selectize-input>input{margin:0!important}.ng-dirty.ng-invalid>div.selectize-input{border-color:#D44950}.ui-select-container[theme=selectize].direction-up .ui-select-dropdown{box-shadow:0 -4px 8px rgba(0,0,0,.25);margin-top:-2px}.ui-select-container[theme=selectize] input.ui-select-search-hidden{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0;width:0}.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}.input-group>.ui-select-bootstrap>input.ui-select-search.form-control.direction-up{border-radius:4px 0 0 4px!important}.ui-select-bootstrap .ui-select-search-hidden{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0}.ui-select-bootstrap>.ui-select-match>.btn{text-align:left!important}.ui-select-bootstrap>.ui-select-match>.caret{position:absolute;top:45%;right:15px}.ui-select-bootstrap>.ui-select-choices,.ui-select-bootstrap>.ui-select-no-choice{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:-1px}body>.ui-select-bootstrap.open{z-index:1000}.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 .ui-select-match-close{pointer-events:none}.ui-select-multiple:hover .ui-select-match-item.dropping-before:before{content:"";position:absolute;top:0;right:100%;height:100%;margin-right:2px;border-left:1px solid #428bca}.ui-select-multiple:hover .ui-select-match-item.dropping-after:after{content:"";position:absolute;top:0;left:100%;height:100%;margin-left:2px;border-right:1px solid #428bca}.ui-select-bootstrap .ui-select-choices-row>span{cursor:pointer;display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-bootstrap .ui-select-choices-row>span:focus,.ui-select-bootstrap .ui-select-choices-row>span:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.ui-select-bootstrap .ui-select-choices-row.active>span{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.ui-select-bootstrap .ui-select-choices-row.active.disabled>span,.ui-select-bootstrap .ui-select-choices-row.disabled>span{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}.ui-select-container[theme=bootstrap].direction-up .ui-select-dropdown{box-shadow:0 -4px 8px rgba(0,0,0,.25)}.ui-select-bootstrap .ui-select-match-text{width:100%;padding-right:1em}.ui-select-bootstrap .ui-select-match-text span{display:inline-block;width:100%;overflow:hidden}.ui-select-bootstrap .ui-select-toggle>a.btn{position:absolute;height:10px;right:10px;margin-top:-2px}.ui-select-refreshing{position:absolute;right:0;padding:8px 27px;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased}@-webkit-keyframes ui-select-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes ui-select-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.ui-select-spin{-webkit-animation:ui-select-spin 2s infinite linear;animation:ui-select-spin 2s infinite linear}.ui-select-refreshing.ng-animate{-webkit-animation:none 0s} +/*# sourceMappingURL=select.min.css.map */ diff --git a/dist000/select.min.css.map b/dist000/select.min.css.map new file mode 100644 index 000000000..dab54c478 --- /dev/null +++ b/dist000/select.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["common.css"],"names":[],"mappings":";;;;;AACA,qBACA,YAAA,IAGA,qBACA,KAAA,wBACA,MAAA,cACA,OAAA,cACA,OAAA,YACA,OAAA,YACA,QAAA,YACA,SAAA,iBACA,SAAA,mBACA,QAAA,YACA,KAAA,YACA,IAAA,YA8EA,iDAUA,uCACA,MAAA,KArFA,6BACA,iBAAA,QAMA,sCACA,aAAA,QAGA,uBACA,aAAA,EAOA,sCAJA,6CACA,QAAA,KAOA,6BACA,QAAA,KAKA,2DADA,kEAEA,cACA,EACA,EAFA,IAAA,IAKA,8DADA,qEAEA,cAAA,IAAA,IAEA,EADA,EAGA,iBAAA,IACA,iBAAA,MAEA,WAAA,EAAA,KAAA,IAAA,gBAEA,WAAA,KAGA,8EADA,qFAEA,WAAA,IAGA,iFADA,wFAEA,oBAAA,QAGA,iFACA,uFACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EAMA,iCACA,aAAA,kBASA,gDACA,OAAA,YASA,yCACA,aAAA,QAIA,uEACA,WAAA,EAAA,KAAA,IAAA,gBACA,WAAA,KAGA,oEACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EACA,MAAA,EAMA,mBACA,MAAA,KACA,iBAAA,QACA,aAAA,QACA,gBAAA,KACA,QAAA,yBAAA,KAAA,IACA,eAAA,KACA,WAAA,MAAA,EAAA,IAAA,IAAA,iBAAA,EAAA,EAAA,IAAA,qBAGA,uCACA,SAAA,SAGA,8CACA,SAAA,SACA,OAAA,KACA,IAAA,IACA,MAAA,KACA,WAAA,KAIA,2CAEA,SAAA,OAGA,sEACA,cAAA,IACA,EACA,EAFA,IAIA,mFACA,cAAA,IACA,EACA,EAFA,cAKA,8CACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EAGA,2CAEA,WAAA,eAGA,6CACA,SAAA,SACA,IAAA,IACA,MAAA,KAIA,wCAAA,0CACA,MAAA,KACA,OAAA,KACA,WAAA,MACA,WAAA,OACA,WAAA,KAGA,+BACA,QAAA,KAGA,wCACA,OAAA,KACA,QAAA,IAAA,IAAA,EAGA,+DACA,iBAAA,sBACA,YACA,QAAA,EACA,OAAA,WACA,cAAA,IAGA,gEACA,UAAA,MACA,YAAA,IAGA,8DACA,QAAA,EACA,OAAA,EAAA,IAAA,IAAA,EAGA,0CACA,SAAA,SAGA,0EACA,eAAA,KAGA,uEACA,QAAA,GACA,SAAA,SACA,IAAA,EACA,MAAA,KACA,OAAA,KACA,aAAA,IACA,YAAA,IAAA,MAAA,QAGA,qEACA,QAAA,GACA,SAAA,SACA,IAAA,EACA,KAAA,KACA,OAAA,KACA,YAAA,IACA,aAAA,IAAA,MAAA,QAGA,iDACA,OAAA,QACA,QAAA,MACA,QAAA,IAAA,KACA,MAAA,KACA,YAAA,IACA,YAAA,WACA,MAAA,KACA,YAAA,OAGA,uDAAA,uDACA,gBAAA,KACA,MAAA,QACA,iBAAA,QAGA,wDACA,MAAA,KACA,gBAAA,KACA,QAAA,EACA,iBAAA,QAIA,iEADA,0DAEA,MAAA,KACA,OAAA,YACA,iBAAA,KAIA,6BACA,8BACA,QAAA,eAIA,oEACA,aAAA,QAIA,uEACA,WAAA,EAAA,KAAA,IAAA,gBAGA,2CACA,MAAA,KACA,cAAA,IAEA,gDACA,QAAA,aACA,MAAA,KACA,SAAA,OAEA,6CACA,SAAA,SACA,OAAA,KACA,MAAA,KACA,WAAA,KAIA,sBACA,SAAA,SACA,MAAA,EACA,QAAA,IAAA,KACA,IAAA,IACA,QAAA,aACA,YAAA,uBACA,WAAA,OACA,YAAA,IACA,YAAA,EACA,uBAAA,YAGA,kCACA,GACA,kBAAA,UACA,UAAA,UAEA,KACA,kBAAA,eACA,UAAA,gBAGA,0BACA,GACA,kBAAA,UACA,UAAA,UAEA,KACA,kBAAA,eACA,UAAA,gBAIA,gBACA,kBAAA,eAAA,GAAA,SAAA,OACA,UAAA,eAAA,GAAA,SAAA,OAGA,iCACA,kBAAA,KAAA","file":"select.min.css","sourcesContent":["/* Style when highlighting a search. */\n.ui-select-highlight {\n font-weight: bold;\n}\n\n.ui-select-offscreen {\n clip: rect(0 0 0 0) !important;\n width: 1px !important;\n height: 1px !important;\n border: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n overflow: hidden !important;\n position: absolute !important;\n outline: 0 !important;\n left: 0px !important;\n top: 0px !important;\n}\n\n\n.ui-select-choices-row:hover {\n background-color: #f5f5f5;\n}\n\n/* Select2 theme */\n\n/* Mark invalid Select2 */\n.ng-dirty.ng-invalid > a.select2-choice {\n border-color: #D44950;\n}\n\n.select2-result-single {\n padding-left: 0;\n}\n\n.select2-locked > .select2-search-choice-close{\n display:none;\n}\n\n.select-locked > .ui-select-match-close{\n display:none;\n}\n\nbody > .select2-container.open {\n z-index: 9999; /* The z-index Select2 applies to the select2-drop */\n}\n\n/* Handle up direction Select2 */\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-match,\n.ui-select-container.select2.direction-up .ui-select-match {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-dropdown,\n.ui-select-container.select2.direction-up .ui-select-dropdown {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n\n border-top-width: 1px; /* FIXME hardcoded value :-/ */\n border-top-style: solid;\n\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n\n margin-top: -4px; /* FIXME hardcoded value :-/ */\n}\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-dropdown .select2-search,\n.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search {\n margin-top: 4px; /* FIXME hardcoded value :-/ */\n}\n.ui-select-container[theme=\"select2\"].direction-up.select2-dropdown-open .ui-select-match,\n.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match {\n border-bottom-color: #5897fb;\n}\n\n.ui-select-container[theme=\"select2\"] .ui-select-dropdown .ui-select-search-hidden,\n.ui-select-container[theme=\"select2\"] .ui-select-dropdown .ui-select-search-hidden input{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n}\n\n/* Selectize theme */\n\n/* Helper class to show styles when focus */\n.selectize-input.selectize-focus{\n border-color: #007FBB !important;\n}\n\n/* Fix input width for Selectize theme */\n.selectize-control.single > .selectize-input > input {\n width: 100%;\n}\n\n/* Fix line break when there's at least one item selected with the Selectize theme */\n.selectize-control.multi > .selectize-input > input {\n margin: 0 !important;\n}\n\n/* Fix dropdown width for Selectize theme */\n.selectize-control > .selectize-dropdown {\n width: 100%;\n}\n\n/* Mark invalid Selectize */\n.ng-dirty.ng-invalid > div.selectize-input {\n border-color: #D44950;\n}\n\n/* Handle up direction Selectize */\n.ui-select-container[theme=\"selectize\"].direction-up .ui-select-dropdown {\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n margin-top: -2px; /* FIXME hardcoded value :-/ */\n}\n\n.ui-select-container[theme=\"selectize\"] input.ui-select-search-hidden{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n width: 0;\n}\n\n/* Bootstrap theme */\n\n/* Helper class to show styles when focus */\n.btn-default-focus {\n color: #333;\n background-color: #EBEBEB;\n border-color: #ADADAD;\n text-decoration: none;\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: -2px;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n}\n\n.ui-select-bootstrap .ui-select-toggle {\n position: relative;\n}\n\n.ui-select-bootstrap .ui-select-toggle > .caret {\n position: absolute;\n height: 10px;\n top: 50%;\n right: 10px;\n margin-top: -2px;\n}\n\n/* Fix Bootstrap dropdown position when inside a input-group */\n.input-group > .ui-select-bootstrap.dropdown {\n /* Instead of relative */\n position: static;\n}\n\n.input-group > .ui-select-bootstrap > input.ui-select-search.form-control {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up {\n border-radius: 4px !important; /* FIXME hardcoded value :-/ */\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n}\n\n.ui-select-bootstrap .ui-select-search-hidden{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n}\n\n.ui-select-bootstrap > .ui-select-match > .btn{\n /* Instead of center because of .btn */\n text-align: left !important;\n}\n\n.ui-select-bootstrap > .ui-select-match > .caret {\n position: absolute;\n top: 45%;\n right: 15px;\n}\n\n/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */\n.ui-select-bootstrap > .ui-select-choices ,.ui-select-bootstrap > .ui-select-no-choice {\n width: 100%;\n height: auto;\n max-height: 200px;\n overflow-x: hidden;\n margin-top: -1px;\n}\n\nbody > .ui-select-bootstrap.open {\n z-index: 1000; /* Standard Bootstrap dropdown z-index */\n}\n\n.ui-select-multiple.ui-select-bootstrap {\n height: auto;\n padding: 3px 3px 0 3px;\n}\n\n.ui-select-multiple.ui-select-bootstrap input.ui-select-search {\n background-color: transparent !important; /* To prevent double background when disabled */\n border: none;\n outline: none;\n height: 1.666666em;\n margin-bottom: 3px;\n}\n\n.ui-select-multiple.ui-select-bootstrap .ui-select-match .close {\n font-size: 1.6em;\n line-height: 0.75;\n}\n\n.ui-select-multiple.ui-select-bootstrap .ui-select-match-item {\n outline: 0;\n margin: 0 3px 3px 0;\n}\n\n.ui-select-multiple .ui-select-match-item {\n position: relative;\n}\n\n.ui-select-multiple .ui-select-match-item.dropping .ui-select-match-close {\n pointer-events: none;\n}\n\n.ui-select-multiple:hover .ui-select-match-item.dropping-before:before {\n content: \"\";\n position: absolute;\n top: 0;\n right: 100%;\n height: 100%;\n margin-right: 2px;\n border-left: 1px solid #428bca;\n}\n\n.ui-select-multiple:hover .ui-select-match-item.dropping-after:after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 100%;\n height: 100%;\n margin-left: 2px;\n border-right: 1px solid #428bca;\n}\n\n.ui-select-bootstrap .ui-select-choices-row>span {\n cursor: pointer;\n display: block;\n padding: 3px 20px;\n clear: both;\n font-weight: 400;\n line-height: 1.42857143;\n color: #333;\n white-space: nowrap;\n}\n\n.ui-select-bootstrap .ui-select-choices-row>span:hover, .ui-select-bootstrap .ui-select-choices-row>span:focus {\n text-decoration: none;\n color: #262626;\n background-color: #f5f5f5;\n}\n\n.ui-select-bootstrap .ui-select-choices-row.active>span {\n color: #fff;\n text-decoration: none;\n outline: 0;\n background-color: #428bca;\n}\n\n.ui-select-bootstrap .ui-select-choices-row.disabled>span,\n.ui-select-bootstrap .ui-select-choices-row.active.disabled>span {\n color: #777;\n cursor: not-allowed;\n background-color: #fff;\n}\n\n/* fix hide/show angular animation */\n.ui-select-match.ng-hide-add,\n.ui-select-search.ng-hide-add {\n display: none !important;\n}\n\n/* Mark invalid Bootstrap */\n.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match {\n border-color: #D44950;\n}\n\n/* Handle up direction Bootstrap */\n.ui-select-container[theme=\"bootstrap\"].direction-up .ui-select-dropdown {\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n}\n\n.ui-select-bootstrap .ui-select-match-text {\n width: 100%;\n padding-right: 1em;\n}\n.ui-select-bootstrap .ui-select-match-text span {\n display: inline-block;\n width: 100%;\n overflow: hidden;\n}\n.ui-select-bootstrap .ui-select-toggle > a.btn {\n position: absolute;\n height: 10px;\n right: 10px;\n margin-top: -2px;\n}\n\n/* Spinner */\n.ui-select-refreshing {\n position: absolute;\n right: 0;\n padding: 8px 27px;\n top: 1px;\n display: inline-block;\n font-family: 'Glyphicons Halflings';\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n -webkit-font-smoothing:antialiased;\n }\n \n@-webkit-keyframes ui-select-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n@keyframes ui-select-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n.ui-select-spin {\n -webkit-animation: ui-select-spin 2s infinite linear;\n animation: ui-select-spin 2s infinite linear;\n}\n\n.ui-select-refreshing.ng-animate {\n -webkit-animation: none 0s;\n} "],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist000/select.min.js b/dist000/select.min.js new file mode 100644 index 000000000..4c855a88b --- /dev/null +++ b/dist000/select.min.js @@ -0,0 +1,2 @@ +(function(){"use strict";var KEY={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 k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true}if(e.metaKey||e.ctrlKey||e.altKey)return true;return false},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0||typeof ctrl.selected=="object"&&!ctrl.selected.id};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[]; +$scope.$evalAsync(function(){ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset= 112 && k <= 123;\n },\n isVerticalMovement: function (k){\n return ~[KEY.UP, KEY.DOWN].indexOf(k);\n },\n isHorizontalMovement: function (k){\n return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k);\n },\n toSeparator: function (k) {\n var sep = {ENTER:\"\\n\",TAB:\"\\t\",SPACE:\" \"}[k];\n if (sep) return sep;\n // return undefined for special keys other than enter, tab or space.\n // no way to use them to cut strings.\n return KEY[k] ? undefined : k;\n }\n };\n\n/**\n * Add querySelectorAll() to jqLite.\n *\n * jqLite find() is limited to lookups by tag name.\n * TODO This will change with future versions of AngularJS, to be removed when this happens\n *\n * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586\n * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598\n */\nif (angular.element.prototype.querySelectorAll === undefined) {\n angular.element.prototype.querySelectorAll = function(selector) {\n return angular.element(this[0].querySelectorAll(selector));\n };\n}\n\n/**\n * Add closest() to jqLite.\n */\nif (angular.element.prototype.closest === undefined) {\n angular.element.prototype.closest = function( selector) {\n var elem = this[0];\n var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;\n\n while (elem) {\n if (matchesSelector.bind(elem)(selector)) {\n return elem;\n } else {\n elem = elem.parentElement;\n }\n }\n return false;\n };\n}\n\nvar latestId = 0;\n\nvar uis = angular.module('ui.select', [])\n\n.constant('uiSelectConfig', {\n theme: 'bootstrap',\n searchEnabled: true,\n sortable: false,\n placeholder: '', // Empty by default, like HTML tag \");\n $compile(focusser)(scope);\n $select.focusser = focusser;\n\n //Input that will handle focus\n $select.focusInput = focusser;\n\n element.parent().append(focusser);\n focusser.bind(\"focus\", function(){\n scope.$evalAsync(function(){\n $select.focus = true;\n });\n });\n focusser.bind(\"blur\", function(){\n scope.$evalAsync(function(){\n $select.focus = false;\n });\n });\n focusser.bind(\"keydown\", function(e){\n\n if (e.which === KEY.BACKSPACE) {\n e.preventDefault();\n e.stopPropagation();\n $select.select(undefined);\n scope.$apply();\n return;\n }\n\n if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {\n return;\n }\n\n if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){\n e.preventDefault();\n e.stopPropagation();\n $select.activate();\n }\n\n scope.$digest();\n });\n\n focusser.bind(\"keyup input\", function(e){\n\n if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) {\n return;\n }\n\n $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input\n focusser.val('');\n scope.$digest();\n\n });\n\n\n }\n };\n}]);\n\n// Make multiple matches sortable\nuis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) {\n return {\n require: ['^^uiSelect', '^ngModel'],\n link: function(scope, element, attrs, ctrls) {\n if (scope[attrs.uiSelectSort] === null) {\n throw uiSelectMinErr('sort', 'Expected a list to sort');\n }\n\n var $select = ctrls[0];\n var $ngModel = ctrls[1];\n\n var options = angular.extend({\n axis: 'horizontal'\n },\n scope.$eval(attrs.uiSelectSortOptions));\n\n var axis = options.axis;\n var draggingClassName = 'dragging';\n var droppingClassName = 'dropping';\n var droppingBeforeClassName = 'dropping-before';\n var droppingAfterClassName = 'dropping-after';\n\n scope.$watch(function(){\n return $select.sortable;\n }, function(newValue){\n if (newValue) {\n element.attr('draggable', true);\n } else {\n element.removeAttr('draggable');\n }\n });\n\n element.on('dragstart', function(event) {\n element.addClass(draggingClassName);\n\n (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString());\n });\n\n element.on('dragend', function() {\n removeClass(draggingClassName);\n });\n\n var move = function(from, to) {\n /*jshint validthis: true */\n this.splice(to, 0, this.splice(from, 1)[0]);\n };\n\n var removeClass = function(className) {\n angular.forEach($select.$element.querySelectorAll('.' + className), function(el){\n angular.element(el).removeClass(className);\n });\n };\n\n var dragOverHandler = function(event) {\n event.preventDefault();\n\n var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0);\n\n if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) {\n removeClass(droppingAfterClassName);\n element.addClass(droppingBeforeClassName);\n\n } else {\n removeClass(droppingBeforeClassName);\n element.addClass(droppingAfterClassName);\n }\n };\n\n var dropTimeout;\n\n var dropHandler = function(event) {\n event.preventDefault();\n\n var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10);\n\n // prevent event firing multiple times in firefox\n $timeout.cancel(dropTimeout);\n dropTimeout = $timeout(function() {\n _dropHandler(droppedItemIndex);\n }, 20);\n };\n\n var _dropHandler = function(droppedItemIndex) {\n var theList = scope.$eval(attrs.uiSelectSort);\n var itemToMove = theList[droppedItemIndex];\n var newIndex = null;\n\n if (element.hasClass(droppingBeforeClassName)) {\n if (droppedItemIndex < scope.$index) {\n newIndex = scope.$index - 1;\n } else {\n newIndex = scope.$index;\n }\n } else {\n if (droppedItemIndex < scope.$index) {\n newIndex = scope.$index;\n } else {\n newIndex = scope.$index + 1;\n }\n }\n\n move.apply(theList, [droppedItemIndex, newIndex]);\n\n $ngModel.$setViewValue(Date.now());\n\n scope.$apply(function() {\n scope.$emit('uiSelectSort:change', {\n array: theList,\n item: itemToMove,\n from: droppedItemIndex,\n to: newIndex\n });\n });\n\n removeClass(droppingClassName);\n removeClass(droppingBeforeClassName);\n removeClass(droppingAfterClassName);\n\n element.off('drop', dropHandler);\n };\n\n element.on('dragenter', function() {\n if (element.hasClass(draggingClassName)) {\n return;\n }\n\n element.addClass(droppingClassName);\n\n element.on('dragover', dragOverHandler);\n element.on('drop', dropHandler);\n });\n\n element.on('dragleave', function(event) {\n if (event.target != element) {\n return;\n }\n\n removeClass(droppingClassName);\n removeClass(droppingBeforeClassName);\n removeClass(droppingAfterClassName);\n\n element.off('dragover', dragOverHandler);\n element.off('drop', dropHandler);\n });\n }\n };\n}]);\n\n/**\n * Debounces functions\n *\n * Taken from UI Bootstrap $$debounce source code\n * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js\n *\n */\nuis.factory('$$uisDebounce', ['$timeout', function($timeout) {\n return function(callback, debounceTime) {\n var timeoutPromise;\n\n return function() {\n var self = this;\n var args = Array.prototype.slice.call(arguments);\n if (timeoutPromise) {\n $timeout.cancel(timeoutPromise);\n }\n\n timeoutPromise = $timeout(function() {\n callback.apply(self, args);\n }, debounceTime);\n };\n };\n}]);\n\nuis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) {\n return {\n restrict: 'A',\n require: 'uiSelect',\n link: function (scope, element, attrs, $select) {\n $select.onOpenCloseCallback = $parse(attrs.uisOpenClose);\n\n scope.$watch('$select.open', function (isOpen, previousState) {\n if (isOpen !== previousState) {\n $timeout(function () {\n $select.onOpenCloseCallback(scope, {\n isOpen: isOpen\n });\n });\n }\n });\n }\n };\n}]);\n\n/**\n * Parses \"repeat\" attribute.\n *\n * Taken from AngularJS ngRepeat source code\n * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211\n *\n * Original discussion about parsing \"repeat\" attribute instead of fully relying on ng-repeat:\n * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697\n */\n\nuis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) {\n var self = this;\n\n /**\n * Example:\n * expression = \"address in addresses | filter: {street: $select.search} track by $index\"\n * itemName = \"address\",\n * source = \"addresses | filter: {street: $select.search}\",\n * trackByExp = \"$index\",\n */\n self.parse = function(expression) {\n\n\n var match;\n //var isObjectCollection = /\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)/.test(expression);\n // If an array is used as collection\n\n // if (isObjectCollection){\n // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000\n match = expression.match(/^\\s*(?:([\\s\\S]+?)\\s+as\\s+)?(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+(\\s*[\\s\\S]+?)?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n // 1 Alias\n // 2 Item\n // 3 Key on (key,value)\n // 4 Value on (key,value)\n // 5 Source expression (including filters)\n // 6 Track by\n\n if (!match) {\n throw uiSelectMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n expression);\n }\n \n var source = match[5], \n filters = '';\n\n // When using (key,value) ui-select requires filters to be extracted, since the object\n // is converted to an array for $select.items \n // (in which case the filters need to be reapplied)\n if (match[3]) {\n // Remove any enclosing parenthesis\n source = match[5].replace(/(^\\()|(\\)$)/g, '');\n // match all after | but not after ||\n var filterMatch = match[5].match(/^\\s*(?:[\\s\\S]+?)(?:[^\\|]|\\|\\|)+([\\s\\S]*)\\s*$/);\n if(filterMatch && filterMatch[1].trim()) {\n filters = filterMatch[1];\n source = source.replace(filters, '');\n } \n }\n\n return {\n itemName: match[4] || match[2], // (lhs) Left-hand side,\n keyName: match[3], //for (key, value) syntax\n source: $parse(source),\n filters: filters,\n trackByExp: match[6],\n modelMapper: $parse(match[1] || match[4] || match[2]),\n repeatExpression: function (grouped) {\n var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items');\n if (this.trackByExp) {\n expression += ' track by ' + this.trackByExp;\n }\n return expression;\n } \n };\n\n };\n\n self.getGroupNgRepeatExpression = function() {\n return '$group in $select.groups track by $group.name';\n };\n\n}]);\n\n}());\nangular.module(\"ui.select\").run([\"$templateCache\", function($templateCache) {$templateCache.put(\"bootstrap/choices.tpl.html\",\"
      0\\\">
    • 0\\\">
    \");\n$templateCache.put(\"bootstrap/match-multiple.tpl.html\",\" × \");\n$templateCache.put(\"bootstrap/match.tpl.html\",\"
    {{$select.placeholder}}
    \");\n$templateCache.put(\"bootstrap/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"bootstrap/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"bootstrap/select.tpl.html\",\"
    \");\n$templateCache.put(\"select2/choices.tpl.html\",\"
    \");\n$templateCache.put(\"select2/match-multiple.tpl.html\",\"
  • \");\n$templateCache.put(\"select2/match.tpl.html\",\"{{$select.placeholder}} \");\n$templateCache.put(\"select2/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"select2/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"select2/select.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/choices.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/match-multiple.tpl.html\",\"
    ×
    \");\n$templateCache.put(\"selectize/match.tpl.html\",\"
    {{$select.placeholder}}
    \");\n$templateCache.put(\"selectize/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/select.tpl.html\",\"
    \");}]);",null,null],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/select.min.js000 b/dist000/select.min.js000 similarity index 100% rename from dist/select.min.js000 rename to dist000/select.min.js000 From 992074f85a5a10b67f4be8027685da09278c2b92 Mon Sep 17 00:00:00 2001 From: Mikhail Che Date: Thu, 8 Dec 2016 17:13:25 +0500 Subject: [PATCH 08/10] commit --- dist000/from-boostrap.css | 38 - dist000/materialize/choices.tpl.html | 13 - dist000/materialize/match-multiple.tpl.html | 2 - dist000/materialize/match.tpl.html | 12 - dist000/materialize/no-choice.tpl.html | 3 - dist000/materialize/select-multiple.tpl.html | 8 - dist000/materialize/select.tpl.html | 8 - dist000/select.css | 369 --- dist000/select.js | 2393 ------------------ dist000/select.js000 | 2393 ------------------ dist000/select.min.css | 7 - dist000/select.min.css.map | 1 - dist000/select.min.js | 2 - dist000/select.min.js.map | 1 - dist000/select.min.js000 | 2 - 15 files changed, 5252 deletions(-) delete mode 100644 dist000/from-boostrap.css delete mode 100644 dist000/materialize/choices.tpl.html delete mode 100644 dist000/materialize/match-multiple.tpl.html delete mode 100644 dist000/materialize/match.tpl.html delete mode 100644 dist000/materialize/no-choice.tpl.html delete mode 100644 dist000/materialize/select-multiple.tpl.html delete mode 100644 dist000/materialize/select.tpl.html delete mode 100644 dist000/select.css delete mode 100644 dist000/select.js delete mode 100644 dist000/select.js000 delete mode 100644 dist000/select.min.css delete mode 100644 dist000/select.min.css.map delete mode 100644 dist000/select.min.js delete mode 100644 dist000/select.min.js.map delete mode 100644 dist000/select.min.js000 diff --git a/dist000/from-boostrap.css b/dist000/from-boostrap.css deleted file mode 100644 index 4ca0caf6d..000000000 --- a/dist000/from-boostrap.css +++ /dev/null @@ -1,38 +0,0 @@ -.ui-select-match { - -} - -.ui-select-match-text { - border-bottom: 1px solid; - cursor:pointer; -} - -/* copy-paste from the bootstrap.css */ - -.dropdown { - position: relative; -} - -.dropdown-menu { - background-clip: padding-box; - background-color: #fff; - border: 1px solid rgba(0, 0, 0, 0.15); - /*border-radius: 4px;*/ - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176); - display: none; - float: left; - /*font-size: 14px;*/ - left: 0; - list-style: outside none none; - margin: 2px 0 0; - min-width: 160px; - padding: 5px 0; - position: absolute; - top: 100%; - z-index: 1000; -} - - -.open > .dropdown-menu { - display: block; -} diff --git a/dist000/materialize/choices.tpl.html b/dist000/materialize/choices.tpl.html deleted file mode 100644 index ec5261c89..000000000 --- a/dist000/materialize/choices.tpl.html +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/dist000/materialize/match-multiple.tpl.html b/dist000/materialize/match-multiple.tpl.html deleted file mode 100644 index c5139d328..000000000 --- a/dist000/materialize/match-multiple.tpl.html +++ /dev/null @@ -1,2 +0,0 @@ - × - \ No newline at end of file diff --git a/dist000/materialize/match.tpl.html b/dist000/materialize/match.tpl.html deleted file mode 100644 index 1da23c445..000000000 --- a/dist000/materialize/match.tpl.html +++ /dev/null @@ -1,12 +0,0 @@ -
    - - {{$select.placeholder}} - - - - - - - - -
    \ No newline at end of file diff --git a/dist000/materialize/no-choice.tpl.html b/dist000/materialize/no-choice.tpl.html deleted file mode 100644 index 4772912fa..000000000 --- a/dist000/materialize/no-choice.tpl.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/dist000/materialize/select-multiple.tpl.html b/dist000/materialize/select-multiple.tpl.html deleted file mode 100644 index 53f89be66..000000000 --- a/dist000/materialize/select-multiple.tpl.html +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/dist000/materialize/select.tpl.html b/dist000/materialize/select.tpl.html deleted file mode 100644 index dd107c7d9..000000000 --- a/dist000/materialize/select.tpl.html +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/dist000/select.css b/dist000/select.css deleted file mode 100644 index b4541adec..000000000 --- a/dist000/select.css +++ /dev/null @@ -1,369 +0,0 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.5 - 2016-10-24T23:13:59.551Z - * License: MIT - */ - - -/* Style when highlighting a search. */ -.ui-select-highlight { - font-weight: bold; -} - -.ui-select-offscreen { - clip: rect(0 0 0 0) !important; - width: 1px !important; - height: 1px !important; - border: 0 !important; - margin: 0 !important; - padding: 0 !important; - overflow: hidden !important; - position: absolute !important; - outline: 0 !important; - left: 0px !important; - top: 0px !important; -} - - -.ui-select-choices-row:hover { - background-color: #f5f5f5; -} - -/* Select2 theme */ - -/* Mark invalid Select2 */ -.ng-dirty.ng-invalid > a.select2-choice { - border-color: #D44950; -} - -.select2-result-single { - padding-left: 0; -} - -.select2-locked > .select2-search-choice-close{ - display:none; -} - -.select-locked > .ui-select-match-close{ - display:none; -} - -body > .select2-container.open { - z-index: 9999; /* The z-index Select2 applies to the select2-drop */ -} - -/* Handle up direction Select2 */ -.ui-select-container[theme="select2"].direction-up .ui-select-match, -.ui-select-container.select2.direction-up .ui-select-match { - border-radius: 4px; /* FIXME hardcoded value :-/ */ - border-top-left-radius: 0; - border-top-right-radius: 0; -} -.ui-select-container[theme="select2"].direction-up .ui-select-dropdown, -.ui-select-container.select2.direction-up .ui-select-dropdown { - border-radius: 4px; /* FIXME hardcoded value :-/ */ - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - - border-top-width: 1px; /* FIXME hardcoded value :-/ */ - border-top-style: solid; - - box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); - - margin-top: -4px; /* FIXME hardcoded value :-/ */ -} -.ui-select-container[theme="select2"].direction-up .ui-select-dropdown .select2-search, -.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search { - margin-top: 4px; /* FIXME hardcoded value :-/ */ -} -.ui-select-container[theme="select2"].direction-up.select2-dropdown-open .ui-select-match, -.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match { - border-bottom-color: #5897fb; -} - -.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden, -.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden input{ - opacity: 0; - height: 0; - min-height: 0; - padding: 0; - margin: 0; - border:0; -} - -/* Selectize theme */ - -/* Helper class to show styles when focus */ -.selectize-input.selectize-focus{ - border-color: #007FBB !important; -} - -/* Fix input width for Selectize theme */ -.selectize-control.single > .selectize-input > input { - width: 100%; -} - -/* Fix line break when there's at least one item selected with the Selectize theme */ -.selectize-control.multi > .selectize-input > input { - margin: 0 !important; -} - -/* Fix dropdown width for Selectize theme */ -.selectize-control > .selectize-dropdown { - width: 100%; -} - -/* Mark invalid Selectize */ -.ng-dirty.ng-invalid > div.selectize-input { - border-color: #D44950; -} - -/* Handle up direction Selectize */ -.ui-select-container[theme="selectize"].direction-up .ui-select-dropdown { - box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); - margin-top: -2px; /* FIXME hardcoded value :-/ */ -} - -.ui-select-container[theme="selectize"] input.ui-select-search-hidden{ - opacity: 0; - height: 0; - min-height: 0; - padding: 0; - margin: 0; - border:0; - width: 0; -} - -/* Bootstrap theme */ - -/* Helper class to show styles when focus */ -.btn-default-focus { - color: #333; - background-color: #EBEBEB; - border-color: #ADADAD; - text-decoration: none; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); -} - -.ui-select-bootstrap .ui-select-toggle { - position: relative; -} - -.ui-select-bootstrap .ui-select-toggle > .caret { - position: absolute; - height: 10px; - top: 50%; - right: 10px; - margin-top: -2px; -} - -/* Fix Bootstrap dropdown position when inside a input-group */ -.input-group > .ui-select-bootstrap.dropdown { - /* Instead of relative */ - position: static; -} - -.input-group > .ui-select-bootstrap > input.ui-select-search.form-control { - border-radius: 4px; /* FIXME hardcoded value :-/ */ - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} -.input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up { - border-radius: 4px !important; /* FIXME hardcoded value :-/ */ - border-top-right-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -.ui-select-bootstrap .ui-select-search-hidden{ - opacity: 0; - height: 0; - min-height: 0; - padding: 0; - margin: 0; - border:0; -} - -.ui-select-bootstrap > .ui-select-match > .btn{ - /* Instead of center because of .btn */ - text-align: left !important; -} - -.ui-select-bootstrap > .ui-select-match > .caret { - position: absolute; - top: 45%; - right: 15px; -} - -/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */ -.ui-select-bootstrap > .ui-select-choices ,.ui-select-bootstrap > .ui-select-no-choice { - width: 100%; - height: auto; - max-height: 200px; - overflow-x: hidden; - margin-top: -1px; -} - -body > .ui-select-bootstrap.open { - z-index: 1000; /* Standard Bootstrap dropdown z-index */ -} - -.ui-select-multiple.ui-select-bootstrap { - height: auto; - padding: 3px 3px 0 3px; -} - -.ui-select-multiple.ui-select-bootstrap input.ui-select-search { - background-color: transparent !important; /* To prevent double background when disabled */ - border: none; - outline: none; - height: 1.666666em; - margin-bottom: 3px; -} - -.ui-select-multiple.ui-select-bootstrap .ui-select-match .close { - font-size: 1.6em; - line-height: 0.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 .ui-select-match-close { - pointer-events: none; -} - -.ui-select-multiple:hover .ui-select-match-item.dropping-before:before { - content: ""; - position: absolute; - top: 0; - right: 100%; - height: 100%; - margin-right: 2px; - border-left: 1px solid #428bca; -} - -.ui-select-multiple:hover .ui-select-match-item.dropping-after:after { - content: ""; - position: absolute; - top: 0; - left: 100%; - height: 100%; - margin-left: 2px; - border-right: 1px solid #428bca; -} - -.ui-select-bootstrap .ui-select-choices-row>span { - cursor: pointer; - display: block; - padding: 3px 20px; - clear: both; - font-weight: 400; - line-height: 1.42857143; - color: #333; - white-space: nowrap; -} - -.ui-select-bootstrap .ui-select-choices-row>span:hover, .ui-select-bootstrap .ui-select-choices-row>span:focus { - text-decoration: none; - color: #262626; - background-color: #f5f5f5; -} - -.ui-select-bootstrap .ui-select-choices-row.active>span { - color: #fff; - text-decoration: none; - outline: 0; - background-color: #428bca; -} - -.ui-select-bootstrap .ui-select-choices-row.disabled>span, -.ui-select-bootstrap .ui-select-choices-row.active.disabled>span { - color: #777; - cursor: not-allowed; - background-color: #fff; -} - -/* fix hide/show angular animation */ -.ui-select-match.ng-hide-add, -.ui-select-search.ng-hide-add { - display: none !important; -} - -/* Mark invalid Bootstrap */ -.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match { - border-color: #D44950; -} - -/* Handle up direction Bootstrap */ -.ui-select-container[theme="bootstrap"].direction-up .ui-select-dropdown { - box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); -} - -.ui-select-bootstrap .ui-select-match-text { - width: 100%; - padding-right: 1em; -} -.ui-select-bootstrap .ui-select-match-text span { - display: inline-block; - width: 100%; - overflow: hidden; -} -.ui-select-bootstrap .ui-select-toggle > a.btn { - position: absolute; - height: 10px; - right: 10px; - margin-top: -2px; -} - -/* Spinner */ -.ui-select-refreshing { - position: absolute; - right: 0; - padding: 8px 27px; - top: 1px; - display: inline-block; - font-family: 'Glyphicons Halflings'; - font-style: normal; - font-weight: normal; - line-height: 1; - -webkit-font-smoothing:antialiased; - } - -@-webkit-keyframes ui-select-spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} -@keyframes ui-select-spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); - } -} - -.ui-select-spin { - -webkit-animation: ui-select-spin 2s infinite linear; - animation: ui-select-spin 2s infinite linear; -} - -.ui-select-refreshing.ng-animate { - -webkit-animation: none 0s; -} \ No newline at end of file diff --git a/dist000/select.js b/dist000/select.js deleted file mode 100644 index 510fed83f..000000000 --- a/dist000/select.js +++ /dev/null @@ -1,2393 +0,0 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.5 - 2016-10-24T23:13:59.434Z - * License: MIT - */ - - -(function () { -"use strict"; -var KEY = { - 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 k = e.which; - switch (k) { - case KEY.COMMAND: - case KEY.SHIFT: - case KEY.CTRL: - case KEY.ALT: - return true; - } - - if (e.metaKey || e.ctrlKey || e.altKey) return true; - - return false; - }, - isFunctionKey: function (k) { - k = k.which ? k.which : k; - return k >= 112 && k <= 123; - }, - isVerticalMovement: function (k){ - return ~[KEY.UP, KEY.DOWN].indexOf(k); - }, - isHorizontalMovement: function (k){ - return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k); - }, - toSeparator: function (k) { - var sep = {ENTER:"\n",TAB:"\t",SPACE:" "}[k]; - if (sep) return sep; - // return undefined for special keys other than enter, tab or space. - // no way to use them to cut strings. - return KEY[k] ? undefined : k; - } - }; - -/** - * Add querySelectorAll() to jqLite. - * - * jqLite find() is limited to lookups by tag name. - * TODO This will change with future versions of AngularJS, to be removed when this happens - * - * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586 - * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598 - */ -if (angular.element.prototype.querySelectorAll === undefined) { - angular.element.prototype.querySelectorAll = function(selector) { - return angular.element(this[0].querySelectorAll(selector)); - }; -} - -/** - * Add closest() to jqLite. - */ -if (angular.element.prototype.closest === undefined) { - angular.element.prototype.closest = function( selector) { - var elem = this[0]; - var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; - - while (elem) { - if (matchesSelector.bind(elem)(selector)) { - return elem; - } else { - elem = elem.parentElement; - } - } - return false; - }; -} - -var latestId = 0; - -var uis = angular.module('ui.select', []) - -.constant('uiSelectConfig', { - theme: 'bootstrap', - searchEnabled: true, - sortable: false, - placeholder: '', // Empty by default, like HTML tag "); - $compile(focusser)(scope); - $select.focusser = focusser; - - //Input that will handle focus - $select.focusInput = focusser; - - element.parent().append(focusser); - focusser.bind("focus", function(){ - scope.$evalAsync(function(){ - $select.focus = true; - }); - }); - focusser.bind("blur", function(){ - scope.$evalAsync(function(){ - $select.focus = false; - }); - }); - focusser.bind("keydown", function(e){ - - if (e.which === KEY.BACKSPACE) { - e.preventDefault(); - e.stopPropagation(); - $select.select(undefined); - scope.$apply(); - return; - } - - if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) { - return; - } - - if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){ - e.preventDefault(); - e.stopPropagation(); - $select.activate(); - } - - scope.$digest(); - }); - - focusser.bind("keyup input", function(e){ - - if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) { - return; - } - - $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input - focusser.val(''); - scope.$digest(); - - }); - - - } - }; -}]); - -// Make multiple matches sortable -uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) { - return { - require: ['^^uiSelect', '^ngModel'], - link: function(scope, element, attrs, ctrls) { - if (scope[attrs.uiSelectSort] === null) { - throw uiSelectMinErr('sort', 'Expected a list to sort'); - } - - var $select = ctrls[0]; - var $ngModel = ctrls[1]; - - var options = angular.extend({ - axis: 'horizontal' - }, - scope.$eval(attrs.uiSelectSortOptions)); - - var axis = options.axis; - var draggingClassName = 'dragging'; - var droppingClassName = 'dropping'; - var droppingBeforeClassName = 'dropping-before'; - var droppingAfterClassName = 'dropping-after'; - - scope.$watch(function(){ - return $select.sortable; - }, function(newValue){ - if (newValue) { - element.attr('draggable', true); - } else { - element.removeAttr('draggable'); - } - }); - - element.on('dragstart', function(event) { - element.addClass(draggingClassName); - - (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString()); - }); - - element.on('dragend', function() { - removeClass(draggingClassName); - }); - - var move = function(from, to) { - /*jshint validthis: true */ - this.splice(to, 0, this.splice(from, 1)[0]); - }; - - var removeClass = function(className) { - angular.forEach($select.$element.querySelectorAll('.' + className), function(el){ - angular.element(el).removeClass(className); - }); - }; - - var dragOverHandler = function(event) { - event.preventDefault(); - - var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0); - - if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) { - removeClass(droppingAfterClassName); - element.addClass(droppingBeforeClassName); - - } else { - removeClass(droppingBeforeClassName); - element.addClass(droppingAfterClassName); - } - }; - - var dropTimeout; - - var dropHandler = function(event) { - event.preventDefault(); - - var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10); - - // prevent event firing multiple times in firefox - $timeout.cancel(dropTimeout); - dropTimeout = $timeout(function() { - _dropHandler(droppedItemIndex); - }, 20); - }; - - var _dropHandler = function(droppedItemIndex) { - var theList = scope.$eval(attrs.uiSelectSort); - var itemToMove = theList[droppedItemIndex]; - var newIndex = null; - - if (element.hasClass(droppingBeforeClassName)) { - if (droppedItemIndex < scope.$index) { - newIndex = scope.$index - 1; - } else { - newIndex = scope.$index; - } - } else { - if (droppedItemIndex < scope.$index) { - newIndex = scope.$index; - } else { - newIndex = scope.$index + 1; - } - } - - move.apply(theList, [droppedItemIndex, newIndex]); - - $ngModel.$setViewValue(Date.now()); - - scope.$apply(function() { - scope.$emit('uiSelectSort:change', { - array: theList, - item: itemToMove, - from: droppedItemIndex, - to: newIndex - }); - }); - - removeClass(droppingClassName); - removeClass(droppingBeforeClassName); - removeClass(droppingAfterClassName); - - element.off('drop', dropHandler); - }; - - element.on('dragenter', function() { - if (element.hasClass(draggingClassName)) { - return; - } - - element.addClass(droppingClassName); - - element.on('dragover', dragOverHandler); - element.on('drop', dropHandler); - }); - - element.on('dragleave', function(event) { - if (event.target != element) { - return; - } - - removeClass(droppingClassName); - removeClass(droppingBeforeClassName); - removeClass(droppingAfterClassName); - - element.off('dragover', dragOverHandler); - element.off('drop', dropHandler); - }); - } - }; -}]); - -/** - * Debounces functions - * - * Taken from UI Bootstrap $$debounce source code - * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js - * - */ -uis.factory('$$uisDebounce', ['$timeout', function($timeout) { - return function(callback, debounceTime) { - var timeoutPromise; - - return function() { - var self = this; - var args = Array.prototype.slice.call(arguments); - if (timeoutPromise) { - $timeout.cancel(timeoutPromise); - } - - timeoutPromise = $timeout(function() { - callback.apply(self, args); - }, debounceTime); - }; - }; -}]); - -uis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) { - return { - restrict: 'A', - require: 'uiSelect', - link: function (scope, element, attrs, $select) { - $select.onOpenCloseCallback = $parse(attrs.uisOpenClose); - - scope.$watch('$select.open', function (isOpen, previousState) { - if (isOpen !== previousState) { - $timeout(function () { - $select.onOpenCloseCallback(scope, { - isOpen: isOpen - }); - }); - } - }); - } - }; -}]); - -/** - * Parses "repeat" attribute. - * - * Taken from AngularJS ngRepeat source code - * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211 - * - * Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat: - * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697 - */ - -uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) { - var self = this; - - /** - * Example: - * expression = "address in addresses | filter: {street: $select.search} track by $index" - * itemName = "address", - * source = "addresses | filter: {street: $select.search}", - * trackByExp = "$index", - */ - self.parse = function(expression) { - - - var match; - //var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression); - // If an array is used as collection - - // if (isObjectCollection){ - // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000 - match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/); - - // 1 Alias - // 2 Item - // 3 Key on (key,value) - // 4 Value on (key,value) - // 5 Source expression (including filters) - // 6 Track by - - if (!match) { - throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", - expression); - } - - var source = match[5], - filters = ''; - - // When using (key,value) ui-select requires filters to be extracted, since the object - // is converted to an array for $select.items - // (in which case the filters need to be reapplied) - if (match[3]) { - // Remove any enclosing parenthesis - source = match[5].replace(/(^\()|(\)$)/g, ''); - // match all after | but not after || - var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/); - if(filterMatch && filterMatch[1].trim()) { - filters = filterMatch[1]; - source = source.replace(filters, ''); - } - } - - return { - itemName: match[4] || match[2], // (lhs) Left-hand side, - keyName: match[3], //for (key, value) syntax - source: $parse(source), - filters: filters, - trackByExp: match[6], - modelMapper: $parse(match[1] || match[4] || match[2]), - repeatExpression: function (grouped) { - var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items'); - if (this.trackByExp) { - expression += ' track by ' + this.trackByExp; - } - return expression; - } - }; - - }; - - self.getGroupNgRepeatExpression = function() { - return '$group in $select.groups track by $group.name'; - }; - -}]); - -}()); -//~ angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
      0\">
    • 0\">
    "); -//~ $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); -//~ $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("select2/choices.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("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 diff --git a/dist000/select.js000 b/dist000/select.js000 deleted file mode 100644 index e8e1948b7..000000000 --- a/dist000/select.js000 +++ /dev/null @@ -1,2393 +0,0 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.5 - 2016-10-24T23:13:59.434Z - * License: MIT - */ - - -(function () { -"use strict"; -var KEY = { - 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 k = e.which; - switch (k) { - case KEY.COMMAND: - case KEY.SHIFT: - case KEY.CTRL: - case KEY.ALT: - return true; - } - - if (e.metaKey || e.ctrlKey || e.altKey) return true; - - return false; - }, - isFunctionKey: function (k) { - k = k.which ? k.which : k; - return k >= 112 && k <= 123; - }, - isVerticalMovement: function (k){ - return ~[KEY.UP, KEY.DOWN].indexOf(k); - }, - isHorizontalMovement: function (k){ - return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k); - }, - toSeparator: function (k) { - var sep = {ENTER:"\n",TAB:"\t",SPACE:" "}[k]; - if (sep) return sep; - // return undefined for special keys other than enter, tab or space. - // no way to use them to cut strings. - return KEY[k] ? undefined : k; - } - }; - -/** - * Add querySelectorAll() to jqLite. - * - * jqLite find() is limited to lookups by tag name. - * TODO This will change with future versions of AngularJS, to be removed when this happens - * - * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586 - * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598 - */ -if (angular.element.prototype.querySelectorAll === undefined) { - angular.element.prototype.querySelectorAll = function(selector) { - return angular.element(this[0].querySelectorAll(selector)); - }; -} - -/** - * Add closest() to jqLite. - */ -if (angular.element.prototype.closest === undefined) { - angular.element.prototype.closest = function( selector) { - var elem = this[0]; - var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; - - while (elem) { - if (matchesSelector.bind(elem)(selector)) { - return elem; - } else { - elem = elem.parentElement; - } - } - return false; - }; -} - -var latestId = 0; - -var uis = angular.module('ui.select', []) - -.constant('uiSelectConfig', { - theme: 'bootstrap', - searchEnabled: true, - sortable: false, - placeholder: '', // Empty by default, like HTML tag "); - $compile(focusser)(scope); - $select.focusser = focusser; - - //Input that will handle focus - $select.focusInput = focusser; - - element.parent().append(focusser); - focusser.bind("focus", function(){ - scope.$evalAsync(function(){ - $select.focus = true; - }); - }); - focusser.bind("blur", function(){ - scope.$evalAsync(function(){ - $select.focus = false; - }); - }); - focusser.bind("keydown", function(e){ - - if (e.which === KEY.BACKSPACE) { - e.preventDefault(); - e.stopPropagation(); - $select.select(undefined); - scope.$apply(); - return; - } - - if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) { - return; - } - - if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){ - e.preventDefault(); - e.stopPropagation(); - $select.activate(); - } - - scope.$digest(); - }); - - focusser.bind("keyup input", function(e){ - - if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) { - return; - } - - $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input - focusser.val(''); - scope.$digest(); - - }); - - - } - }; -}]); - -// Make multiple matches sortable -uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) { - return { - require: ['^^uiSelect', '^ngModel'], - link: function(scope, element, attrs, ctrls) { - if (scope[attrs.uiSelectSort] === null) { - throw uiSelectMinErr('sort', 'Expected a list to sort'); - } - - var $select = ctrls[0]; - var $ngModel = ctrls[1]; - - var options = angular.extend({ - axis: 'horizontal' - }, - scope.$eval(attrs.uiSelectSortOptions)); - - var axis = options.axis; - var draggingClassName = 'dragging'; - var droppingClassName = 'dropping'; - var droppingBeforeClassName = 'dropping-before'; - var droppingAfterClassName = 'dropping-after'; - - scope.$watch(function(){ - return $select.sortable; - }, function(newValue){ - if (newValue) { - element.attr('draggable', true); - } else { - element.removeAttr('draggable'); - } - }); - - element.on('dragstart', function(event) { - element.addClass(draggingClassName); - - (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString()); - }); - - element.on('dragend', function() { - removeClass(draggingClassName); - }); - - var move = function(from, to) { - /*jshint validthis: true */ - this.splice(to, 0, this.splice(from, 1)[0]); - }; - - var removeClass = function(className) { - angular.forEach($select.$element.querySelectorAll('.' + className), function(el){ - angular.element(el).removeClass(className); - }); - }; - - var dragOverHandler = function(event) { - event.preventDefault(); - - var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0); - - if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) { - removeClass(droppingAfterClassName); - element.addClass(droppingBeforeClassName); - - } else { - removeClass(droppingBeforeClassName); - element.addClass(droppingAfterClassName); - } - }; - - var dropTimeout; - - var dropHandler = function(event) { - event.preventDefault(); - - var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10); - - // prevent event firing multiple times in firefox - $timeout.cancel(dropTimeout); - dropTimeout = $timeout(function() { - _dropHandler(droppedItemIndex); - }, 20); - }; - - var _dropHandler = function(droppedItemIndex) { - var theList = scope.$eval(attrs.uiSelectSort); - var itemToMove = theList[droppedItemIndex]; - var newIndex = null; - - if (element.hasClass(droppingBeforeClassName)) { - if (droppedItemIndex < scope.$index) { - newIndex = scope.$index - 1; - } else { - newIndex = scope.$index; - } - } else { - if (droppedItemIndex < scope.$index) { - newIndex = scope.$index; - } else { - newIndex = scope.$index + 1; - } - } - - move.apply(theList, [droppedItemIndex, newIndex]); - - $ngModel.$setViewValue(Date.now()); - - scope.$apply(function() { - scope.$emit('uiSelectSort:change', { - array: theList, - item: itemToMove, - from: droppedItemIndex, - to: newIndex - }); - }); - - removeClass(droppingClassName); - removeClass(droppingBeforeClassName); - removeClass(droppingAfterClassName); - - element.off('drop', dropHandler); - }; - - element.on('dragenter', function() { - if (element.hasClass(draggingClassName)) { - return; - } - - element.addClass(droppingClassName); - - element.on('dragover', dragOverHandler); - element.on('drop', dropHandler); - }); - - element.on('dragleave', function(event) { - if (event.target != element) { - return; - } - - removeClass(droppingClassName); - removeClass(droppingBeforeClassName); - removeClass(droppingAfterClassName); - - element.off('dragover', dragOverHandler); - element.off('drop', dropHandler); - }); - } - }; -}]); - -/** - * Debounces functions - * - * Taken from UI Bootstrap $$debounce source code - * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js - * - */ -uis.factory('$$uisDebounce', ['$timeout', function($timeout) { - return function(callback, debounceTime) { - var timeoutPromise; - - return function() { - var self = this; - var args = Array.prototype.slice.call(arguments); - if (timeoutPromise) { - $timeout.cancel(timeoutPromise); - } - - timeoutPromise = $timeout(function() { - callback.apply(self, args); - }, debounceTime); - }; - }; -}]); - -uis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) { - return { - restrict: 'A', - require: 'uiSelect', - link: function (scope, element, attrs, $select) { - $select.onOpenCloseCallback = $parse(attrs.uisOpenClose); - - scope.$watch('$select.open', function (isOpen, previousState) { - if (isOpen !== previousState) { - $timeout(function () { - $select.onOpenCloseCallback(scope, { - isOpen: isOpen - }); - }); - } - }); - } - }; -}]); - -/** - * Parses "repeat" attribute. - * - * Taken from AngularJS ngRepeat source code - * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211 - * - * Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat: - * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697 - */ - -uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) { - var self = this; - - /** - * Example: - * expression = "address in addresses | filter: {street: $select.search} track by $index" - * itemName = "address", - * source = "addresses | filter: {street: $select.search}", - * trackByExp = "$index", - */ - self.parse = function(expression) { - - - var match; - //var isObjectCollection = /\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)/.test(expression); - // If an array is used as collection - - // if (isObjectCollection){ - // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000 - match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/); - - // 1 Alias - // 2 Item - // 3 Key on (key,value) - // 4 Value on (key,value) - // 5 Source expression (including filters) - // 6 Track by - - if (!match) { - throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", - expression); - } - - var source = match[5], - filters = ''; - - // When using (key,value) ui-select requires filters to be extracted, since the object - // is converted to an array for $select.items - // (in which case the filters need to be reapplied) - if (match[3]) { - // Remove any enclosing parenthesis - source = match[5].replace(/(^\()|(\)$)/g, ''); - // match all after | but not after || - var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/); - if(filterMatch && filterMatch[1].trim()) { - filters = filterMatch[1]; - source = source.replace(filters, ''); - } - } - - return { - itemName: match[4] || match[2], // (lhs) Left-hand side, - keyName: match[3], //for (key, value) syntax - source: $parse(source), - filters: filters, - trackByExp: match[6], - modelMapper: $parse(match[1] || match[4] || match[2]), - repeatExpression: function (grouped) { - var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items'); - if (this.trackByExp) { - expression += ' track by ' + this.trackByExp; - } - return expression; - } - }; - - }; - - self.getGroupNgRepeatExpression = function() { - return '$group in $select.groups track by $group.name'; - }; - -}]); - -}()); -//~ angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","
      0\">
    • 0\">
    "); -//~ $templateCache.put("bootstrap/match-multiple.tpl.html"," × "); -//~ $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("select2/choices.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("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 diff --git a/dist000/select.min.css b/dist000/select.min.css deleted file mode 100644 index de36293e3..000000000 --- a/dist000/select.min.css +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * ui-select - * http://github.com/angular-ui/ui-select - * Version: 0.19.5 - 2016-10-24T23:13:59.551Z - * 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}.selectize-control.single>.selectize-input>input,.selectize-control>.selectize-dropdown{width:100%}.ui-select-choices-row:hover{background-color:#f5f5f5}.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}body>.select2-container.open{z-index:9999}.ui-select-container.select2.direction-up .ui-select-match,.ui-select-container[theme=select2].direction-up .ui-select-match{border-radius:0 0 4px 4px}.ui-select-container.select2.direction-up .ui-select-dropdown,.ui-select-container[theme=select2].direction-up .ui-select-dropdown{border-radius:4px 4px 0 0;border-top-width:1px;border-top-style:solid;box-shadow:0 -4px 8px rgba(0,0,0,.25);margin-top:-4px}.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search,.ui-select-container[theme=select2].direction-up .ui-select-dropdown .select2-search{margin-top:4px}.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match,.ui-select-container[theme=select2].direction-up.select2-dropdown-open .ui-select-match{border-bottom-color:#5897fb}.ui-select-container[theme=select2] .ui-select-dropdown .ui-select-search-hidden,.ui-select-container[theme=select2] .ui-select-dropdown .ui-select-search-hidden input{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0}.selectize-input.selectize-focus{border-color:#007FBB!important}.selectize-control.multi>.selectize-input>input{margin:0!important}.ng-dirty.ng-invalid>div.selectize-input{border-color:#D44950}.ui-select-container[theme=selectize].direction-up .ui-select-dropdown{box-shadow:0 -4px 8px rgba(0,0,0,.25);margin-top:-2px}.ui-select-container[theme=selectize] input.ui-select-search-hidden{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0;width:0}.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}.input-group>.ui-select-bootstrap>input.ui-select-search.form-control.direction-up{border-radius:4px 0 0 4px!important}.ui-select-bootstrap .ui-select-search-hidden{opacity:0;height:0;min-height:0;padding:0;margin:0;border:0}.ui-select-bootstrap>.ui-select-match>.btn{text-align:left!important}.ui-select-bootstrap>.ui-select-match>.caret{position:absolute;top:45%;right:15px}.ui-select-bootstrap>.ui-select-choices,.ui-select-bootstrap>.ui-select-no-choice{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:-1px}body>.ui-select-bootstrap.open{z-index:1000}.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 .ui-select-match-close{pointer-events:none}.ui-select-multiple:hover .ui-select-match-item.dropping-before:before{content:"";position:absolute;top:0;right:100%;height:100%;margin-right:2px;border-left:1px solid #428bca}.ui-select-multiple:hover .ui-select-match-item.dropping-after:after{content:"";position:absolute;top:0;left:100%;height:100%;margin-left:2px;border-right:1px solid #428bca}.ui-select-bootstrap .ui-select-choices-row>span{cursor:pointer;display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-bootstrap .ui-select-choices-row>span:focus,.ui-select-bootstrap .ui-select-choices-row>span:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.ui-select-bootstrap .ui-select-choices-row.active>span{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.ui-select-bootstrap .ui-select-choices-row.active.disabled>span,.ui-select-bootstrap .ui-select-choices-row.disabled>span{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}.ui-select-container[theme=bootstrap].direction-up .ui-select-dropdown{box-shadow:0 -4px 8px rgba(0,0,0,.25)}.ui-select-bootstrap .ui-select-match-text{width:100%;padding-right:1em}.ui-select-bootstrap .ui-select-match-text span{display:inline-block;width:100%;overflow:hidden}.ui-select-bootstrap .ui-select-toggle>a.btn{position:absolute;height:10px;right:10px;margin-top:-2px}.ui-select-refreshing{position:absolute;right:0;padding:8px 27px;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased}@-webkit-keyframes ui-select-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes ui-select-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.ui-select-spin{-webkit-animation:ui-select-spin 2s infinite linear;animation:ui-select-spin 2s infinite linear}.ui-select-refreshing.ng-animate{-webkit-animation:none 0s} -/*# sourceMappingURL=select.min.css.map */ diff --git a/dist000/select.min.css.map b/dist000/select.min.css.map deleted file mode 100644 index dab54c478..000000000 --- a/dist000/select.min.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["common.css"],"names":[],"mappings":";;;;;AACA,qBACA,YAAA,IAGA,qBACA,KAAA,wBACA,MAAA,cACA,OAAA,cACA,OAAA,YACA,OAAA,YACA,QAAA,YACA,SAAA,iBACA,SAAA,mBACA,QAAA,YACA,KAAA,YACA,IAAA,YA8EA,iDAUA,uCACA,MAAA,KArFA,6BACA,iBAAA,QAMA,sCACA,aAAA,QAGA,uBACA,aAAA,EAOA,sCAJA,6CACA,QAAA,KAOA,6BACA,QAAA,KAKA,2DADA,kEAEA,cACA,EACA,EAFA,IAAA,IAKA,8DADA,qEAEA,cAAA,IAAA,IAEA,EADA,EAGA,iBAAA,IACA,iBAAA,MAEA,WAAA,EAAA,KAAA,IAAA,gBAEA,WAAA,KAGA,8EADA,qFAEA,WAAA,IAGA,iFADA,wFAEA,oBAAA,QAGA,iFACA,uFACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EAMA,iCACA,aAAA,kBASA,gDACA,OAAA,YASA,yCACA,aAAA,QAIA,uEACA,WAAA,EAAA,KAAA,IAAA,gBACA,WAAA,KAGA,oEACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EACA,MAAA,EAMA,mBACA,MAAA,KACA,iBAAA,QACA,aAAA,QACA,gBAAA,KACA,QAAA,yBAAA,KAAA,IACA,eAAA,KACA,WAAA,MAAA,EAAA,IAAA,IAAA,iBAAA,EAAA,EAAA,IAAA,qBAGA,uCACA,SAAA,SAGA,8CACA,SAAA,SACA,OAAA,KACA,IAAA,IACA,MAAA,KACA,WAAA,KAIA,2CAEA,SAAA,OAGA,sEACA,cAAA,IACA,EACA,EAFA,IAIA,mFACA,cAAA,IACA,EACA,EAFA,cAKA,8CACA,QAAA,EACA,OAAA,EACA,WAAA,EACA,QAAA,EACA,OAAA,EACA,OAAA,EAGA,2CAEA,WAAA,eAGA,6CACA,SAAA,SACA,IAAA,IACA,MAAA,KAIA,wCAAA,0CACA,MAAA,KACA,OAAA,KACA,WAAA,MACA,WAAA,OACA,WAAA,KAGA,+BACA,QAAA,KAGA,wCACA,OAAA,KACA,QAAA,IAAA,IAAA,EAGA,+DACA,iBAAA,sBACA,YACA,QAAA,EACA,OAAA,WACA,cAAA,IAGA,gEACA,UAAA,MACA,YAAA,IAGA,8DACA,QAAA,EACA,OAAA,EAAA,IAAA,IAAA,EAGA,0CACA,SAAA,SAGA,0EACA,eAAA,KAGA,uEACA,QAAA,GACA,SAAA,SACA,IAAA,EACA,MAAA,KACA,OAAA,KACA,aAAA,IACA,YAAA,IAAA,MAAA,QAGA,qEACA,QAAA,GACA,SAAA,SACA,IAAA,EACA,KAAA,KACA,OAAA,KACA,YAAA,IACA,aAAA,IAAA,MAAA,QAGA,iDACA,OAAA,QACA,QAAA,MACA,QAAA,IAAA,KACA,MAAA,KACA,YAAA,IACA,YAAA,WACA,MAAA,KACA,YAAA,OAGA,uDAAA,uDACA,gBAAA,KACA,MAAA,QACA,iBAAA,QAGA,wDACA,MAAA,KACA,gBAAA,KACA,QAAA,EACA,iBAAA,QAIA,iEADA,0DAEA,MAAA,KACA,OAAA,YACA,iBAAA,KAIA,6BACA,8BACA,QAAA,eAIA,oEACA,aAAA,QAIA,uEACA,WAAA,EAAA,KAAA,IAAA,gBAGA,2CACA,MAAA,KACA,cAAA,IAEA,gDACA,QAAA,aACA,MAAA,KACA,SAAA,OAEA,6CACA,SAAA,SACA,OAAA,KACA,MAAA,KACA,WAAA,KAIA,sBACA,SAAA,SACA,MAAA,EACA,QAAA,IAAA,KACA,IAAA,IACA,QAAA,aACA,YAAA,uBACA,WAAA,OACA,YAAA,IACA,YAAA,EACA,uBAAA,YAGA,kCACA,GACA,kBAAA,UACA,UAAA,UAEA,KACA,kBAAA,eACA,UAAA,gBAGA,0BACA,GACA,kBAAA,UACA,UAAA,UAEA,KACA,kBAAA,eACA,UAAA,gBAIA,gBACA,kBAAA,eAAA,GAAA,SAAA,OACA,UAAA,eAAA,GAAA,SAAA,OAGA,iCACA,kBAAA,KAAA","file":"select.min.css","sourcesContent":["/* Style when highlighting a search. */\n.ui-select-highlight {\n font-weight: bold;\n}\n\n.ui-select-offscreen {\n clip: rect(0 0 0 0) !important;\n width: 1px !important;\n height: 1px !important;\n border: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n overflow: hidden !important;\n position: absolute !important;\n outline: 0 !important;\n left: 0px !important;\n top: 0px !important;\n}\n\n\n.ui-select-choices-row:hover {\n background-color: #f5f5f5;\n}\n\n/* Select2 theme */\n\n/* Mark invalid Select2 */\n.ng-dirty.ng-invalid > a.select2-choice {\n border-color: #D44950;\n}\n\n.select2-result-single {\n padding-left: 0;\n}\n\n.select2-locked > .select2-search-choice-close{\n display:none;\n}\n\n.select-locked > .ui-select-match-close{\n display:none;\n}\n\nbody > .select2-container.open {\n z-index: 9999; /* The z-index Select2 applies to the select2-drop */\n}\n\n/* Handle up direction Select2 */\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-match,\n.ui-select-container.select2.direction-up .ui-select-match {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-dropdown,\n.ui-select-container.select2.direction-up .ui-select-dropdown {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n\n border-top-width: 1px; /* FIXME hardcoded value :-/ */\n border-top-style: solid;\n\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n\n margin-top: -4px; /* FIXME hardcoded value :-/ */\n}\n.ui-select-container[theme=\"select2\"].direction-up .ui-select-dropdown .select2-search,\n.ui-select-container.select2.direction-up .ui-select-dropdown .select2-search {\n margin-top: 4px; /* FIXME hardcoded value :-/ */\n}\n.ui-select-container[theme=\"select2\"].direction-up.select2-dropdown-open .ui-select-match,\n.ui-select-container.select2.direction-up.select2-dropdown-open .ui-select-match {\n border-bottom-color: #5897fb;\n}\n\n.ui-select-container[theme=\"select2\"] .ui-select-dropdown .ui-select-search-hidden,\n.ui-select-container[theme=\"select2\"] .ui-select-dropdown .ui-select-search-hidden input{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n}\n\n/* Selectize theme */\n\n/* Helper class to show styles when focus */\n.selectize-input.selectize-focus{\n border-color: #007FBB !important;\n}\n\n/* Fix input width for Selectize theme */\n.selectize-control.single > .selectize-input > input {\n width: 100%;\n}\n\n/* Fix line break when there's at least one item selected with the Selectize theme */\n.selectize-control.multi > .selectize-input > input {\n margin: 0 !important;\n}\n\n/* Fix dropdown width for Selectize theme */\n.selectize-control > .selectize-dropdown {\n width: 100%;\n}\n\n/* Mark invalid Selectize */\n.ng-dirty.ng-invalid > div.selectize-input {\n border-color: #D44950;\n}\n\n/* Handle up direction Selectize */\n.ui-select-container[theme=\"selectize\"].direction-up .ui-select-dropdown {\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n margin-top: -2px; /* FIXME hardcoded value :-/ */\n}\n\n.ui-select-container[theme=\"selectize\"] input.ui-select-search-hidden{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n width: 0;\n}\n\n/* Bootstrap theme */\n\n/* Helper class to show styles when focus */\n.btn-default-focus {\n color: #333;\n background-color: #EBEBEB;\n border-color: #ADADAD;\n text-decoration: none;\n outline: 5px auto -webkit-focus-ring-color;\n outline-offset: -2px;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n}\n\n.ui-select-bootstrap .ui-select-toggle {\n position: relative;\n}\n\n.ui-select-bootstrap .ui-select-toggle > .caret {\n position: absolute;\n height: 10px;\n top: 50%;\n right: 10px;\n margin-top: -2px;\n}\n\n/* Fix Bootstrap dropdown position when inside a input-group */\n.input-group > .ui-select-bootstrap.dropdown {\n /* Instead of relative */\n position: static;\n}\n\n.input-group > .ui-select-bootstrap > input.ui-select-search.form-control {\n border-radius: 4px; /* FIXME hardcoded value :-/ */\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.input-group > .ui-select-bootstrap > input.ui-select-search.form-control.direction-up {\n border-radius: 4px !important; /* FIXME hardcoded value :-/ */\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n}\n\n.ui-select-bootstrap .ui-select-search-hidden{\n opacity: 0;\n height: 0;\n min-height: 0;\n padding: 0;\n margin: 0;\n border:0;\n}\n\n.ui-select-bootstrap > .ui-select-match > .btn{\n /* Instead of center because of .btn */\n text-align: left !important;\n}\n\n.ui-select-bootstrap > .ui-select-match > .caret {\n position: absolute;\n top: 45%;\n right: 15px;\n}\n\n/* See Scrollable Menu with Bootstrap 3 http://stackoverflow.com/questions/19227496 */\n.ui-select-bootstrap > .ui-select-choices ,.ui-select-bootstrap > .ui-select-no-choice {\n width: 100%;\n height: auto;\n max-height: 200px;\n overflow-x: hidden;\n margin-top: -1px;\n}\n\nbody > .ui-select-bootstrap.open {\n z-index: 1000; /* Standard Bootstrap dropdown z-index */\n}\n\n.ui-select-multiple.ui-select-bootstrap {\n height: auto;\n padding: 3px 3px 0 3px;\n}\n\n.ui-select-multiple.ui-select-bootstrap input.ui-select-search {\n background-color: transparent !important; /* To prevent double background when disabled */\n border: none;\n outline: none;\n height: 1.666666em;\n margin-bottom: 3px;\n}\n\n.ui-select-multiple.ui-select-bootstrap .ui-select-match .close {\n font-size: 1.6em;\n line-height: 0.75;\n}\n\n.ui-select-multiple.ui-select-bootstrap .ui-select-match-item {\n outline: 0;\n margin: 0 3px 3px 0;\n}\n\n.ui-select-multiple .ui-select-match-item {\n position: relative;\n}\n\n.ui-select-multiple .ui-select-match-item.dropping .ui-select-match-close {\n pointer-events: none;\n}\n\n.ui-select-multiple:hover .ui-select-match-item.dropping-before:before {\n content: \"\";\n position: absolute;\n top: 0;\n right: 100%;\n height: 100%;\n margin-right: 2px;\n border-left: 1px solid #428bca;\n}\n\n.ui-select-multiple:hover .ui-select-match-item.dropping-after:after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 100%;\n height: 100%;\n margin-left: 2px;\n border-right: 1px solid #428bca;\n}\n\n.ui-select-bootstrap .ui-select-choices-row>span {\n cursor: pointer;\n display: block;\n padding: 3px 20px;\n clear: both;\n font-weight: 400;\n line-height: 1.42857143;\n color: #333;\n white-space: nowrap;\n}\n\n.ui-select-bootstrap .ui-select-choices-row>span:hover, .ui-select-bootstrap .ui-select-choices-row>span:focus {\n text-decoration: none;\n color: #262626;\n background-color: #f5f5f5;\n}\n\n.ui-select-bootstrap .ui-select-choices-row.active>span {\n color: #fff;\n text-decoration: none;\n outline: 0;\n background-color: #428bca;\n}\n\n.ui-select-bootstrap .ui-select-choices-row.disabled>span,\n.ui-select-bootstrap .ui-select-choices-row.active.disabled>span {\n color: #777;\n cursor: not-allowed;\n background-color: #fff;\n}\n\n/* fix hide/show angular animation */\n.ui-select-match.ng-hide-add,\n.ui-select-search.ng-hide-add {\n display: none !important;\n}\n\n/* Mark invalid Bootstrap */\n.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match {\n border-color: #D44950;\n}\n\n/* Handle up direction Bootstrap */\n.ui-select-container[theme=\"bootstrap\"].direction-up .ui-select-dropdown {\n box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25);\n}\n\n.ui-select-bootstrap .ui-select-match-text {\n width: 100%;\n padding-right: 1em;\n}\n.ui-select-bootstrap .ui-select-match-text span {\n display: inline-block;\n width: 100%;\n overflow: hidden;\n}\n.ui-select-bootstrap .ui-select-toggle > a.btn {\n position: absolute;\n height: 10px;\n right: 10px;\n margin-top: -2px;\n}\n\n/* Spinner */\n.ui-select-refreshing {\n position: absolute;\n right: 0;\n padding: 8px 27px;\n top: 1px;\n display: inline-block;\n font-family: 'Glyphicons Halflings';\n font-style: normal;\n font-weight: normal;\n line-height: 1;\n -webkit-font-smoothing:antialiased;\n }\n \n@-webkit-keyframes ui-select-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n@keyframes ui-select-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n.ui-select-spin {\n -webkit-animation: ui-select-spin 2s infinite linear;\n animation: ui-select-spin 2s infinite linear;\n}\n\n.ui-select-refreshing.ng-animate {\n -webkit-animation: none 0s;\n} "],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist000/select.min.js b/dist000/select.min.js deleted file mode 100644 index 4c855a88b..000000000 --- a/dist000/select.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){"use strict";var KEY={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 k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true}if(e.metaKey||e.ctrlKey||e.altKey)return true;return false},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0||typeof ctrl.selected=="object"&&!ctrl.selected.id};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[]; -$scope.$evalAsync(function(){ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset= 112 && k <= 123;\n },\n isVerticalMovement: function (k){\n return ~[KEY.UP, KEY.DOWN].indexOf(k);\n },\n isHorizontalMovement: function (k){\n return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k);\n },\n toSeparator: function (k) {\n var sep = {ENTER:\"\\n\",TAB:\"\\t\",SPACE:\" \"}[k];\n if (sep) return sep;\n // return undefined for special keys other than enter, tab or space.\n // no way to use them to cut strings.\n return KEY[k] ? undefined : k;\n }\n };\n\n/**\n * Add querySelectorAll() to jqLite.\n *\n * jqLite find() is limited to lookups by tag name.\n * TODO This will change with future versions of AngularJS, to be removed when this happens\n *\n * See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586\n * See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598\n */\nif (angular.element.prototype.querySelectorAll === undefined) {\n angular.element.prototype.querySelectorAll = function(selector) {\n return angular.element(this[0].querySelectorAll(selector));\n };\n}\n\n/**\n * Add closest() to jqLite.\n */\nif (angular.element.prototype.closest === undefined) {\n angular.element.prototype.closest = function( selector) {\n var elem = this[0];\n var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;\n\n while (elem) {\n if (matchesSelector.bind(elem)(selector)) {\n return elem;\n } else {\n elem = elem.parentElement;\n }\n }\n return false;\n };\n}\n\nvar latestId = 0;\n\nvar uis = angular.module('ui.select', [])\n\n.constant('uiSelectConfig', {\n theme: 'bootstrap',\n searchEnabled: true,\n sortable: false,\n placeholder: '', // Empty by default, like HTML tag \");\n $compile(focusser)(scope);\n $select.focusser = focusser;\n\n //Input that will handle focus\n $select.focusInput = focusser;\n\n element.parent().append(focusser);\n focusser.bind(\"focus\", function(){\n scope.$evalAsync(function(){\n $select.focus = true;\n });\n });\n focusser.bind(\"blur\", function(){\n scope.$evalAsync(function(){\n $select.focus = false;\n });\n });\n focusser.bind(\"keydown\", function(e){\n\n if (e.which === KEY.BACKSPACE) {\n e.preventDefault();\n e.stopPropagation();\n $select.select(undefined);\n scope.$apply();\n return;\n }\n\n if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {\n return;\n }\n\n if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){\n e.preventDefault();\n e.stopPropagation();\n $select.activate();\n }\n\n scope.$digest();\n });\n\n focusser.bind(\"keyup input\", function(e){\n\n if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) {\n return;\n }\n\n $select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input\n focusser.val('');\n scope.$digest();\n\n });\n\n\n }\n };\n}]);\n\n// Make multiple matches sortable\nuis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', function($timeout, uiSelectConfig, uiSelectMinErr) {\n return {\n require: ['^^uiSelect', '^ngModel'],\n link: function(scope, element, attrs, ctrls) {\n if (scope[attrs.uiSelectSort] === null) {\n throw uiSelectMinErr('sort', 'Expected a list to sort');\n }\n\n var $select = ctrls[0];\n var $ngModel = ctrls[1];\n\n var options = angular.extend({\n axis: 'horizontal'\n },\n scope.$eval(attrs.uiSelectSortOptions));\n\n var axis = options.axis;\n var draggingClassName = 'dragging';\n var droppingClassName = 'dropping';\n var droppingBeforeClassName = 'dropping-before';\n var droppingAfterClassName = 'dropping-after';\n\n scope.$watch(function(){\n return $select.sortable;\n }, function(newValue){\n if (newValue) {\n element.attr('draggable', true);\n } else {\n element.removeAttr('draggable');\n }\n });\n\n element.on('dragstart', function(event) {\n element.addClass(draggingClassName);\n\n (event.dataTransfer || event.originalEvent.dataTransfer).setData('text', scope.$index.toString());\n });\n\n element.on('dragend', function() {\n removeClass(draggingClassName);\n });\n\n var move = function(from, to) {\n /*jshint validthis: true */\n this.splice(to, 0, this.splice(from, 1)[0]);\n };\n\n var removeClass = function(className) {\n angular.forEach($select.$element.querySelectorAll('.' + className), function(el){\n angular.element(el).removeClass(className);\n });\n };\n\n var dragOverHandler = function(event) {\n event.preventDefault();\n\n var offset = axis === 'vertical' ? event.offsetY || event.layerY || (event.originalEvent ? event.originalEvent.offsetY : 0) : event.offsetX || event.layerX || (event.originalEvent ? event.originalEvent.offsetX : 0);\n\n if (offset < (this[axis === 'vertical' ? 'offsetHeight' : 'offsetWidth'] / 2)) {\n removeClass(droppingAfterClassName);\n element.addClass(droppingBeforeClassName);\n\n } else {\n removeClass(droppingBeforeClassName);\n element.addClass(droppingAfterClassName);\n }\n };\n\n var dropTimeout;\n\n var dropHandler = function(event) {\n event.preventDefault();\n\n var droppedItemIndex = parseInt((event.dataTransfer || event.originalEvent.dataTransfer).getData('text'), 10);\n\n // prevent event firing multiple times in firefox\n $timeout.cancel(dropTimeout);\n dropTimeout = $timeout(function() {\n _dropHandler(droppedItemIndex);\n }, 20);\n };\n\n var _dropHandler = function(droppedItemIndex) {\n var theList = scope.$eval(attrs.uiSelectSort);\n var itemToMove = theList[droppedItemIndex];\n var newIndex = null;\n\n if (element.hasClass(droppingBeforeClassName)) {\n if (droppedItemIndex < scope.$index) {\n newIndex = scope.$index - 1;\n } else {\n newIndex = scope.$index;\n }\n } else {\n if (droppedItemIndex < scope.$index) {\n newIndex = scope.$index;\n } else {\n newIndex = scope.$index + 1;\n }\n }\n\n move.apply(theList, [droppedItemIndex, newIndex]);\n\n $ngModel.$setViewValue(Date.now());\n\n scope.$apply(function() {\n scope.$emit('uiSelectSort:change', {\n array: theList,\n item: itemToMove,\n from: droppedItemIndex,\n to: newIndex\n });\n });\n\n removeClass(droppingClassName);\n removeClass(droppingBeforeClassName);\n removeClass(droppingAfterClassName);\n\n element.off('drop', dropHandler);\n };\n\n element.on('dragenter', function() {\n if (element.hasClass(draggingClassName)) {\n return;\n }\n\n element.addClass(droppingClassName);\n\n element.on('dragover', dragOverHandler);\n element.on('drop', dropHandler);\n });\n\n element.on('dragleave', function(event) {\n if (event.target != element) {\n return;\n }\n\n removeClass(droppingClassName);\n removeClass(droppingBeforeClassName);\n removeClass(droppingAfterClassName);\n\n element.off('dragover', dragOverHandler);\n element.off('drop', dropHandler);\n });\n }\n };\n}]);\n\n/**\n * Debounces functions\n *\n * Taken from UI Bootstrap $$debounce source code\n * See https://github.com/angular-ui/bootstrap/blob/master/src/debounce/debounce.js\n *\n */\nuis.factory('$$uisDebounce', ['$timeout', function($timeout) {\n return function(callback, debounceTime) {\n var timeoutPromise;\n\n return function() {\n var self = this;\n var args = Array.prototype.slice.call(arguments);\n if (timeoutPromise) {\n $timeout.cancel(timeoutPromise);\n }\n\n timeoutPromise = $timeout(function() {\n callback.apply(self, args);\n }, debounceTime);\n };\n };\n}]);\n\nuis.directive('uisOpenClose', ['$parse', '$timeout', function ($parse, $timeout) {\n return {\n restrict: 'A',\n require: 'uiSelect',\n link: function (scope, element, attrs, $select) {\n $select.onOpenCloseCallback = $parse(attrs.uisOpenClose);\n\n scope.$watch('$select.open', function (isOpen, previousState) {\n if (isOpen !== previousState) {\n $timeout(function () {\n $select.onOpenCloseCallback(scope, {\n isOpen: isOpen\n });\n });\n }\n });\n }\n };\n}]);\n\n/**\n * Parses \"repeat\" attribute.\n *\n * Taken from AngularJS ngRepeat source code\n * See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211\n *\n * Original discussion about parsing \"repeat\" attribute instead of fully relying on ng-repeat:\n * https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697\n */\n\nuis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) {\n var self = this;\n\n /**\n * Example:\n * expression = \"address in addresses | filter: {street: $select.search} track by $index\"\n * itemName = \"address\",\n * source = \"addresses | filter: {street: $select.search}\",\n * trackByExp = \"$index\",\n */\n self.parse = function(expression) {\n\n\n var match;\n //var isObjectCollection = /\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)/.test(expression);\n // If an array is used as collection\n\n // if (isObjectCollection){\n // 000000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000055555555555000000000000000000000066666666600000000\n match = expression.match(/^\\s*(?:([\\s\\S]+?)\\s+as\\s+)?(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+(\\s*[\\s\\S]+?)?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n // 1 Alias\n // 2 Item\n // 3 Key on (key,value)\n // 4 Value on (key,value)\n // 5 Source expression (including filters)\n // 6 Track by\n\n if (!match) {\n throw uiSelectMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n expression);\n }\n \n var source = match[5], \n filters = '';\n\n // When using (key,value) ui-select requires filters to be extracted, since the object\n // is converted to an array for $select.items \n // (in which case the filters need to be reapplied)\n if (match[3]) {\n // Remove any enclosing parenthesis\n source = match[5].replace(/(^\\()|(\\)$)/g, '');\n // match all after | but not after ||\n var filterMatch = match[5].match(/^\\s*(?:[\\s\\S]+?)(?:[^\\|]|\\|\\|)+([\\s\\S]*)\\s*$/);\n if(filterMatch && filterMatch[1].trim()) {\n filters = filterMatch[1];\n source = source.replace(filters, '');\n } \n }\n\n return {\n itemName: match[4] || match[2], // (lhs) Left-hand side,\n keyName: match[3], //for (key, value) syntax\n source: $parse(source),\n filters: filters,\n trackByExp: match[6],\n modelMapper: $parse(match[1] || match[4] || match[2]),\n repeatExpression: function (grouped) {\n var expression = this.itemName + ' in ' + (grouped ? '$group.items' : '$select.items');\n if (this.trackByExp) {\n expression += ' track by ' + this.trackByExp;\n }\n return expression;\n } \n };\n\n };\n\n self.getGroupNgRepeatExpression = function() {\n return '$group in $select.groups track by $group.name';\n };\n\n}]);\n\n}());\nangular.module(\"ui.select\").run([\"$templateCache\", function($templateCache) {$templateCache.put(\"bootstrap/choices.tpl.html\",\"
      0\\\">
    • 0\\\">
    \");\n$templateCache.put(\"bootstrap/match-multiple.tpl.html\",\" × \");\n$templateCache.put(\"bootstrap/match.tpl.html\",\"
    {{$select.placeholder}}
    \");\n$templateCache.put(\"bootstrap/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"bootstrap/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"bootstrap/select.tpl.html\",\"
    \");\n$templateCache.put(\"select2/choices.tpl.html\",\"
    \");\n$templateCache.put(\"select2/match-multiple.tpl.html\",\"
  • \");\n$templateCache.put(\"select2/match.tpl.html\",\"{{$select.placeholder}} \");\n$templateCache.put(\"select2/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"select2/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"select2/select.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/choices.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/match-multiple.tpl.html\",\"
    ×
    \");\n$templateCache.put(\"selectize/match.tpl.html\",\"
    {{$select.placeholder}}
    \");\n$templateCache.put(\"selectize/no-choice.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/select-multiple.tpl.html\",\"
    \");\n$templateCache.put(\"selectize/select.tpl.html\",\"
    \");}]);",null,null],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist000/select.min.js000 b/dist000/select.min.js000 deleted file mode 100644 index 1c364b4f5..000000000 --- a/dist000/select.min.js000 +++ /dev/null @@ -1,2 +0,0 @@ -(function(){"use strict";var KEY={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 k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true}if(e.metaKey||e.ctrlKey||e.altKey)return true;return false},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k)},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k)},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k}};if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector))}}if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem}else{elem=elem.parentElement}}return false}}var latestId=0;var uis=angular.module("ui.select",[]).constant("uiSelectConfig",{theme:"bootstrap",searchEnabled:true,sortable:false,placeholder:"",refreshDelay:1e3,closeOnSelect:true,skipFocusser:false,dropdownPosition:"auto",removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++},appendToBody:false,spinnerEnabled:false,spinnerClass:"glyphicon-refresh ui-select-spin"}).service("uiSelectMinErr",function(){var minErr=angular.$$minErr("ui.select");return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp("\nhttp://errors.angularjs.org/.*"),"");return new Error(message)}}).directive("uisTranscludeAppend",function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone)})}}}).filter("highlight",function(){function escapeRegexp(queryToEscape){return(""+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(matchItem,query){return query&&matchItem?(""+matchItem).replace(new RegExp(escapeRegexp(query),"gi"),'$&'):matchItem}}).factory("uisOffset",["$document","$window",function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop("offsetWidth"),height:boundingClientRect.height||element.prop("offsetHeight"),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)}}}]);uis.directive("uiSelectChoices",["uiSelectConfig","uisRepeatParser","uiSelectMinErr","$compile","$window",function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-choices");var theme=tElement.parent().attr("theme")||uiSelectConfig.theme;return theme+"/choices.tpl.html"},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr("repeat","Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll(".ui-select-choices-group");if(groups.length!==1)throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr("ng-repeat",RepeatParser.getGroupNgRepeatExpression())}var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll(".ui-select-choices-row");if(choices.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row but got '{0}'.",choices.length)}choices.attr("ng-repeat",parserResult.repeatExpression(groupByExp)).attr("ng-if","$select.open");var rowsInner=tElement.querySelectorAll(".ui-select-choices-row-inner");if(rowsInner.length!==1){throw uiSelectMinErr("rows","Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length)}rowsInner.attr("uis-transclude-append","");var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr("ng-click","$select.select("+parserResult.itemName+",$select.skipFocusser,$event)");return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch("$select.search",function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh)}else{$select.items=[]}});attrs.$observe("refreshDelay",function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay});scope.$watch("$select.open",function(open){if(open){element.attr("role","listbox")}else{element.removeAttr("role")}})}}}}]);uis.controller("uiSelectCtrl",["$scope","$element","$timeout","$filter","$$uisDebounce","uisRepeatParser","uiSelectMinErr","uiSelectConfig","$parse","$injector","$window",function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH="";ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition="auto";ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=function(){try{return $injector.get("$animate")}catch(err){return null}}();ctrl.searchInput=$element.querySelectorAll("input.ui-select-search");if(ctrl.searchInput.length!==1){throw uiSelectMinErr("searchInput","Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length)}ctrl.isEmpty=function(){return angular.isUndefined(ctrl.selected)||ctrl.selected===null||ctrl.selected===""||ctrl.multiple&&ctrl.selected.length===0};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg)}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0}var container=$element.querySelectorAll(".ui-select-choices-content");var searchInput=$element.querySelectorAll(".ui-select-search");if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==="start"&&ctrl.items.length===0){ctrl.$animate.off("removeClass",searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}else if(phase==="close"){ctrl.$animate.off("enter",container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue)})}};if(ctrl.items.length>0){ctrl.$animate.on("enter",container[0],animateHandler)}else{ctrl.$animate.on("removeClass",searchInput[0],animateHandler)}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible()}})}}else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close()}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus()};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name})[0]};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item)}else{ctrl.groups.push({name:groupName,items:[item]})}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups)}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn)}}ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items)})}function setPlainItems(items){ctrl.items=items}ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result})};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse("$uisSource"+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject()},true)}ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||angular.isArray(selectedItems)&&!selectedItems.length||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data)}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem)}):!angular.equals(i,selectedItems)});ctrl.setItemsFn(filteredItems)}}if(ctrl.dropdownPosition==="auto"||ctrl.dropdownPosition==="up"){$scope.calculateDropdownPos()}$scope.$broadcast("uis:refresh")};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[]}else{if(!angular.isArray(items)){throw uiSelectMinErr("items","Expected an array but got '{0}'.",items)}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null}}}})};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise)}_refreshDelayPromise=$timeout(function(){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.then(function(){ctrl.refreshing=false})}},ctrl.refreshDelay)}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false}var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false}if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback)}return isActive};var _isItemSelected=function(item){return ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item)}).length>0};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item)}if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1)}}function _isItemDisabled(item){return disabledItems.indexOf(item)>-1}ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item)}if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!itemScope.$eval(ctrl.disableChoiceExpression)}_updateItemDisabled(item,isDisabled)}return isDisabled};ctrl.select=function(item,skipFocusser,$event){if(item===undefined||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==="click"||$event.type==="touchend")&&item)ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search}if(!item||angular.equals(ctrl.items[0],item)){return}}else{item=ctrl.items[ctrl.activeIndex]}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==="string"){item=ctrl.tagging.fct(item);if(!item)return}else if(typeof item==="string"){item=item.replace(ctrl.taggingLabel,"").trim()}}}if(_isItemSelected(item)){ctrl.close(skipFocusser);return}}_resetSearchInput();$scope.$broadcast("uis:select",item);var locals={};locals[ctrl.parserResult.itemName]=item;$timeout(function(){ctrl.onSelectCallback($scope,{$item:item,$model:ctrl.parserResult.modelMapper($scope,locals)})});if(ctrl.closeOnSelect){ctrl.close(skipFocusser)}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast("uis:close",skipFocusser)};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus()};ctrl.clear=function($event){ctrl.select(undefined);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus()},0,false)};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation()}else{ctrl.activate()}};ctrl.isLocked=function(){return false};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!==""},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item)}if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,0)}}function _isItemlocked(item){return lockedItems.indexOf(item)>-1}ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!itemScope.$eval(ctrl.lockChoiceExpression);_updateItemLocked(item,isLocked)}else{isLocked=_isItemlocked(item)}}return isLocked}}var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.searchInput.parent().parent()[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent},updateIfVisible=function(containerWidth){if(containerWidth===0){return false}var inputWidth=containerWidth-input.offsetLeft-10;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css("width",inputWidth+"px");return true};$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null}})}},angular.noop)}})};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex0||ctrl.search.length===0&&ctrl.tagging.isActivated&&ctrl.activeIndex>-1){ctrl.activeIndex--}break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser)}else{ctrl.activate(false,true)}break;case KEY.ESC:ctrl.close();break;default:processed=false}return processed}ctrl.searchInput.on("keydown",function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation()}$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation()}if(ctrl.taggingTokens.isActivated){for(var i=0;i0){tagged=true}}}if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler("tagged");var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],"").trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem)}if(newItem)ctrl.select(newItem,true)})}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible()}if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation()}});ctrl.searchInput.on("paste",function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData("Text")}else{data=(e.originalEvent||e).clipboardData.getData("text/plain")}data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i-1){items=data.split(separator);break}}if(items.length===0){items=[data]}var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true)}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation()}}});ctrl.searchInput.on("tagged",function(){$timeout(function(){_resetSearchInput()})});function _ensureHighlightVisible(){var container=$element.querySelectorAll(".ui-select-choices-content");var choices=container.querySelectorAll(".ui-select-choices-row");if(choices.length<1){throw uiSelectMinErr("choices","Expected multiple .ui-select-choices-row but got '{0}'.",choices.length)}if(ctrl.activeIndex<0){return}var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height}else if(posY").removeAttr("multiple");else tElement.append("");if(tAttrs.inputId)tElement.querySelectorAll("input.ui-select-search")[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||"Select box";$select.focusserTitle=$select.baseTitle+" focus";$select.focusserId="focusser-"+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)()}else{return uiSelectConfig.closeOnSelect}}();scope.$watch("skipFocusser",function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name};if(attrs.tabindex){attrs.$observe("tabindex",function(value){$select.focusInput.attr("tabindex",value);element.removeAttr("tabindex")})}scope.$watch(function(){return scope.$eval(attrs.searchEnabled)},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled});scope.$watch("sortable",function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable});attrs.$observe("limit",function(){$select.limit=angular.isDefined(attrs.limit)?parseInt(attrs.limit,10):undefined});scope.$watch("removeSelected",function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected});attrs.$observe("disabled",function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false});attrs.$observe("resetSearchInput",function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true});attrs.$observe("paste",function(){$select.paste=scope.$eval(attrs.paste)});attrs.$observe("tagging",function(){if(attrs.tagging!==undefined){var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined}}else{$select.tagging={isActivated:false,fct:undefined}}});attrs.$observe("taggingLabel",function(){if(attrs.tagging!==undefined){if(attrs.taggingLabel==="false"){$select.taggingLabel=false}else{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:"(new)"}}});attrs.$observe("taggingTokens",function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split("|"):[",","ENTER"];$select.taggingTokens={isActivated:true,tokens:tokens}}});attrs.$observe("spinnerEnabled",function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled});attrs.$observe("spinnerClass",function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus()})}if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus()})})}function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target)}else{contains=element[0].contains(e.target)}if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=["input","button","textarea","select"];var targetController=angular.element(e.target).controller("uiSelect");skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase())}else{skipFocusser=true}$select.close(skipFocusser);scope.$digest()}$select.clickTriggeredSelect=false}$document.on("click",onDocumentClick);scope.$on("$destroy",function(){$document.off("click",onDocumentClick)});transcludeFn(scope,function(clone){var transcluded=angular.element("
    ").append(clone);var transcludedMatch=transcluded.querySelectorAll(".ui-select-match");transcludedMatch.removeAttr("ui-select-match");transcludedMatch.removeAttr("data-ui-select-match");if(transcludedMatch.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length)}element.querySelectorAll(".ui-select-match").replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll(".ui-select-choices");transcludedChoices.removeAttr("ui-select-choices");transcludedChoices.removeAttr("data-ui-select-choices");if(transcludedChoices.length!==1){throw uiSelectMinErr("transcluded","Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length)}element.querySelectorAll(".ui-select-choices").replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll(".ui-select-no-choice");transcludedNoChoice.removeAttr("ui-select-no-choice");transcludedNoChoice.removeAttr("data-ui-select-no-choice");if(transcludedNoChoice.length==1){element.querySelectorAll(".ui-select-no-choice").replaceWith(transcludedNoChoice)}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch("$select.open",function(isOpen){if(isOpen){positionDropdown()}else{resetDropdown()}});scope.$on("$destroy",function(){resetDropdown()})}var placeholder=null,originalWidth="";function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('
    ');placeholder[0].style.width=offset.width+"px";placeholder[0].style.height=offset.height+"px";element.after(placeholder);originalWidth=element[0].style.width;$document.find("body").append(element);element[0].style.position="absolute";element[0].style.left=offset.left+"px";element[0].style.top=offset.top+"px";element[0].style.width=offset.width+"px"}function resetDropdown(){if(placeholder===null){return}placeholder.replaceWith(element);placeholder=null;element[0].style.position="";element[0].style.left="";element[0].style.top="";element[0].style.width=originalWidth;$select.setFocus()}var dropdown=null,directionUpClassName="direction-up";scope.$watch("$select.open",function(){if($select.dropdownPosition==="auto"||$select.dropdownPosition==="up"){scope.calculateDropdownPos()}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);element.addClass(directionUpClassName)};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position="";dropdown[0].style.top=""};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==="up"){setDropdownPosUp()}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown)}else{setDropdownPosDown(offset,offsetDropdown)}}dropdown[0].style.opacity=1})};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll(".ui-select-dropdown");if(dropdown.length===0){return}if($select.search===""&&!opened){dropdown[0].style.opacity=0;opened=true}if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on("enter",dropdown,function(elem,phase){if(phase==="close"&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false}})}else{calculateDropdownPosAfterAnimation()}}else{if(dropdown===null||dropdown.length===0){return}dropdown[0].style.opacity=0;dropdown[0].style.position="";dropdown[0].style.top="";element.removeClass(directionUpClassName)}}}}}}]);uis.directive("uiSelectMatch",["uiSelectConfig",function(uiSelectConfig){return{restrict:"EA",require:"^uiSelect",replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass("ui-select-match");var parent=tElement.parent();var theme=getAttribute(parent,"theme")||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,"multiple"));return theme+(multi?"/match-multiple.tpl.html":"/match.tpl.html")},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe("placeholder",function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder});function setAllowClear(allow){$select.allowClear=angular.isDefined(allow)?allow===""?true:allow.toLowerCase()==="true":false}attrs.$observe("allowClear",setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput()}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))return elem.attr(attribute);if(elem[0].hasAttribute("data-"+attribute))return elem.attr("data-"+attribute);if(elem[0].hasAttribute("x-"+attribute))return elem.attr("x-"+attribute)}}]);uis.directive("uiSelectMultiple",["uiSelectMinErr","$timeout",function(uiSelectMinErr,$timeout){return{restrict:"EA",require:["^uiSelect","^ngModel"],controller:["$scope","$timeout",function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))$select.selected=[];$scope.$evalAsync(function(){ -ngModel=$scope.ngModel});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent()};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems()}if($select.sizeSearchInput){$select.sizeSearchInput()}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)})});ctrl.updateModel();return true};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder}}],controllerAs:"$selectMultiple",link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result)}return resultMultiple});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:""}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true}}}if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true}}return false};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k])}}}return resultMultiple});scope.$watchCollection(function(){return ngModel.$modelValue},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null}$selectMultiple.refreshComponent()}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(angular.isUndefined(ngModel.$viewValue)||ngModel.$viewValue===null){ngModel.$viewValue=[]}else{throw uiSelectMinErr("multiarr","Expected model value to be array but got '{0}'",ngModel.$viewValue)}}$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync()};scope.$on("uis:select",function(event,item){if($select.selected.length>=$select.limit){return}$select.selected.push(item);$selectMultiple.updateModel()});scope.$on("uis:activate",function(){$selectMultiple.activeMatchIndex=-1});scope.$watch("$select.disabled",function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput()});$select.searchInput.on("keydown",function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key)}if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation()}})});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length}function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||$select.search.length&&key==KEY.RIGHT)return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false}else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev}else{return curr}}else{return last}break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr}else return false}}newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true}$select.searchInput.on("keyup",function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0})}if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return}$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter("filter")(items,{isTag:true});if(tagItems.length>0){tagItem=tagItems[0]}if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem)})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem)})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items});return}if(newItem)newItem.isTag=true}else{tagItems=$select.$filter("filter")(items,function(item){return item.match($select.taggingLabel)});if(tagItems.length>0){tagItem=tagItems[0]}item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length)}newItem=$select.search+" "+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return}if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items})}return}if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length)}return}}if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1)}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr)}scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:"",items:[newItem],tagging:true})}}})}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false}var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false}return origItem.toUpperCase()===$select.search.toUpperCase()}).length>0;return hasDupe}function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i=0;i--){if(checkFnSingle(data[i]))return data[i]}}return inputValue});scope.$watch("$select.selected",function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue)}});ngModel.$render=function(){$select.selected=ngModel.$viewValue};scope.$on("uis:select",function(event,item){$select.selected=item});scope.$on("uis:close",function(event,skipFocusser){$timeout(function(){$select.focusser.prop("disabled",false);if(!skipFocusser)$select.focusser[0].focus()},0,false)});scope.$on("uis:activate",function(){focusser.prop("disabled",true)});var focusser=angular.element("");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true})});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false})});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return}if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return}if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate()}scope.$digest()});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return}$select.activate(focusser.val());focusser.val("");scope.$digest()})}}}]);uis.directive("uiSelectSort",["$timeout","uiSelectConfig","uiSelectMinErr",function($timeout,uiSelectConfig,uiSelectMinErr){return{require:["^^uiSelect","^ngModel"],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr("sort","Expected a list to sort")}var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:"horizontal"},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName="dragging";var droppingClassName="dropping";var droppingBeforeClassName="dropping-before";var droppingAfterClassName="dropping-after";scope.$watch(function(){return $select.sortable},function(newValue){if(newValue){element.attr("draggable",true)}else{element.removeAttr("draggable")}});element.on("dragstart",function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData("text",scope.$index.toString())});element.on("dragend",function(){removeClass(draggingClassName)});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0])};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll("."+className),function(el){angular.element(el).removeClass(className)})};var dragOverHandler=function(event){event.preventDefault();var offset=axis==="vertical"?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset Date: Thu, 15 Dec 2016 09:25:43 +0500 Subject: [PATCH 09/10] tpl --- dist/materialize.css | 28 ++++++++++++++++------------ dist/materialize.tpl.html | 32 ++++++++++++++------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/dist/materialize.css b/dist/materialize.css index 65599e148..52c1835ba 100644 --- a/dist/materialize.css +++ b/dist/materialize.css @@ -37,7 +37,7 @@ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); }*/ -.ui-select-container .ui-select-toggle { +.ui-select-container {/* .ui-select-toggle*/ position: relative; } @@ -196,14 +196,22 @@ body > .ui-select-container.open { box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); }*/ -.ui-select-container .ui-select-match-text { - width: 100%; - padding-right: 1em; +.ui-select-toggle { + display:inline-block; + width: 100%; + overflow: hidden; + +} + +.ui-select-match .disabled { + /*color: grey;*/ + } + .ui-select-container .ui-select-match-text span { - display: inline-block; + /*display: inline-block; width: 100%; - overflow: hidden; + overflow: hidden;*/ } /*.ui-select-bootstrap .ui-select-toggle > a.btn { position: absolute; @@ -214,13 +222,9 @@ body > .ui-select-container.open { -.ui-select-container{ - margin-right: 1rem; -} - -.ui-select-match-text, .ui-select-placeholder { +.ui-select-match-text{ border-bottom: 1px solid; - display:block; + display:inline-block; width: 100%; /*cursor:pointer;*/ } diff --git a/dist/materialize.tpl.html b/dist/materialize.tpl.html index c82b58406..45a4de601 100644 --- a/dist/materialize.tpl.html +++ b/dist/materialize.tpl.html @@ -1,10 +1,10 @@ @@@ materialize/select.tpl.html @@ -13,8 +13,8 @@