ngx-bootstrap-fix-datepicker
Version:
Native Angular Bootstrap Components
16 lines (14 loc) • 32.2 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ngx-bootstrap/utils"),require("ngx-bootstrap/positioning"),require("@angular/animations"),require("@angular/forms"),require("rxjs"),require("ngx-bootstrap/component-loader"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-bootstrap/typeahead",["exports","@angular/core","ngx-bootstrap/utils","ngx-bootstrap/positioning","@angular/animations","@angular/forms","rxjs","ngx-bootstrap/component-loader","rxjs/operators","@angular/common"],t):t(((e=e||self)["ngx-bootstrap"]=e["ngx-bootstrap"]||{},e["ngx-bootstrap"].typeahead={}),e.ng.core,e.utils,e.positioning,e.ng.animations,e.ng.forms,e.rxjs,e.componentLoader,e.rxjs.operators,e.ng.common)}(this,(function(e,t,i,n,a,o,s,r,h,p){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function l(e){var t="function"==typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}var c={"Á":"A","Ă":"A","Ắ":"A","Ặ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ǎ":"A","Â":"A","Ấ":"A","Ậ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ä":"A","Ǟ":"A","Ȧ":"A","Ǡ":"A","Ạ":"A","Ȁ":"A","À":"A","Ả":"A","Ȃ":"A","Ā":"A","Ą":"A","Å":"A","Ǻ":"A","Ḁ":"A","Ⱥ":"A","Ã":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ḃ":"B","Ḅ":"B","Ɓ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ć":"C","Č":"C","Ç":"C","Ḉ":"C","Ĉ":"C","Ċ":"C","Ƈ":"C","Ȼ":"C","Ď":"D","Ḑ":"D","Ḓ":"D","Ḋ":"D","Ḍ":"D","Ɗ":"D","Ḏ":"D","Dz":"D","Dž":"D","Đ":"D","Ƌ":"D","DZ":"DZ","DŽ":"DZ","É":"E","Ĕ":"E","Ě":"E","Ȩ":"E","Ḝ":"E","Ê":"E","Ế":"E","Ệ":"E","Ề":"E","Ể":"E","Ễ":"E","Ḙ":"E","Ë":"E","Ė":"E","Ẹ":"E","Ȅ":"E","È":"E","Ẻ":"E","Ȇ":"E","Ē":"E","Ḗ":"E","Ḕ":"E","Ę":"E","Ɇ":"E","Ẽ":"E","Ḛ":"E","Ꝫ":"ET","Ḟ":"F","Ƒ":"F","Ǵ":"G","Ğ":"G","Ǧ":"G","Ģ":"G","Ĝ":"G","Ġ":"G","Ɠ":"G","Ḡ":"G","Ǥ":"G","Ḫ":"H","Ȟ":"H","Ḩ":"H","Ĥ":"H","Ⱨ":"H","Ḧ":"H","Ḣ":"H","Ḥ":"H","Ħ":"H","Í":"I","Ĭ":"I","Ǐ":"I","Î":"I","Ï":"I","Ḯ":"I","İ":"I","Ị":"I","Ȉ":"I","Ì":"I","Ỉ":"I","Ȋ":"I","Ī":"I","Į":"I","Ɨ":"I","Ĩ":"I","Ḭ":"I","Ꝺ":"D","Ꝼ":"F","Ᵹ":"G","Ꞃ":"R","Ꞅ":"S","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":"T","ⱻ":"E","ᴚ":"R","ᴜ":"U","ᴠ":"V","ᴡ":"W","ʏ":"Y","ᴢ":"Z","á":"a","ă":"a","ắ":"a","ặ":"a","ằ":"a","ẳ":"a","ẵ":"a","ǎ":"a","â":"a","ấ":"a","ậ":"a","ầ":"a","ẩ":"a","ẫ":"a","ä":"a","ǟ":"a","ȧ":"a","ǡ":"a","ạ":"a","ȁ":"a","à":"a","ả":"a","ȃ":"a","ā":"a","ą":"a","ᶏ":"a","ẚ":"a","å":"a","ǻ":"a","ḁ":"a","ⱥ":"a","ã":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ḃ":"b","ḅ":"b","ɓ":"b","ḇ":"b","ᵬ":"b","ᶀ":"b","ƀ":"b","ƃ":"b","ɵ":"o","ć":"c","č":"c","ç":"c","ḉ":"c","ĉ":"c","ɕ":"c","ċ":"c","ƈ":"c","ȼ":"c","ď":"d","ḑ":"d","ḓ":"d","ȡ":"d","ḋ":"d","ḍ":"d","ɗ":"d","ᶑ":"d","ḏ":"d","ᵭ":"d","ᶁ":"d","đ":"d","ɖ":"d","ƌ":"d","ı":"i","ȷ":"j","ɟ":"j","ʄ":"j","dz":"dz","dž":"dz","é":"e","ĕ":"e","ě":"e","ȩ":"e","ḝ":"e","ê":"e","ế":"e","ệ":"e","ề":"e","ể":"e","ễ":"e","ḙ":"e","ë":"e","ė":"e","ẹ":"e","ȅ":"e","è":"e","ẻ":"e","ȇ":"e","ē":"e","ḗ":"e","ḕ":"e","ⱸ":"e","ę":"e","ᶒ":"e","ɇ":"e","ẽ":"e","ḛ":"e","ꝫ":"et","ḟ":"f","ƒ":"f","ᵮ":"f","ᶂ":"f","ǵ":"g","ğ":"g","ǧ":"g","ģ":"g","ĝ":"g","ġ":"g","ɠ":"g","ḡ":"g","ᶃ":"g","ǥ":"g","ḫ":"h","ȟ":"h","ḩ":"h","ĥ":"h","ⱨ":"h","ḧ":"h","ḣ":"h","ḥ":"h","ɦ":"h","ẖ":"h","ħ":"h","ƕ":"hv","í":"i","ĭ":"i","ǐ":"i","î":"i","ï":"i","ḯ":"i","ị":"i","ȉ":"i","ì":"i","ỉ":"i","ȋ":"i","ī":"i","į":"i","ᶖ":"i","ɨ":"i","ĩ":"i","ḭ":"i","ꝺ":"d","ꝼ":"f","ᵹ":"g","ꞃ":"r","ꞅ":"s","ꞇ":"t","ꝭ":"is","ǰ":"j","ĵ":"j","ʝ":"j","ɉ":"j","ḱ":"k","ǩ":"k","ķ":"k","ⱪ":"k","ꝃ":"k","ḳ":"k","ƙ":"k","ḵ":"k","ᶄ":"k","ꝁ":"k","ꝅ":"k","ĺ":"l","ƚ":"l","ɬ":"l","ľ":"l","ļ":"l","ḽ":"l","ȴ":"l","ḷ":"l","ḹ":"l","ⱡ":"l","ꝉ":"l","ḻ":"l","ŀ":"l","ɫ":"l","ᶅ":"l","ɭ":"l","ł":"l","lj":"lj","ſ":"s","ẜ":"s","ẛ":"s","ẝ":"s","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ᵯ":"m","ᶆ":"m","ń":"n","ň":"n","ņ":"n","ṋ":"n","ȵ":"n","ṅ":"n","ṇ":"n","ǹ":"n","ɲ":"n","ṉ":"n","ƞ":"n","ᵰ":"n","ᶇ":"n","ɳ":"n","ñ":"n","nj":"nj","ó":"o","ŏ":"o","ǒ":"o","ô":"o","ố":"o","ộ":"o","ồ":"o","ổ":"o","ỗ":"o","ö":"o","ȫ":"o","ȯ":"o","ȱ":"o","ọ":"o","ő":"o","ȍ":"o","ò":"o","ỏ":"o","ơ":"o","ớ":"o","ợ":"o","ờ":"o","ở":"o","ỡ":"o","ȏ":"o","ꝋ":"o","ꝍ":"o","ⱺ":"o","ō":"o","ṓ":"o","ṑ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","õ":"o","ṍ":"o","ṏ":"o","ȭ":"o","ƣ":"oi","ꝏ":"oo","ɛ":"e","ᶓ":"e","ɔ":"o","ᶗ":"o","ȣ":"ou","ṕ":"p","ṗ":"p","ꝓ":"p","ƥ":"p","ᵱ":"p","ᶈ":"p","ꝕ":"p","ᵽ":"p","ꝑ":"p","ꝙ":"q","ʠ":"q","ɋ":"q","ꝗ":"q","ŕ":"r","ř":"r","ŗ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ȑ":"r","ɾ":"r","ᵳ":"r","ȓ":"r","ṟ":"r","ɼ":"r","ᵲ":"r","ᶉ":"r","ɍ":"r","ɽ":"r","ↄ":"c","ꜿ":"c","ɘ":"e","ɿ":"r","ś":"s","ṥ":"s","š":"s","ṧ":"s","ş":"s","ŝ":"s","ș":"s","ṡ":"s","ṣ":"s","ṩ":"s","ʂ":"s","ᵴ":"s","ᶊ":"s","ȿ":"s","ɡ":"g","ᴑ":"o","ᴓ":"o","ᴝ":"u","ť":"t","ţ":"t","ṱ":"t","ț":"t","ȶ":"t","ẗ":"t","ⱦ":"t","ṫ":"t","ṭ":"t","ƭ":"t","ṯ":"t","ᵵ":"t","ƫ":"t","ʈ":"t","ŧ":"t","ᵺ":"th","ɐ":"a","ᴂ":"ae","ǝ":"e","ᵷ":"g","ɥ":"h","ʮ":"h","ʯ":"h","ᴉ":"i","ʞ":"k","ꞁ":"l","ɯ":"m","ɰ":"m","ᴔ":"oe","ɹ":"r","ɻ":"r","ɺ":"r","ⱹ":"r","ʇ":"t","ʌ":"v","ʍ":"w","ʎ":"y","ꜩ":"tz","ú":"u","ŭ":"u","ǔ":"u","û":"u","ṷ":"u","ü":"u","ǘ":"u","ǚ":"u","ǜ":"u","ǖ":"u","ṳ":"u","ụ":"u","ű":"u","ȕ":"u","ù":"u","ủ":"u","ư":"u","ứ":"u","ự":"u","ừ":"u","ử":"u","ữ":"u","ȗ":"u","ū":"u","ṻ":"u","ų":"u","ᶙ":"u","ů":"u","ũ":"u","ṹ":"u","ṵ":"u","ᵫ":"ue","ꝸ":"um","ⱴ":"v","ꝟ":"v","ṿ":"v","ʋ":"v","ᶌ":"v","ⱱ":"v","ṽ":"v","ꝡ":"vy","ẃ":"w","ŵ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẁ":"w","ⱳ":"w","ẘ":"w","ẍ":"x","ẋ":"x","ᶍ":"x","ý":"y","ŷ":"y","ÿ":"y","ẏ":"y","ỵ":"y","ỳ":"y","ƴ":"y","ỷ":"y","ỿ":"y","ȳ":"y","ẙ":"y","ɏ":"y","ỹ":"y","ź":"z","ž":"z","ẑ":"z","ʑ":"z","ⱬ":"z","ż":"z","ẓ":"z","ȥ":"z","ẕ":"z","ᵶ":"z","ᶎ":"z","ʐ":"z","ƶ":"z","ɀ":"z","ff":"ff","ffi":"ffi","ffl":"ffl","fi":"fi","fl":"fl","ij":"ij","œ":"oe","st":"st","ₐ":"a","ₑ":"e","ᵢ":"i","ⱼ":"j","ₒ":"o","ᵣ":"r","ᵤ":"u","ᵥ":"v","ₓ":"x"},u=function(e){Object.assign(this,e)};var d=function(){function e(e,t,i){void 0===t&&(t=e),void 0===i&&(i=!1),this.item=e,this.value=t,this.header=i}return e.prototype.isHeader=function(){return this.header},e.prototype.toString=function(){return this.value},e}();var y=function(){};function m(e){return e?e.replace(/[^A-Za-z0-9\[\] ]/g,(function(e){return c[e]||e})):""}function g(e,t,i){void 0===t&&(t=" "),void 0===i&&(i="");for(var n,a="(?:["+i+"])([^"+i+"]+)(?:["+i+"])|([^"+t+"]+)",o=e.split(new RegExp(a,"g")),s=[],r=o.length,h=new RegExp("["+i+"]+","g"),p=0;p<r;p+=1)(n=o[p])&&n.length&&n!==t&&s.push(n.replace(h,""));return s}function f(e,t){var i,n;if(!t||"object"!=typeof e)return e.toString();if(t.endsWith("()"))return e[t.slice(0,t.length-2)]().toString();var a=t.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");try{for(var o=l(a),s=o.next();!s.done;s=o.next()){var r=s.value;r in e&&(e=e[r])}}catch(e){i={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return e?e.toString():""}var v=a.trigger("typeaheadAnimation",[a.state("animated-down",a.style({height:"*",overflow:"hidden"})),a.transition("* => animated-down",[a.style({height:0,overflow:"hidden"}),a.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),a.state("animated-up",a.style({height:"*",overflow:"hidden"})),a.transition("* => animated-up",[a.style({height:"*",overflow:"hidden"}),a.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),a.transition("* => unanimated",a.animate("0s"))]),b=0,O=function(){function e(e,i,n,a){var o=this;this.positionService=e,this.renderer=i,this.element=n,this.changeDetectorRef=a,this.activeChangeEvent=new t.EventEmitter,this.isFocused=!1,this.height=0,this.popupId="ngb-typeahead-"+b++,this._matches=[],this.isScrolledIntoView=function(e){var t=this.ulElement.nativeElement.scrollTop,i=t+Number(this.ulElement.nativeElement.offsetHeight),n=e.offsetTop;return n+e.offsetHeight<=i&&n>=t},this.renderer.setAttribute(this.element.nativeElement,"id",this.popupId),this.positionServiceSubscription=this.positionService.event$.subscribe((function(){if(o.isAnimated)return o.animationState=o.isTopPosition?"animated-up":"animated-down",void o.changeDetectorRef.detectChanges();o.animationState="unanimated",o.changeDetectorRef.detectChanges()}))}return Object.defineProperty(e.prototype,"isBs4",{get:function(){return!i.isBs3()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"typeaheadTemplateMethods",{get:function(){return{selectMatch:this.selectMatch.bind(this),selectActive:this.selectActive.bind(this),isActive:this.isActive.bind(this)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"active",{get:function(){return this._active},set:function(e){this._active=e,this.activeChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"matches",{get:function(){return this._matches},set:function(e){var t=this;if(this.positionService.setOptions({modifiers:{flip:{enabled:this.adaptivePosition}},allowedPositions:["top","bottom"]}),this._matches=e,this.needScrollbar=this.typeaheadScrollable&&this.typeaheadOptionsInScrollableView<this.matches.length,this.typeaheadScrollable&&setTimeout((function(){t.setScrollableMode()})),this.typeaheadIsFirstItemActive&&this._matches.length>0&&(this.active=this._matches[0],this._active.isHeader()&&this.nextActiveMatch()),this._active&&!this.typeaheadIsFirstItemActive){var i=this._matches.find((function(e){return e.value===t._active.value}));if(i)return void this.selectActive(i);this.active=null}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isTopPosition",{get:function(){return this.element.nativeElement.classList.contains("top")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"optionsListTemplate",{get:function(){return this.parent?this.parent.optionsListTemplate:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnimated",{get:function(){return!!this.parent&&this.parent.isAnimated},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"adaptivePosition",{get:function(){return!!this.parent&&this.parent.adaptivePosition},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"typeaheadScrollable",{get:function(){return!!this.parent&&this.parent.typeaheadScrollable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"typeaheadOptionsInScrollableView",{get:function(){return this.parent?this.parent.typeaheadOptionsInScrollableView:5},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"typeaheadIsFirstItemActive",{get:function(){return!this.parent||this.parent.typeaheadIsFirstItemActive},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"itemTemplate",{get:function(){return this.parent?this.parent.typeaheadItemTemplate:void 0},enumerable:!0,configurable:!0}),e.prototype.selectActiveMatch=function(e){this._active&&this.parent.typeaheadSelectFirstItem&&this.selectMatch(this._active),!this.parent.typeaheadSelectFirstItem&&e&&this.selectMatch(this._active)},e.prototype.activeChanged=function(){var e=this.matches.indexOf(this._active);this.activeChangeEvent.emit(this.popupId+"-"+e)},e.prototype.prevActiveMatch=function(){var e=this.matches.indexOf(this._active);this.active=this.matches[e-1<0?this.matches.length-1:e-1],this._active.isHeader()&&this.prevActiveMatch(),this.typeaheadScrollable&&this.scrollPrevious(e)},e.prototype.nextActiveMatch=function(){var e=this.matches.indexOf(this._active);this.active=this.matches[e+1>this.matches.length-1?0:e+1],this._active.isHeader()&&this.nextActiveMatch(),this.typeaheadScrollable&&this.scrollNext(e)},e.prototype.selectActive=function(e){this.isFocused=!0,this.active=e},e.prototype.highlight=function(e,t){var i,n,a=e.value,o=(this.parent&&this.parent.typeaheadLatinize?m(a):a).toLowerCase();if("object"==typeof t)for(var s=t.length,r=0;r<s;r+=1)i=o.indexOf(t[r]),n=t[r].length,i>=0&&n>0&&(a=a.substring(0,i)+"<strong>"+a.substring(i,i+n)+"</strong>"+a.substring(i+n),o=o.substring(0,i)+" "+" ".repeat(n)+" "+o.substring(i+n));else t&&(i=o.indexOf(t),n=t.length,i>=0&&n>0&&(a=a.substring(0,i)+"<strong>"+a.substring(i,i+n)+"</strong>"+a.substring(i+n)));return a},e.prototype.focusLost=function(){this.isFocused=!1},e.prototype.isActive=function(e){return this.active===e},e.prototype.selectMatch=function(e,t){var i=this;return void 0===t&&(t=void 0),t&&(t.stopPropagation(),t.preventDefault()),this.parent.changeModel(e),setTimeout((function(){return i.parent.typeaheadOnSelect.emit(e)}),0),!1},e.prototype.setScrollableMode=function(){if(this.ulElement||(this.ulElement=this.element),this.liElements.first){var e=i.Utils.getStyles(this.ulElement.nativeElement),t=i.Utils.getStyles(this.liElements.first.nativeElement),n=parseFloat((e["padding-bottom"]?e["padding-bottom"]:"").replace("px","")),a=parseFloat((e["padding-top"]?e["padding-top"]:"0").replace("px","")),o=parseFloat((t.height?t.height:"0").replace("px","")),s=this.typeaheadOptionsInScrollableView*o;this.guiHeight=s+a+n+"px"}this.renderer.setStyle(this.element.nativeElement,"visibility","visible")},e.prototype.scrollPrevious=function(e){if(0!==e){if(this.liElements){var t=this.liElements.toArray()[e-1];t&&!this.isScrolledIntoView(t.nativeElement)&&(this.ulElement.nativeElement.scrollTop=t.nativeElement.offsetTop)}}else this.scrollToBottom()},e.prototype.scrollNext=function(e){if(e+1>this.matches.length-1)this.scrollToTop();else if(this.liElements){var t=this.liElements.toArray()[e+1];t&&!this.isScrolledIntoView(t.nativeElement)&&(this.ulElement.nativeElement.scrollTop=t.nativeElement.offsetTop-Number(this.ulElement.nativeElement.offsetHeight)+Number(t.nativeElement.offsetHeight))}},e.prototype.ngOnDestroy=function(){this.positionServiceSubscription.unsubscribe()},e.prototype.scrollToBottom=function(){this.ulElement.nativeElement.scrollTop=this.ulElement.nativeElement.scrollHeight},e.prototype.scrollToTop=function(){this.ulElement.nativeElement.scrollTop=0},e.decorators=[{type:t.Component,args:[{selector:"typeahead-container",template:'\x3c!-- inject options list template --\x3e\n<ng-template [ngTemplateOutlet]="optionsListTemplate || (isBs4 ? bs4Template : bs3Template)"\n [ngTemplateOutletContext]="{\n matches: matches,\n itemTemplate: itemTemplate || bsItemTemplate,\n query: query,\n $implicit: typeaheadTemplateMethods\n }">\n</ng-template>\n\n\x3c!-- default options item template --\x3e\n<ng-template #bsItemTemplate let-match="match" let-query="query">\n <span [innerHtml]="highlight(match, query)"></span>\n</ng-template>\n\n\x3c!-- Bootstrap 3 options list template --\x3e\n<ng-template #bs3Template>\n <ul class="dropdown-menu"\n #ulElement\n role="listbox"\n [style.overflow-y]="needScrollbar ? \'scroll\': \'auto\'"\n [style.height]="needScrollbar ? guiHeight: \'auto\'">\n <ng-template ngFor let-match let-i="index" [ngForOf]="matches">\n <li #liElements *ngIf="match.isHeader()" class="dropdown-header">{{ match }}</li>\n <li #liElements\n *ngIf="!match.isHeader()"\n [id]="popupId + \'-\' + i"\n role="option"\n [@typeaheadAnimation]="animationState"\n [class.active]="isActive(match)"\n (mouseenter)="selectActive(match)">\n\n <a href="#" (click)="selectMatch(match, $event)" tabindex="-1">\n <ng-template [ngTemplateOutlet]="itemTemplate || bsItemTemplate"\n [ngTemplateOutletContext]="{item: match.item, index: i, match: match, query: query}">\n </ng-template>\n </a>\n </li>\n </ng-template>\n </ul>\n</ng-template>\n\n\x3c!-- Bootstrap 4 options list template --\x3e\n<ng-template #bs4Template>\n <ng-template ngFor let-match let-i="index" [ngForOf]="matches">\n <h6 *ngIf="match.isHeader()" class="dropdown-header">{{ match }}</h6>\n <ng-template [ngIf]="!match.isHeader()">\n <button #liElements\n [id]="popupId + \'-\' + i"\n role="option"\n [@typeaheadAnimation]="animationState"\n class="dropdown-item"\n (click)="selectMatch(match, $event)"\n (mouseenter)="selectActive(match)"\n [class.active]="isActive(match)">\n <ng-template [ngTemplateOutlet]="itemTemplate || bsItemTemplate"\n [ngTemplateOutletContext]="{item: match.item, index: i, match: match, query: query}">\n </ng-template>\n </button>\n </ng-template>\n </ng-template>\n</ng-template>\n',host:{class:"dropdown open bottom","[class.dropdown-menu]":"isBs4","[style.height]":"isBs4 && needScrollbar ? guiHeight: 'auto'","[style.visibility]":"'inherit'","[class.dropup]":"dropup",style:"position: absolute;display: block;","[attr.role]":"isBs4 ? 'listbox' : null "},animations:[v],styles:["\n :host.dropdown {\n z-index: 1000;\n }\n\n :host.dropdown-menu, .dropdown-menu {\n overflow-y: auto;\n height: 100px;\n }\n "]}]}],e.ctorParameters=function(){return[{type:n.PositioningService},{type:t.Renderer2},{type:t.ElementRef},{type:t.ChangeDetectorRef}]},e.propDecorators={activeChangeEvent:[{type:t.Output,args:["activeChange"]}],ulElement:[{type:t.ViewChild,args:["ulElement",{static:!1}]}],liElements:[{type:t.ViewChildren,args:["liElements"]}],focusLost:[{type:t.HostListener,args:["mouseleave"]},{type:t.HostListener,args:["blur"]}]},e}();var E=function(){function e(){this.adaptivePosition=!1,this.isAnimated=!1,this.hideResultsOnBlur=!0,this.cancelRequestOnFocusLost=!1,this.selectFirstItem=!0,this.isFirstItemActive=!0,this.minLength=1}return e.decorators=[{type:t.Injectable}],e}();var A=function(){function e(e,i,n,a,o,s,r){this.changeDetection=n,this.element=a,this.ngControl=o,this.renderer=s,this.typeaheadMinLength=void 0,this.isAnimated=!1,this.typeaheadAsync=void 0,this.typeaheadLatinize=!0,this.typeaheadSingleWords=!0,this.typeaheadWordDelimiters=" ",this.typeaheadPhraseDelimiters="'\"",this.typeaheadScrollable=!1,this.typeaheadOptionsInScrollableView=5,this.typeaheadSelectFirstItem=!0,this.typeaheadIsFirstItemActive=!0,this.typeaheadLoading=new t.EventEmitter,this.typeaheadNoResults=new t.EventEmitter,this.typeaheadOnSelect=new t.EventEmitter,this.typeaheadOnBlur=new t.EventEmitter,this.dropup=!1,this.isOpen=!1,this.list="list",this.isActiveItemChanged=!1,this.isFocused=!1,this.cancelRequestOnFocusLost=!1,this.keyUpEventEmitter=new t.EventEmitter,this.placement="bottom left",this._subscriptions=[],this._typeahead=e.createLoader(a,r,s).provide({provide:E,useValue:i}),Object.assign(this,{typeaheadHideResultsOnBlur:i.hideResultsOnBlur,typeaheadCancelRequestOnFocusLost:i.cancelRequestOnFocusLost,typeaheadSelectFirstItem:i.selectFirstItem,typeaheadIsFirstItemActive:i.isFirstItemActive,typeaheadMinLength:i.minLength,adaptivePosition:i.adaptivePosition,isAnimated:i.isAnimated})}return e.prototype.ngOnInit=function(){this.typeaheadOptionsLimit=this.typeaheadOptionsLimit||20,this.typeaheadMinLength=void 0===this.typeaheadMinLength?1:this.typeaheadMinLength,this.typeaheadWaitMs=this.typeaheadWaitMs||0,void 0!==this.typeaheadAsync||s.isObservable(this.typeahead)||(this.typeaheadAsync=!1),s.isObservable(this.typeahead)&&(this.typeaheadAsync=!0),this.typeaheadAsync?this.asyncActions():this.syncActions()},e.prototype.onInput=function(e){var t=void 0!==e.target.value?e.target.value:void 0!==e.target.textContent?e.target.textContent:e.target.innerText;null!=t&&t.trim().length>=this.typeaheadMinLength?(this.typeaheadLoading.emit(!0),this.keyUpEventEmitter.emit(e.target.value)):(this.typeaheadLoading.emit(!1),this.typeaheadNoResults.emit(!1),this.hide())},e.prototype.onChange=function(e){if(this._container){if(27===e.keyCode||"Escape"===e.key)return void this.hide();if(38===e.keyCode||"ArrowUp"===e.key)return this.isActiveItemChanged=!0,void this._container.prevActiveMatch();if(40===e.keyCode||"ArrowDown"===e.key)return this.isActiveItemChanged=!0,void this._container.nextActiveMatch();if(13===e.keyCode||"Enter"===e.key)return void this._container.selectActiveMatch()}},e.prototype.onFocus=function(){var e=this;this.isFocused=!0,setTimeout((function(){0===e.typeaheadMinLength&&(e.typeaheadLoading.emit(!0),e.keyUpEventEmitter.emit(e.element.nativeElement.value||""))}),0)},e.prototype.onBlur=function(){this.isFocused=!1,this._container&&!this._container.isFocused&&this.typeaheadOnBlur.emit(this._container.active),this.container||0!==this._matches.length||this.typeaheadOnBlur.emit(new d(this.element.nativeElement.value,this.element.nativeElement.value,!1))},e.prototype.onKeydown=function(e){if(this._container&&(9!==e.keyCode&&"Tab"!==e.key||this.onBlur(),9===e.keyCode||"Tab"===e.key||13===e.keyCode||"Enter"===e.key)){if(e.preventDefault(),this.typeaheadSelectFirstItem)return void this._container.selectActiveMatch();this.typeaheadSelectFirstItem||(this._container.selectActiveMatch(this.isActiveItemChanged),this.isActiveItemChanged=!1,this.hide())}},e.prototype.changeModel=function(e){var t=e.value;this.ngControl.viewToModelUpdate(t),this.ngControl.control.setValue(t),this.changeDetection.markForCheck(),this.hide()},Object.defineProperty(e.prototype,"matches",{get:function(){return this._matches},enumerable:!0,configurable:!0}),e.prototype.show=function(){var e=this;this._typeahead.attach(O).to(this.container).position({attachment:(this.dropup?"top":"bottom")+" left"}).show({typeaheadRef:this,placement:this.placement,animation:!1,dropup:this.dropup}),this._outsideClickListener=this.renderer.listen("document","click",(function(t){0===e.typeaheadMinLength&&e.element.nativeElement.contains(t.target)||e.typeaheadHideResultsOnBlur&&!e.element.nativeElement.contains(t.target)&&e.onOutsideClick()})),this._container=this._typeahead.instance,this._container.parent=this;var t=(this.typeaheadLatinize?m(this.ngControl.control.value):this.ngControl.control.value).toString().toLowerCase();this._container.query=this.typeaheadSingleWords?g(t,this.typeaheadWordDelimiters,this.typeaheadPhraseDelimiters):t,this._container.matches=this._matches,this.element.nativeElement.focus(),this._container.activeChangeEvent.subscribe((function(t){e.activeDescendant=t,e.changeDetection.markForCheck()})),this.isOpen=!0},e.prototype.hide=function(){this._typeahead.isShown&&(this._typeahead.hide(),this._outsideClickListener(),this._container=null,this.isOpen=!1,this.changeDetection.markForCheck())},e.prototype.onOutsideClick=function(){this._container&&!this._container.isFocused&&this.hide()},e.prototype.ngOnDestroy=function(){var e,t;try{for(var i=l(this._subscriptions),n=i.next();!n.done;n=i.next()){n.value.unsubscribe()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this._typeahead.dispose()},e.prototype.asyncActions=function(){var e=this;this._subscriptions.push(this.keyUpEventEmitter.pipe(h.debounceTime(this.typeaheadWaitMs),h.switchMap((function(){return e.typeahead}))).subscribe((function(t){e.finalizeAsyncCall(t)})))},e.prototype.syncActions=function(){var e=this;this._subscriptions.push(this.keyUpEventEmitter.pipe(h.debounceTime(this.typeaheadWaitMs),h.mergeMap((function(t){var i=e.normalizeQuery(t);return s.from(e.typeahead).pipe(h.filter((function(t){return t&&e.testMatch(e.normalizeOption(t),i)})),h.toArray())}))).subscribe((function(t){e.finalizeAsyncCall(t)})))},e.prototype.normalizeOption=function(e){var t=f(e,this.typeaheadOptionField);return(this.typeaheadLatinize?m(t):t).toLowerCase()},e.prototype.normalizeQuery=function(e){var t=(this.typeaheadLatinize?m(e):e).toString().toLowerCase();return t=this.typeaheadSingleWords?g(t,this.typeaheadWordDelimiters,this.typeaheadPhraseDelimiters):t},e.prototype.testMatch=function(e,t){var i;if("object"==typeof t){i=t.length;for(var n=0;n<i;n+=1)if(t[n].length>0&&e.indexOf(t[n])<0)return!1;return!0}return e.indexOf(t)>=0},e.prototype.finalizeAsyncCall=function(e){if(this.prepareMatches(e||[]),this.typeaheadLoading.emit(!1),this.typeaheadNoResults.emit(!this.hasMatches()),this.hasMatches()){if(this.isFocused||!this.cancelRequestOnFocusLost)if(this._container){var t=((this.typeaheadLatinize?m(this.ngControl.control.value):this.ngControl.control.value)||"").toString().toLowerCase();this._container.query=this.typeaheadSingleWords?g(t,this.typeaheadWordDelimiters,this.typeaheadPhraseDelimiters):t,this._container.matches=this._matches}else this.show()}else this.hide()},e.prototype.prepareMatches=function(e){var t=this,i=e.slice(0,this.typeaheadOptionsLimit),n=this.typeaheadOrderBy?this.orderMatches(i):i;if(this.typeaheadGroupField){var a=[];n.map((function(e){return f(e,t.typeaheadGroupField)})).filter((function(e,t,i){return i.indexOf(e)===t})).forEach((function(e){a.push(new d(e,e,!0)),a=a.concat(n.filter((function(i){return f(i,t.typeaheadGroupField)===e})).map((function(e){return new d(e,f(e,t.typeaheadOptionField))})))})),this._matches=a}else this._matches=n.map((function(e){return new d(e,f(e,t.typeaheadOptionField))}))},e.prototype.orderMatches=function(e){if(!e.length)return e;if(null!==this.typeaheadOrderBy&&void 0!==this.typeaheadOrderBy&&"object"==typeof this.typeaheadOrderBy&&0===Object.keys(this.typeaheadOrderBy).length)return console.error("Field and direction properties for typeaheadOrderBy have to be set according to documentation!"),e;var t=this.typeaheadOrderBy,i=t.field,n=t.direction;return!n||"asc"!==n&&"desc"!==n?(console.error('typeaheadOrderBy direction has to equal "asc" or "desc". Please follow the documentation.'),e):"string"==typeof e[0]?"asc"===n?e.sort():e.sort().reverse():i&&"string"==typeof i?e.sort((function(e,t){var a=f(e,i),o=f(t,i);return a<o?"asc"===n?-1:1:a>o?"asc"===n?1:-1:0})):(console.error("typeaheadOrderBy field has to set according to the documentation."),e)},e.prototype.hasMatches=function(){return this._matches.length>0},e.decorators=[{type:t.Directive,args:[{selector:"[typeahead]",exportAs:"bs-typeahead",host:{"[attr.aria-activedescendant]":"activeDescendant","[attr.aria-aria-owns]":"isOpen ? this._container.popupId : null","[attr.aria-aria-expanded]":"isOpen","[attr.aria-autocomplete]":"list"}}]}],e.ctorParameters=function(){return[{type:r.ComponentLoaderFactory},{type:E},{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:o.NgControl},{type:t.Renderer2},{type:t.ViewContainerRef}]},e.propDecorators={typeahead:[{type:t.Input}],typeaheadMinLength:[{type:t.Input}],adaptivePosition:[{type:t.Input}],isAnimated:[{type:t.Input}],typeaheadWaitMs:[{type:t.Input}],typeaheadOptionsLimit:[{type:t.Input}],typeaheadOptionField:[{type:t.Input}],typeaheadGroupField:[{type:t.Input}],typeaheadOrderBy:[{type:t.Input}],typeaheadAsync:[{type:t.Input}],typeaheadLatinize:[{type:t.Input}],typeaheadSingleWords:[{type:t.Input}],typeaheadWordDelimiters:[{type:t.Input}],typeaheadPhraseDelimiters:[{type:t.Input}],typeaheadItemTemplate:[{type:t.Input}],optionsListTemplate:[{type:t.Input}],typeaheadScrollable:[{type:t.Input}],typeaheadOptionsInScrollableView:[{type:t.Input}],typeaheadHideResultsOnBlur:[{type:t.Input}],typeaheadSelectFirstItem:[{type:t.Input}],typeaheadIsFirstItemActive:[{type:t.Input}],typeaheadLoading:[{type:t.Output}],typeaheadNoResults:[{type:t.Output}],typeaheadOnSelect:[{type:t.Output}],typeaheadOnBlur:[{type:t.Output}],container:[{type:t.Input}],dropup:[{type:t.Input}],onInput:[{type:t.HostListener,args:["input",["$event"]]}],onChange:[{type:t.HostListener,args:["keyup",["$event"]]}],onFocus:[{type:t.HostListener,args:["click"]},{type:t.HostListener,args:["focus"]}],onBlur:[{type:t.HostListener,args:["blur"]}],onKeydown:[{type:t.HostListener,args:["keydown",["$event"]]}]},e}();var I=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[r.ComponentLoaderFactory,n.PositioningService,E]}},e.decorators=[{type:t.NgModule,args:[{imports:[p.CommonModule],declarations:[O,A],exports:[O,A],entryComponents:[O]}]}],e}();e.TypeaheadConfig=E,e.TypeaheadContainerComponent=O,e.TypeaheadDirective=A,e.TypeaheadMatch=d,e.TypeaheadModule=I,e.TypeaheadOptions=u,e.TypeaheadOrder=y,e.escapeRegexp=function(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},e.getValueFromObject=f,e.latinMap=c,e.latinize=m,e.tokenize=g,e.ɵa=v,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-bootstrap-typeahead.umd.min.js.map