(window.webpackJsonp=window.webpackJsonp||[]).push([[724],{1230:function(t,e,n){var content=n(1523);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,n(122).default)("f96c8fa2",content,!0,{sourceMap:!1})},1522:function(t,e,n){"use strict";n(1230)},1523:function(t,e,n){var o=n(121)(!1);o.push([t.i,".autocomplete{position:relative}.autocomplete-results{padding:0;margin:0;border:1px solid #d7d7d7;height:auto;overflow:auto;position:absolute;width:auto;left:0;right:0;background-color:#fff;z-index:1000}.autocomplete-result{list-style:none;text-align:left;padding:5px 10px;cursor:pointer}.autocomplete-result.is-active,.autocomplete-result:hover{background-color:#4aae9b;color:#fff}",""]),t.exports=o},1906:function(t,e,n){"use strict";n.r(e);n(17),n(182),n(7),n(4),n(152),n(153);var o={name:"SearchAutocomplete",props:{id:{type:String,default:function(){return""}},items:{type:Array,required:!1,default:function(){return[]}},isAsync:{type:Boolean,required:!1,default:function(){return!1}},selected:{type:Object,required:!0,default:function(){}}},data:function(){return{isOpen:!1,results:[],search:"",isLoading:!1,arrowCounter:-1}},computed:{searchAux:{get:function(){return this.selected},set:function(t){this.$emit("update:selected",t)}}},watch:{items:function(t,e){t.length!==e.length&&(this.results=t,this.isLoading=!1)}},mounted:function(){document.addEventListener("click",this.handleClickOutside)},destroyed:function(){document.removeEventListener("click",this.handleClickOutside)},methods:{setResult:function(t){this.searchAux=t,this.search=t.descricao,this.isOpen=!1},filterResults:function(){var t=this;this.results=this.items.filter((function(e){return e.descricao.toLowerCase().includes(t.search.toLowerCase())}))},onChange:function(){this.$emit("input",this.search),this.isAsync?this.isLoading=!0:(this.filterResults(),this.isOpen=!0)},handleClickOutside:function(t){this.$el.contains(t.target)||(this.isOpen=!1,this.arrowCounter=-1)},onArrowDown:function(){this.arrowCounter<this.results.length&&(this.arrowCounter=this.arrowCounter+1)},onArrowUp:function(){this.arrowCounter>0&&(this.arrowCounter=this.arrowCounter-1)},onEnter:function(){this.search=this.results[this.arrowCounter].descricao,this.isOpen=!1,this.arrowCounter=-1}}},r=(n(1522),n(42)),component=Object(r.a)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"autocomplete"},[n("b-form-input",{attrs:{id:t.id,type:"text"},on:{input:t.onChange,keydown:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.onArrowDown.apply(null,arguments)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?null:t.onArrowUp.apply(null,arguments)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.onEnter.apply(null,arguments)}],"!mouse":function(e){return t.onEnter.apply(null,arguments)}},model:{value:t.search,callback:function(e){t.search=e},expression:"search"}}),t._v(" "),n("ul",{directives:[{name:"show",rawName:"v-show",value:t.isOpen,expression:"isOpen"}],staticClass:"autocomplete-results",attrs:{id:"autocomplete-results"}},[t.isLoading?n("li",{staticClass:"loading"},[t._v("Carregando resultados")]):t._l(t.results,(function(e,i){return n("li",{key:i,staticClass:"autocomplete-result",class:{"is-active":i===t.arrowCounter},on:{click:function(n){return t.setResult(e)}}},[t._v("\n      "+t._s(e.descricao)+"\n    ")])}))],2)],1)}),[],!1,null,null,null);e.default=component.exports}}]);
//# sourceMappingURL=9384f59-1.2.11.js.map