| @@ 6811-6856 (lines=46) @@ | ||
| 6808 | }; |
|
| 6809 | }) |
|
| 6810 | ||
| 6811 | .directive('uibTypeaheadPopup', ['$$debounce', function($$debounce) { |
|
| 6812 | return { |
|
| 6813 | scope: { |
|
| 6814 | matches: '=', |
|
| 6815 | query: '=', |
|
| 6816 | active: '=', |
|
| 6817 | position: '&', |
|
| 6818 | moveInProgress: '=', |
|
| 6819 | select: '&', |
|
| 6820 | assignIsOpen: '&', |
|
| 6821 | debounce: '&' |
|
| 6822 | }, |
|
| 6823 | replace: true, |
|
| 6824 | templateUrl: function(element, attrs) { |
|
| 6825 | return attrs.popupTemplateUrl || 'uib/template/typeahead/typeahead-popup.html'; |
|
| 6826 | }, |
|
| 6827 | link: function(scope, element, attrs) { |
|
| 6828 | scope.templateUrl = attrs.templateUrl; |
|
| 6829 | ||
| 6830 | scope.isOpen = function() { |
|
| 6831 | var isDropdownOpen = scope.matches.length > 0; |
|
| 6832 | scope.assignIsOpen({ isOpen: isDropdownOpen }); |
|
| 6833 | return isDropdownOpen; |
|
| 6834 | }; |
|
| 6835 | ||
| 6836 | scope.isActive = function(matchIdx) { |
|
| 6837 | return scope.active === matchIdx; |
|
| 6838 | }; |
|
| 6839 | ||
| 6840 | scope.selectActive = function(matchIdx) { |
|
| 6841 | scope.active = matchIdx; |
|
| 6842 | }; |
|
| 6843 | ||
| 6844 | scope.selectMatch = function(activeIdx, evt) { |
|
| 6845 | var debounce = scope.debounce(); |
|
| 6846 | if (angular.isNumber(debounce) || angular.isObject(debounce)) { |
|
| 6847 | $$debounce(function() { |
|
| 6848 | scope.select({activeIdx: activeIdx, evt: evt}); |
|
| 6849 | }, angular.isNumber(debounce) ? debounce : debounce['default']); |
|
| 6850 | } else { |
|
| 6851 | scope.select({activeIdx: activeIdx, evt: evt}); |
|
| 6852 | } |
|
| 6853 | }; |
|
| 6854 | } |
|
| 6855 | }; |
|
| 6856 | }]) |
|
| 6857 | ||
| 6858 | .directive('uibTypeaheadMatch', ['$templateRequest', '$compile', '$parse', function($templateRequest, $compile, $parse) { |
|
| 6859 | return { |
|
| @@ 6810-6855 (lines=46) @@ | ||
| 6807 | }; |
|
| 6808 | }) |
|
| 6809 | ||
| 6810 | .directive('uibTypeaheadPopup', ['$$debounce', function($$debounce) { |
|
| 6811 | return { |
|
| 6812 | scope: { |
|
| 6813 | matches: '=', |
|
| 6814 | query: '=', |
|
| 6815 | active: '=', |
|
| 6816 | position: '&', |
|
| 6817 | moveInProgress: '=', |
|
| 6818 | select: '&', |
|
| 6819 | assignIsOpen: '&', |
|
| 6820 | debounce: '&' |
|
| 6821 | }, |
|
| 6822 | replace: true, |
|
| 6823 | templateUrl: function(element, attrs) { |
|
| 6824 | return attrs.popupTemplateUrl || 'uib/template/typeahead/typeahead-popup.html'; |
|
| 6825 | }, |
|
| 6826 | link: function(scope, element, attrs) { |
|
| 6827 | scope.templateUrl = attrs.templateUrl; |
|
| 6828 | ||
| 6829 | scope.isOpen = function() { |
|
| 6830 | var isDropdownOpen = scope.matches.length > 0; |
|
| 6831 | scope.assignIsOpen({ isOpen: isDropdownOpen }); |
|
| 6832 | return isDropdownOpen; |
|
| 6833 | }; |
|
| 6834 | ||
| 6835 | scope.isActive = function(matchIdx) { |
|
| 6836 | return scope.active === matchIdx; |
|
| 6837 | }; |
|
| 6838 | ||
| 6839 | scope.selectActive = function(matchIdx) { |
|
| 6840 | scope.active = matchIdx; |
|
| 6841 | }; |
|
| 6842 | ||
| 6843 | scope.selectMatch = function(activeIdx, evt) { |
|
| 6844 | var debounce = scope.debounce(); |
|
| 6845 | if (angular.isNumber(debounce) || angular.isObject(debounce)) { |
|
| 6846 | $$debounce(function() { |
|
| 6847 | scope.select({activeIdx: activeIdx, evt: evt}); |
|
| 6848 | }, angular.isNumber(debounce) ? debounce : debounce['default']); |
|
| 6849 | } else { |
|
| 6850 | scope.select({activeIdx: activeIdx, evt: evt}); |
|
| 6851 | } |
|
| 6852 | }; |
|
| 6853 | } |
|
| 6854 | }; |
|
| 6855 | }]) |
|
| 6856 | ||
| 6857 | .directive('uibTypeaheadMatch', ['$templateRequest', '$compile', '$parse', function($templateRequest, $compile, $parse) { |
|
| 6858 | return { |
|