vue-select-infinite-scroll
Version:
vue-select-infinite-scroll is an infinite scroll dropdown with filter input for vue.js.
2 lines • 5.06 kB
JavaScript
(function(t){function e(e){for(var i,a,c=e[0],l=e[1],s=e[2],d=0,f=[];d<c.length;d++)a=c[d],o[a]&&f.push(o[a][0]),o[a]=0;for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(t[i]=l[i]);u&&u(e);while(f.length)f.shift()();return r.push.apply(r,s||[]),n()}function n(){for(var t,e=0;e<r.length;e++){for(var n=r[e],i=!0,c=1;c<n.length;c++){var l=n[c];0!==o[l]&&(i=!1)}i&&(r.splice(e--,1),t=a(a.s=n[0]))}return t}var i={},o={app:0},r=[];function a(e){if(i[e])return i[e].exports;var n=i[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=t,a.c=i,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(n,i,function(e){return t[e]}.bind(null,i));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/";var c=window["webpackJsonp"]=window["webpackJsonp"]||[],l=c.push.bind(c);c.push=e,c=c.slice();for(var s=0;s<c.length;s++)e(c[s]);var u=l;r.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var i=n("64a9"),o=n.n(i);o.a},"56d7":function(t,e,n){"use strict";n.r(e);n("cadf"),n("551c"),n("097d");var i=n("2b0e"),o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("h2",[t._v("VueSelectInfiniteScroll demo")]),n("VueSelectInfiniteScroll",{attrs:{selectedRecord:t.selectedRecord,widthInPX:t.myWidth},on:{fetchData:t.fetchData}})],1)},r=[],a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("b-dropdown",{staticClass:"m-md-2 dd-color",style:t.styling,attrs:{text:t.selectedRecord.label,variant:"outline-secondary"}},[i("b-dropdown-header",[i("input",{directives:[{name:"model",rawName:"v-model",value:t.searchtext,expression:"searchtext"}],attrs:{placeholder:"Search"},domProps:{value:t.searchtext},on:{input:function(e){e.target.composing||(t.searchtext=e.target.value)}}}),!0===t.busy?i("img",{attrs:{src:n("cf1c"),height:"25px",width:"25px"}}):t._e()]),i("div",{directives:[{name:"infinite-scroll",rawName:"v-infinite-scroll",value:t.loadmore,expression:"loadmore"}],staticClass:"scroll-div scrollbar-primary",attrs:{"infinite-scroll-distance":"10"}},[i("div",{staticClass:"force-overflow"},[!1===t.loading?t._l(t.options,function(e){return i("b-dropdown-item",{key:e.id,attrs:{title:t.getTooltip(e)},on:{click:function(n){t.selectme(e)}}},[t._v(t._s(e.label))])}):t._e()],2)])],1)},c=[],l=(n("ac6a"),n("c5f6"),n("487a")),s=n.n(l),u={directives:{infiniteScroll:s.a},props:{selectedRecord:Object,widthInPX:Number},data:function(){return{busy:!1,loading:!1,disableErraticLoading:!0,searchtext:"",options:[],page:0,delay:1e3}},computed:{styling:function(){return{width:this.widthInPX+"px"}}},methods:{getTooltip:function(t){return t.tooltip?t.tooltip:t.label},selectme:function(t){this.selectedRecord.id=t.id,this.selectedRecord.label=t.label},loadmore:function(t){var e=this;if(!this.disableErraticLoading){if(""===this.searchtext)return this.options=[],void(this.page=0);this.busy=!0,t&&(this.options=[],this.page=0,this.loading=!0),this.$emit("fetchData",{done:function(t){""===e.searchtext?(e.options=[],e.page=0):(t.forEach(function(t){e.options.push(t)}),e.page=e.page+1),e.busy=!1,e.loading=!1},q:this.searchtext,page:this.page})}}},watch:{searchtext:function(){var t=this;this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){t.disableErraticLoading=!1,t.loadmore(!0)},this.delay)}}},d=u,f=(n("8bfc"),n("2877")),p=Object(f["a"])(d,a,c,!1,null,null,null);p.options.__file="select-infinite-scroll.vue";var h=p.exports,v={name:"app",components:{VueSelectInfiniteScroll:h},data:function(){return{lastId:0,selectedRecord:{id:0,label:"Select..."},myWidth:400}},methods:{apimethod:function(){var t=this;return new Promise(function(e){for(var n=[],i=1;i<10;i++)n.push(i);var o=n.map(function(e){return{id:t.lastId+e,label:"value-".concat(t.lastId+e),tooltip:"value-".concat(t.lastId+e,"-tooltip")}});t.lastId=t.lastId+9,e(o)})},fetchData:function(t){var e=this;setTimeout(function(){e.apimethod(t.q,t.page).then(function(e){t.done(e)})},2e3)}}},m=v,b=(n("034f"),Object(f["a"])(m,o,r,!1,null,null,null));b.options.__file="App.vue";var g=b.exports,y=n("9f7b");n("f9e3"),n("2dd8");i["a"].use(y["a"]),i["a"].config.productionTip=!1,new i["a"]({render:function(t){return t(g)}}).$mount("#app")},"64a9":function(t,e,n){},"8bfc":function(t,e,n){"use strict";var i=n("91f3"),o=n.n(i);o.a},"91f3":function(t,e,n){},cf1c:function(t,e,n){t.exports=n.p+"img/loading.71dfdead.gif"}});
//# sourceMappingURL=app.7aaa37e7.js.map