|
21 | 21 | DELETE: 46,
|
22 | 22 | COMMAND: 91,
|
23 | 23 |
|
24 |
| - 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 : "SPACE" , 189 : "-" , 190 : "." , 191 : "/" , 192 : "`" , 219 : "[" , 220 : "\\" , 221 : "]" , 222 : "'" |
| 24 | + 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 : "'" |
25 | 25 | },
|
26 | 26 |
|
27 | 27 | isControl: function (e) {
|
|
398 | 398 | var locals = {};
|
399 | 399 | locals[ctrl.parserResult.itemName] = item;
|
400 | 400 |
|
401 |
| - ctrl.onSelectCallback($scope, { |
402 |
| - $item: item, |
403 |
| - $model: ctrl.parserResult.modelMapper($scope, locals) |
404 |
| - }); |
405 |
| - |
406 | 401 | if(ctrl.multiple) {
|
407 | 402 | ctrl.selected.push(item);
|
408 | 403 | ctrl.sizeSearchInput();
|
409 | 404 | } else {
|
410 | 405 | ctrl.selected = item;
|
411 | 406 | }
|
| 407 | + |
| 408 | + ctrl.onSelectCallback($scope, { |
| 409 | + $item: item, |
| 410 | + $model: ctrl.parserResult.modelMapper($scope, locals) |
| 411 | + }); |
| 412 | + |
412 | 413 | if (!ctrl.multiple || ctrl.closeOnSelect) {
|
413 | 414 | ctrl.close(skipFocusser);
|
414 | 415 | }
|
|
615 | 616 | if ( ctrl.taggingTokens.tokens[i] === KEY.MAP[e.keyCode] ) {
|
616 | 617 | // make sure there is a new value to push via tagging
|
617 | 618 | if ( ctrl.search.length > 0 ) {
|
618 |
| - ctrl.select(undefined, true); |
619 |
| - _searchInput.triggerHandler('tagged'); |
| 619 | + $timeout(function() { |
| 620 | + _searchInput.triggerHandler('tagged', ctrl.items); |
| 621 | + var newItem = ctrl.search.replace(KEY.MAP[e.keyCode],'').trim(); |
| 622 | + if ( ctrl.tagging.fct ) { |
| 623 | + newItem = ctrl.tagging.fct( newItem ); |
| 624 | + } |
| 625 | + ctrl.select( newItem, true); |
| 626 | + }); |
620 | 627 | }
|
621 | 628 | }
|
622 | 629 | }
|
|
655 | 662 | // taggingLabel === false bypasses all of this
|
656 | 663 | if (ctrl.taggingLabel === false) return;
|
657 | 664 |
|
658 |
| - var items = angular.copy( ctrl.items ); |
| 665 | + var items = angular.copy( ctrl.items ) |
659 | 666 | var stashArr = angular.copy( ctrl.items );
|
660 | 667 | var newItem;
|
661 | 668 | var item;
|
|
703 | 710 | return;
|
704 | 711 | }
|
705 | 712 | // verify the the tag doesn't match the value of an existing item from
|
706 |
| - // the searched data set |
707 |
| - if ( _findCaseInsensitiveDupe(stashArr) ) { |
| 713 | + // the searched data set or the items already selected |
| 714 | + if ( _findCaseInsensitiveDupe(stashArr.concat(ctrl.selected)) ) { |
708 | 715 | // if there is a tag from prev iteration, strip it / queue the change
|
709 | 716 | // and return early
|
710 | 717 | if ( hasTag ) {
|
|
1036 | 1043 | });
|
1037 | 1044 |
|
1038 | 1045 | attrs.$observe('taggingLabel', function() {
|
1039 |
| - if(attrs.tagging !== undefined && attrs.taggingLabel !== undefined) |
| 1046 | + if(attrs.tagging !== undefined ) |
1040 | 1047 | {
|
1041 | 1048 | // check eval for FALSE, in this case, we disable the labels
|
1042 | 1049 | // associated with tagging
|
|
1261 | 1268 | };
|
1262 | 1269 | });
|
1263 | 1270 | }());
|
| 1271 | + |
0 commit comments