| | |
| | | source : '&', |
| | | page : "=", |
| | | totalPage : "=", |
| | | inputDisabled : "=", |
| | | inputDisabled : "=?", |
| | | customInput : "=", |
| | | }, |
| | | templateUrl : "custom_components/js-autocomplete-single/js-autocomplete-single.html", |
| | | link : function ($scope, $element, $attrs) { |
| | |
| | | var blank_pattern = /^\s+|\s+$/g; |
| | | |
| | | // 입력 필드 비활성화 |
| | | if (!angular.isDefined($scope.inputDisabled)) { |
| | | if (!$rootScope.isDefined($scope.inputDisabled)) { |
| | | $scope.inputDisabled = false; |
| | | } |
| | | |
| | | /*if (!angular.isDefined($scope.customInput)) { |
| | | $scope.customInput = false; |
| | | }*/ |
| | | |
| | | $scope.options = []; // 전체 목록 |
| | | $scope.networkSuccess = false; // 통신 완료 후 화면 표시. |
| | |
| | | |
| | | // 검색된 아이템 클릭시 입력 필드 포커스 주기 |
| | | function searchInputField() { |
| | | if ($scope.selectedModel.length > 0) { |
| | | if (angular.isDefined($scope.selectedModel) && $scope.selectedModel.length > 0) { |
| | | $($element).find(".input-tag-search-field-readonly").focus(); |
| | | } |
| | | } |
| | |
| | | function toggleDropdown() { |
| | | // 아이템이 선택되어 있을 경우 목록 레이어는 표시될 수 없다. |
| | | $scope.open = true; |
| | | // if ($scope.selectedModel.length > 0) { |
| | | // $scope.open = false; |
| | | // $scope.options = []; |
| | | // } |
| | | // else { |
| | | // $scope.open = true; |
| | | // } |
| | | if ($rootScope.isDefined($scope.search) && $rootScope.isDefined($scope.selectedModel) && $scope.selectedModel.length > 0) { |
| | | $scope.open = false; |
| | | $scope.options = []; |
| | | } |
| | | else { |
| | | $scope.open = true; |
| | | } |
| | | |
| | | // 팝업 창에서 입력 필드에 포커스가 가면 자동 스크롤. |
| | | if ($scope.settings.autoResize) { |
| | |
| | | switch (event.keyCode) { |
| | | case 9 : // 탭키 닫기 |
| | | $scope.open = false; |
| | | $scope.search = ""; |
| | | if (!angular.isDefined($scope.customInput) && !$scope.customInput) { |
| | | $scope.search = ""; |
| | | } |
| | | $scope.page = 0; |
| | | $scope.totalPage = 0; |
| | | $scope.options = []; |
| | |
| | | } |
| | | |
| | | break; |
| | | case 32 : // 대상 선택 |
| | | /*case 32 : // 대상 선택 |
| | | event.preventDefault(); |
| | | event.stopPropagation(); |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | break; |
| | | break;*/ |
| | | case 38 : // 위 |
| | | event.preventDefault(); |
| | | event.stopPropagation(); |
| | |
| | | $scope.$apply(function () { |
| | | $scope.open = false; |
| | | if ($scope.selectedModel == null || $scope.selectedModel.length == 0) { |
| | | $scope.search = ""; |
| | | if (!angular.isDefined($scope.customInput) && !$scope.customInput) { |
| | | $scope.search = ""; |
| | | } |
| | | } |
| | | $scope.page = 0; |
| | | $scope.totalPage = 0; |