vue-single-select
Advanced tools
Comparing version 1.0.23 to 1.0.25
@@ -1,1 +0,1 @@ | ||
!function(e,t){for(var i in t)e[i]=t[i]}(window,function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,i){"use strict";var n=function(e,t,i,n,o,r,s,a){var l=typeof(e=e||{}).default;"object"!==l&&"function"!==l||(e=e.default);var d,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=i,c._compiled=!0),n&&(c.functional=!0),r&&(c._scopeId=r),s?(d=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},c._ssrRegister=d):o&&(d=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),d)if(c.functional){c._injectStyles=d;var u=c.render;c.render=function(e,t){return d.call(t),u(e,t)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,d):[d]}return{exports:e,options:c}}({props:{value:{required:!0},name:{type:String,required:!1,default:()=>""},options:{type:Array,required:!1,default:()=>[]},optionLabel:{type:String,required:!1,default:()=>null},optionKey:{type:String,required:!1,default:()=>null},placeholder:{type:String,required:!1,default:()=>"Search Here"},maxHeight:{type:String,default:()=>"220px",required:!1},inputId:{type:String,default:()=>"single-select",required:!1},classes:{type:Object,required:!1,default:()=>({pointer:-1,wrapper:"single-select-wrapper",input:"search-input",icons:"icons",required:"required",activeClass:"active",dropdown:"dropdown"})},initial:{type:String,required:!1,default:()=>null},required:{type:Boolean,required:!1,default:()=>!1},maxResults:{type:Number,required:!1,default:()=>30},tabindex:{type:String,required:!1,default:()=>""},getOptionDescription:{type:Function,default(e){return this.optionKey&&this.optionLabel?e[this.optionKey]+" "+e[this.optionLabel]:this.optionLabel?e[this.optionLabel]:this.optionKey?e[this.optionKey]:e}},getOptionValue:{type:Function,default(e){return this.optionKey?e[this.optionKey]:this.optionLabel?e[this.optionLabel]:e}}},mixins:[{watch:{pointer(){this.maybeAdjustScroll()}},data:()=>({pointer:-1}),methods:{maybeAdjustScroll(){let e=this.pixelsToPointerTop(),t=this.pixelsToPointerBottom();return e<=this.viewport().top?this.scrollTo(e):t>=this.viewport().bottom?this.scrollTo(this.viewport().top+this.pointerHeight()):void 0},pixelsToPointerTop(){let e=0;if(!this.$refs.options)return 0;for(let t=0;t<this.pointer;t++)e+=this.$refs.options.children[t].offsetHeight;return e},pixelsToPointerBottom(){return this.pixelsToPointerTop()+this.pointerHeight()},pointerHeight(){let e=!!this.$refs.options&&this.$refs.options.children[this.pointer];return e?e.offsetHeight:0},viewport(){return{top:this.$refs.options?this.$refs.options.scrollTop:0,bottom:this.$refs.options?this.$refs.options.offsetHeight+this.$refs.options.scrollTop:0}},scrollTo(e){return this.$refs.options?this.$refs.options.scrollTop=e:null}}}],mounted(){document.addEventListener("click",this.handleClickOutside),document.addEventListener("keyup",this.handleClickOutside),this.value?this.selectedOption=this.value:this.searchText=this.initial},destroyed(){document.removeEventListener("keyup",this.handleClickOutside),document.removeEventListener("click",this.handleClickOutside)},data:()=>({searchText:null,selectedOption:null,dropdownOpen:!1,closed:!1}),watch:{value(e,t){e!==t&&(this.selectedOption=e)},searchText(e,t){e!==t&&(this.pointer=-1),e&&(this.closed=!1)},selectedOption(e,t){e!==t&&(this.$emit("input",e),this.closed||e||this.$nextTick().then(()=>{this.$refs.search.focus()}))},dropdownOpen(e,t){e!==t&&(this.selectedOption?this.searchText=this.getOptionDescription(this.selectedOption):e?(this.searchText||(this.searchText=""),this.$nextTick().then(()=>{this.$refs.search.focus()})):this.searchText=null)}},computed:{isRequired(){return this.required&&this.closed?this.selectedOption?"":"required":""},matchingOptions(){return null===this.searchText?null:this.searchText.length?this.optionLabel&&this.optionKey?this.options.filter(e=>e[this.optionLabel].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())||e[this.optionKey].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.optionLabel?this.options.filter(e=>e[this.optionLabel].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.optionKey?this.options.filter(e=>e[this.optionKey].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.options.filter(e=>e.toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):[...this.options].slice(0,this.maxResults)}},methods:{setPointerIdx(e){this.pointer=e},seedSearchText(){null===this.searchText&&(this.searchText="",this.closed&&(this.closed=!1))},resetSearch(){this.selectedOption=null,this.dropdownOpen=!1,this.searchText=null},switchToSearch(e){this.searchText=e.target.value,this.selectedOption=null,this.$nextTick().then(()=>{this.$refs.search.focus()})},toggleDropdown(){this.dropdownOpen=!this.dropdownOpen},closeOut(){this.selectedOption=null,this.dropdownOpen=!1,this.searchText=null,this.closed=!0},movePointerDown(){this.matchingOptions&&(this.pointer>=this.matchingOptions.length-1||this.pointer++)},movePointerUp(){this.pointer>0&&this.pointer--},setOption(){this.matchingOptions&&this.matchingOptions.length&&(-1===this.pointer&&this.pointer++,this.selectedOption=this.matchingOptions[this.pointer],this.searchText=null,this.dropdownOpen=!1,this.pointer=-1,this.$nextTick().then(()=>{this.$refs.match.focus()}))},handleClickOutside(e){this.$el.contains(e.target)||(this.dropdownOpen=!1,this.searchText=null,this.closed=!0)}}},function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{ref:"vuesingleselect"},[e.selectedOption?e._e():i("div",{class:e.classes.wrapper},[i("div",{staticClass:"relative inline-block w-full"},[i("input",{directives:[{name:"model",rawName:"v-model",value:e.searchText,expression:"searchText"}],ref:"search",class:[e.classes.input,e.isRequired],attrs:{id:e.inputId,placeholder:e.placeholder,autocomplete:"off",required:e.required},domProps:{value:e.searchText},on:{click:e.seedSearchText,focus:e.seedSearchText,keyup:[function(t){return"button"in t||!e._k(t.keyCode,"enter",13,t.key,"Enter")?e.setOption(t):null},function(t){return"button"in t||!e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?e.movePointerDown(t):null},function(t){return"button"in t||!e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?e.movePointerUp(t):null}],keydown:[function(t){return"button"in t||!e._k(t.keyCode,"tab",9,t.key,"Tab")?(t.stopPropagation(),e.closeOut(t)):null},function(t){return"button"in t||!e._k(t.keyCode,"esc",27,t.key,"Escape")?(t.stopPropagation(),e.closeOut(t)):null}],input:function(t){t.target.composing||(e.searchText=t.target.value)}}}),e._v(" "),i("div",{staticClass:"cursor-pointer absolute flex items-center",class:[e.classes.icons],on:{click:e.toggleDropdown}},[e.dropdownOpen?i("svg",{attrs:{"aria-hidden":"true",viewBox:"0 0 448 512"}},[i("path",{attrs:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"}})]):i("svg",{attrs:{"aria-hidden":"true",viewBox:"0 0 448 512"}},[i("path",{attrs:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"}})])]),e._v(" "),e.matchingOptions?i("ul",{ref:"options",staticClass:"absolute w-full overflow-auto appearance-none mt-px list-reset",class:[e.classes.dropdown],staticStyle:{"z-index":"100"},style:{"max-height":e.maxHeight},attrs:{tabindex:"-1"}},e._l(e.matchingOptions,function(t,n){return i("li",{key:n,staticClass:"cursor-pointer outline-none",class:n===e.pointer?e.classes.activeClass:"",attrs:{tabindex:"-1"},on:{blur:function(t){e.handleClickOutside(t)},mouseover:function(t){e.setPointerIdx(n)},keyup:[function(t){if(!("button"in t)&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;e.setOption()},function(t){if(!("button"in t)&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"]))return null;e.movePointerUp()},function(t){if(!("button"in t)&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"]))return null;e.movePointerDown()}],click:function(t){t.preventDefault(),e.setOption()}}},[e._t("option",[e._v("\n "+e._s(e.getOptionDescription(t))+"\n\t\t\t")],null,{option:t,idx:n})],2)})):e._e()])]),e._v(" "),e.selectedOption?i("div",{class:e.classes.wrapper},[i("input",{ref:"match",class:[e.classes.input],attrs:{id:"inputId",required:e.required,placeholder:e.placeholder},domProps:{value:e.getOptionDescription(e.selectedOption)},on:{input:function(t){e.switchToSearch(t)},click:function(t){e.switchToSearch(t)}}}),e._v(" "),i("input",{ref:"selectValue",attrs:{type:"hidden",name:e.name},domProps:{value:e.getOptionValue(e.selectedOption)}}),e._v(" "),i("div",{staticClass:"cursor-pointer absolute flex items-center",class:e.classes.icons,on:{click:e.closeOut}},[i("svg",{attrs:{"aria-hidden":"true",viewBox:"0 0 512 512"},on:{click:e.closeOut}},[i("path",{attrs:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"}})])])]):e._e()])},[],!1,function(e){i(3)},"data-v-b54e43f6",null);t.a=n.exports},function(e,t,i){"use strict";i.r(t),function(e){i.d(t,"install",function(){return o});var n=i(0);function o(e){o.installed||(o.installed=!0,e.component("vue-single-select",n.a))}const r={install:o};let s=null;"undefined"!=typeof window?s=window.Vue:void 0!==e&&(s=e.Vue),s&&s.use(r)}.call(this,i(2))},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){var n=i(4);"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);(0,i(6).default)("04bd0f2d",n,!0,{})},function(e,t,i){(e.exports=i(5)(!1)).push([e.i,".inline-block[data-v-b54e43f6]{display:inline-block}.block[data-v-b54e43f6]{display:block}.flex[data-v-b54e43f6]{display:flex}.border[data-v-b54e43f6]{border-width:thin;border-style:solid}.rounded[data-v-b54e43f6]{border-radius:.25em}.text-black[data-v-b54e43f6]{color:#22292f}.border-grey-lighter[data-v-b54e43f6]{border-color:#ced4da}.bg-grey-lighter[data-v-b54e43f6]{background-color:#606f7b}.bg-grey-light[data-v-b54e43f6]{background-color:#dae1e7}.bg-grey-dark[data-v-b54e43f6]{background-color:#8795a1}.bg-white[data-v-b54e43f6]{background-color:#fff}.pin-r[data-v-b54e43f6]{right:0}.pin-y[data-v-b54e43f6]{top:0;bottom:0}.absolute[data-v-b54e43f6]{position:absolute}.relative[data-v-b54e43f6]{position:relative}.items-center[data-v-b54e43f6]{align-items:center}.p-0[data-v-b54e43f6]{padding:0}.p-1[data-v-b54e43f6]{padding:.25em}.px-1[data-v-b54e43f6]{padding-left:.25em;padding-right:.25em}.py-2[data-v-b54e43f6]{padding-top:.5em;padding-bottom:.5em}.px-2[data-v-b54e43f6]{padding-left:.5em;padding-right:.5em}.mt-px[data-v-b54e43f6]{margin-top:1px}.leading-tight[data-v-b54e43f6]{line-height:1.25}.leading-normal[data-v-b54e43f6]{line-height:1.5}.text-left[data-v-b54e43f6]{text-align:left}.w-full[data-v-b54e43f6]{width:100%}.shadow[data-v-b54e43f6]{box-shadow:0 2px 4px 0 rgba(0,0,0,.1)}.list-reset[data-v-b54e43f6]{list-style:none;padding:0}.overflow-auto[data-v-b54e43f6]{overflow:auto}.appearance-none[data-v-b54e43f6]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.w-1[data-v-b54e43f6]{width:.25em}.w-2[data-v-b54e43f6]{width:.5em}.w-3[data-v-b54e43f6]{width:.75em}.w-4[data-v-b54e43f6]{width:1em}.h-4[data-v-b54e43f6]{height:1em}.h-1[data-v-b54e43f6]{height:.25em}.h-2[data-v-b54e43f6]{height:.5em}.h-3[data-v-b54e43f6]{height:.75em}.fill-current[data-v-b54e43f6]{fill:currentColor}.hover\\:no-underline[data-v-b54e43f6]:hover,.no-underline[data-v-b54e43f6]{text-decoration:none}.hover\\:outline-none[data-v-b54e43f6],.outline-none[data-v-b54e43f6]{outline:0}.hover\\:bg-grey-light[data-v-b54e43f6]:hover{background-color:#dae1e7}.shadow-md[data-v-b54e43f6]{box-shadow:0 4px 8px 0 rgba(0,0,0,.12),0 2px 4px 0 rgba(0,0,0,.08)}.search-input[data-v-b54e43f6]{display:block;width:100%;padding:.375em .75em;font-size:1em;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25em;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;box-sizing:border-box}.icons[data-v-b54e43f6]{padding:0 1em;right:0;top:0;bottom:0;fill:#606f7b}.icons svg[data-v-b54e43f6]{width:.75em;height:.75em}.single-select-wrapper[data-v-b54e43f6]{position:relative;margin-bottom:.5em}.required[data-v-b54e43f6]{_color:#721c24;_background-color:#f8d7da;border-color:#f5c6cb}.cursor-pointer[data-v-b54e43f6]{cursor:pointer}.dropdown[data-v-b54e43f6]{-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.12),0 2px 4px 0 rgba(0,0,0,.08);box-shadow:0 4px 8px 0 rgba(0,0,0,.12),0 2px 4px 0 rgba(0,0,0,.08);background-color:#fff;color:#606f7b;border-radius:.25em;line-height:1.25;text-align:left}.dropdown>li[data-v-b54e43f6]{padding:.5em .75em}.active[data-v-b54e43f6]{background:#dae1e7}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var i=function(e,t){var i=e[1]||"",n=e[3];if(!n)return i;if(t&&"function"==typeof btoa){var o=function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(n),r=n.sources.map(function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"});return[i].concat(r).concat([o]).join("\n")}return[i].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i}).join("")},t.i=function(e,i){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var s=e[o];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),t.push(s))}},t}},function(e,t,i){"use strict";function n(e,t){for(var i=[],n={},o=0;o<t.length;o++){var r=t[o],s=r[0],a={id:e+":"+o,css:r[1],media:r[2],sourceMap:r[3]};n[s]?n[s].parts.push(a):i.push(n[s]={id:s,parts:[a]})}return i}i.r(t),i.d(t,"default",function(){return f});var o="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var r={},s=o&&(document.head||document.getElementsByTagName("head")[0]),a=null,l=0,d=!1,c=function(){},u=null,p="data-vue-ssr-id",h="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(e,t,i,o){d=i,u=o||{};var s=n(e,t);return v(s),function(t){for(var i=[],o=0;o<s.length;o++){var a=s[o];(l=r[a.id]).refs--,i.push(l)}t?v(s=n(e,t)):s=[];for(o=0;o<i.length;o++){var l;if(0===(l=i[o]).refs){for(var d=0;d<l.parts.length;d++)l.parts[d]();delete r[l.id]}}}}function v(e){for(var t=0;t<e.length;t++){var i=e[t],n=r[i.id];if(n){n.refs++;for(var o=0;o<n.parts.length;o++)n.parts[o](i.parts[o]);for(;o<i.parts.length;o++)n.parts.push(g(i.parts[o]));n.parts.length>i.parts.length&&(n.parts.length=i.parts.length)}else{var s=[];for(o=0;o<i.parts.length;o++)s.push(g(i.parts[o]));r[i.id]={id:i.id,refs:1,parts:s}}}}function b(){var e=document.createElement("style");return e.type="text/css",s.appendChild(e),e}function g(e){var t,i,n=document.querySelector("style["+p+'~="'+e.id+'"]');if(n){if(d)return c;n.parentNode.removeChild(n)}if(h){var o=l++;n=a||(a=b()),t=x.bind(null,n,o,!1),i=x.bind(null,n,o,!0)}else n=b(),t=function(e,t){var i=t.css,n=t.media,o=t.sourceMap;n&&e.setAttribute("media",n);u.ssrId&&e.setAttribute(p,t.id);o&&(i+="\n/*# sourceURL="+o.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");if(e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}.bind(null,n),i=function(){n.parentNode.removeChild(n)};return t(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;t(e=n)}else i()}}var m=function(){var e=[];return function(t,i){return e[t]=i,e.filter(Boolean).join("\n")}}();function x(e,t,i,n){var o=i?"":n.css;if(e.styleSheet)e.styleSheet.cssText=m(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}}])); | ||
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){var i=n(5);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(7).default)("77c24ab8",i,!0,{})},function(e,t,n){"use strict";var i={props:{value:{required:!0},name:{type:String,required:!1,default:()=>""},options:{type:Array,required:!1,default:()=>[]},optionLabel:{type:String,required:!1,default:()=>null},optionKey:{type:String,required:!1,default:()=>null},placeholder:{type:String,required:!1,default:()=>"Search Here"},maxHeight:{type:String,default:()=>"220px",required:!1},inputId:{type:String,default:()=>"single-select",required:!1},classes:{type:Object,required:!1,default:()=>({pointer:-1,wrapper:"single-select-wrapper",input:"search-input",icons:"icons",required:"required",activeClass:"active",dropdown:"dropdown"})},initial:{type:String,required:!1,default:()=>null},required:{type:Boolean,required:!1,default:()=>!1},maxResults:{type:Number,required:!1,default:()=>30},tabindex:{type:String,required:!1,default:()=>""},getOptionDescription:{type:Function,default(e){return this.optionKey&&this.optionLabel?e[this.optionKey]+" "+e[this.optionLabel]:this.optionLabel?e[this.optionLabel]:this.optionKey?e[this.optionKey]:e}},getOptionValue:{type:Function,default(e){return this.optionKey?e[this.optionKey]:this.optionLabel?e[this.optionLabel]:e}}},mixins:[{watch:{pointer(){this.maybeAdjustScroll()}},data:()=>({pointer:-1}),methods:{maybeAdjustScroll(){let e=this.pixelsToPointerTop(),t=this.pixelsToPointerBottom();return e<=this.viewport().top?this.scrollTo(e):t>=this.viewport().bottom?this.scrollTo(this.viewport().top+this.pointerHeight()):void 0},pixelsToPointerTop(){let e=0;if(!this.$refs.options)return 0;for(let t=0;t<this.pointer;t++)e+=this.$refs.options.children[t].offsetHeight;return e},pixelsToPointerBottom(){return this.pixelsToPointerTop()+this.pointerHeight()},pointerHeight(){let e=!!this.$refs.options&&this.$refs.options.children[this.pointer];return e?e.offsetHeight:0},viewport(){return{top:this.$refs.options?this.$refs.options.scrollTop:0,bottom:this.$refs.options?this.$refs.options.offsetHeight+this.$refs.options.scrollTop:0}},scrollTo(e){return this.$refs.options?this.$refs.options.scrollTop=e:null}}}],mounted(){document.addEventListener("click",this.handleClickOutside),document.addEventListener("keyup",this.handleClickOutside),this.value&&this.options.includes(this.value)?this.selectedOption=this.value:this.searchText=this.initial},destroyed(){document.removeEventListener("keyup",this.handleClickOutside),document.removeEventListener("click",this.handleClickOutside)},data:()=>({searchText:null,selectedOption:null,dropdownOpen:!1,closed:!1}),watch:{value(e,t){e!==t&&(this.selectedOption=e)},searchText(e,t){e!==t&&(this.pointer=-1),e&&(this.closed=!1)},selectedOption(e,t){e!==t&&(this.$emit("input",e),this.closed||e||this.$nextTick().then(()=>{this.$refs.search.focus()}))},dropdownOpen(e,t){e!==t&&(this.selectedOption?this.searchText=this.getOptionDescription(this.selectedOption):e?(this.searchText||(this.searchText=""),this.$nextTick().then(()=>{this.$refs.search.focus()})):this.searchText=null)}},computed:{isRequired(){return this.required&&this.closed?this.selectedOption?"":"required":""},matchingOptions(){return null===this.searchText?null:this.searchText.length?this.optionLabel&&this.optionKey?this.options.filter(e=>e[this.optionLabel].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())||e[this.optionKey].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.optionLabel?this.options.filter(e=>e[this.optionLabel].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.optionKey?this.options.filter(e=>e[this.optionKey].toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):this.options.filter(e=>e.toString().toLowerCase().includes(this.searchText.toString().toLowerCase())).slice(0,this.maxResults):[...this.options].slice(0,this.maxResults)}},methods:{setPointerIdx(e){this.pointer=e},seedSearchText(){null===this.searchText&&(this.searchText="",this.closed&&(this.closed=!1))},switchToSearch(e){this.$refs.selectedValue.value=null,this.searchText=e.target.value,this.selectedOption=null,this.$nextTick().then(()=>{this.$refs.search.focus()})},toggleDropdown(){this.dropdownOpen=!this.dropdownOpen},closeOut(){this.selectedOption=null,this.dropdownOpen=!1,this.searchText=null,this.closed=!0},movePointerDown(){this.matchingOptions&&(this.pointer>=this.matchingOptions.length-1||this.pointer++)},movePointerUp(){this.pointer>0&&this.pointer--},setOption(){this.matchingOptions&&this.matchingOptions.length&&(-1===this.pointer&&this.pointer++,this.selectedOption=this.matchingOptions[this.pointer],this.searchText=null,this.dropdownOpen=!1,this.pointer=-1,this.$nextTick().then(()=>{this.$refs.match.focus()}))},handleClickOutside(e){this.$el.contains(e.target)||(this.dropdownOpen=!1,this.searchText=null,this.closed=!0)}}};n(4);var o=function(e,t,n,i,o,r,s,a){var c,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),i&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),s?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},d._ssrRegister=c):o&&(c=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(d.functional){d._injectStyles=c;var l=d.render;d.render=function(e,t){return c.call(t),l(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,c):[c]}return{exports:e,options:d}}(i,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"vuesingleselect"},[e.selectedOption?e._e():n("div",{class:e.classes.wrapper},[n("div",{staticClass:"relative inline-block w-full"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.searchText,expression:"searchText"}],ref:"search",class:[e.classes.input,e.isRequired],attrs:{id:e.inputId,placeholder:e.placeholder,autocomplete:"off",required:e.required},domProps:{value:e.searchText},on:{click:e.seedSearchText,focus:e.seedSearchText,keyup:[function(t){return"button"in t||!e._k(t.keyCode,"enter",13,t.key,"Enter")?e.setOption(t):null},function(t){return"button"in t||!e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?e.movePointerDown(t):null},function(t){return"button"in t||!e._k(t.keyCode,"tab",9,t.key,"Tab")?(t.stopPropagation(),e.closeOut(t)):null},function(t){return"button"in t||!e._k(t.keyCode,"esc",27,t.key,"Escape")?(t.stopPropagation(),e.closeOut(t)):null},function(t){return"button"in t||!e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?e.movePointerUp(t):null}],input:function(t){t.target.composing||(e.searchText=t.target.value)}}}),e._v(" "),n("div",{staticClass:"cursor-pointer absolute flex items-center",class:[e.classes.icons],on:{click:e.toggleDropdown}},[e.dropdownOpen?n("svg",{attrs:{"aria-hidden":"true",viewBox:"0 0 448 512"}},[n("path",{attrs:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"}})]):n("svg",{attrs:{"aria-hidden":"true",viewBox:"0 0 448 512"}},[n("path",{attrs:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"}})])]),e._v(" "),e.matchingOptions?n("ul",{ref:"options",staticClass:"absolute w-full overflow-auto appearance-none mt-px list-reset",class:[e.classes.dropdown],staticStyle:{"z-index":"100"},style:{"max-height":e.maxHeight},attrs:{tabindex:"-1"}},e._l(e.matchingOptions,function(t,i){return n("li",{key:i,staticClass:"cursor-pointer outline-none",class:i===e.pointer?e.classes.activeClass:"",attrs:{tabindex:"-1"},on:{blur:function(t){e.handleClickOutside(t)},mouseover:function(t){e.setPointerIdx(i)},keyup:[function(t){if(!("button"in t)&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;e.setOption()},function(t){if(!("button"in t)&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"]))return null;e.movePointerUp()},function(t){if(!("button"in t)&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"]))return null;e.movePointerDown()}],click:function(t){t.preventDefault(),e.setOption()}}},[e._t("option",[e._v("\n "+e._s(e.getOptionDescription(t))+"\n\t ")],null,{option:t,idx:i})],2)})):e._e()])]),e._v(" "),e.selectedOption?n("div",{class:e.classes.wrapper},[n("input",{ref:"match",class:[e.classes.input],attrs:{id:"inputId",required:e.required},domProps:{value:e.getOptionDescription(e.selectedOption)},on:{input:function(t){e.switchToSearch(t)},click:function(t){e.switchToSearch(t)}}}),e._v(" "),n("input",{ref:"selectedValue",attrs:{type:"hidden",name:e.name},domProps:{value:e.getOptionValue(e.selectedOption)}}),e._v(" "),n("div",{staticClass:"flex absolute items-center",class:e.classes.icons},[n("svg",{staticClass:"cursor-pointer",attrs:{"aria-hidden":"true",viewBox:"0 0 512 512"},on:{click:e.closeOut}},[n("path",{attrs:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"}})])])]):e._e()])},[],!1,null,"2ade5cc6",null);o.options.__file="VueSingleSelect.vue";t.a=o.exports},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"install",function(){return o});var i=n(1);function o(e){o.installed||(o.installed=!0,e.component("vue-single-select",i.a))}const r={install:o};let s=null;"undefined"!=typeof window?s=window.Vue:void 0!==e&&(s=e.Vue),s&&s.use(r)}.call(this,n(3))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var i=n(0);n.n(i).a},function(e,t,n){(e.exports=n(6)(!1)).push([e.i,"\n.w-full[data-v-2ade5cc6] {\n width: 100%;\n}\n.inline-block[data-v-2ade5cc6] {\n display: inline-block;\n}\n.block[data-v-2ade5cc6] {\n display: block;\n}\n.flex[data-v-2ade5cc6] {\n display: flex;\n}\n.border[data-v-2ade5cc6] {\n border-width: thin;\n border-style: solid;\n}\n.rounded[data-v-2ade5cc6] {\n border-radius: 0.25em;\n}\n.text-black[data-v-2ade5cc6] {\n color: #22292f;\n}\n.border-grey-lighter[data-v-2ade5cc6] {\n border-color: #ced4da;\n}\n.bg-grey-lighter[data-v-2ade5cc6] {\n background-color: #606f7b;\n}\n.bg-grey-light[data-v-2ade5cc6] {\n background-color: #dae1e7;\n}\n.bg-grey-dark[data-v-2ade5cc6] {\n background-color: #8795a1;\n}\n.bg-white[data-v-2ade5cc6] {\n background-color: #fff;\n}\n.pin-r[data-v-2ade5cc6] {\n right: 0;\n}\n.pin-y[data-v-2ade5cc6] {\n top: 0;\n bottom: 0;\n}\n.absolute[data-v-2ade5cc6] {\n position: absolute;\n}\n.relative[data-v-2ade5cc6] {\n position: relative;\n}\n.items-center[data-v-2ade5cc6] {\n align-items: center;\n}\n.p-0[data-v-2ade5cc6] {\n padding: 0;\n}\n.p-1[data-v-2ade5cc6] {\n padding: 0.25em;\n}\n.px-1[data-v-2ade5cc6] {\n padding-left: 0.25em;\n padding-right: 0.25em;\n}\n.py-2[data-v-2ade5cc6] {\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n}\n.px-2[data-v-2ade5cc6] {\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n.mt-px[data-v-2ade5cc6] {\n margin-top: 1px;\n}\n.leading-tight[data-v-2ade5cc6] {\n line-height: 1.25;\n}\n.leading-normal[data-v-2ade5cc6] {\n line-height: 1.5;\n}\n.text-left[data-v-2ade5cc6] {\n text-align: left;\n}\n.w-full[data-v-2ade5cc6] {\n width: 100%;\n}\n.shadow[data-v-2ade5cc6] {\n box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);\n}\n.list-reset[data-v-2ade5cc6] {\n list-style: none;\n padding: 0;\n}\n.overflow-auto[data-v-2ade5cc6] {\n overflow: auto;\n}\n.appearance-none[data-v-2ade5cc6] {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.w-1[data-v-2ade5cc6] {\n width: 0.25em;\n}\n.w-2[data-v-2ade5cc6] {\n width: 0.5em;\n}\n.w-3[data-v-2ade5cc6] {\n width: 0.75em;\n}\n.w-4[data-v-2ade5cc6] {\n width: 1em;\n}\n.h-4[data-v-2ade5cc6] {\n height: 1em;\n}\n.h-1[data-v-2ade5cc6] {\n height: 0.25em;\n}\n.h-2[data-v-2ade5cc6] {\n height: 0.5em;\n}\n.h-3[data-v-2ade5cc6] {\n height: 0.75em;\n}\n.fill-current[data-v-2ade5cc6] {\n fill: currentColor;\n}\n.no-underline[data-v-2ade5cc6] {\n text-decoration: none;\n}\n.hover\\:no-underline[data-v-2ade5cc6]:hover {\n text-decoration: none;\n}\n.outline-none[data-v-2ade5cc6] {\n outline: 0;\n}\n.hover\\:outline-none[data-v-2ade5cc6] {\n outline: 0;\n}\n.hover\\:bg-grey-light[data-v-2ade5cc6]:hover {\n background-color: #dae1e7;\n}\n.shadow-md[data-v-2ade5cc6] {\n box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.08);\n}\n.search-input[data-v-2ade5cc6] {\n display: block;\n width: 100%;\n padding: 0.375em 0.75em;\n font-size: 1em;\n line-height: 1.5;\n color: #495057;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid #ced4da;\n border-radius: 0.25em;\n transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n box-sizing: border-box;\n}\n.icons[data-v-2ade5cc6] {\n padding: 0 1em;\n right: 0;\n top: 0;\n bottom: 0;\n fill: #606f7b;\n}\n.icons svg[data-v-2ade5cc6] {\n width: 0.75em;\n height: 0.75em;\n}\n.single-select-wrapper[data-v-2ade5cc6] {\n position: relative;\n margin-bottom: 0.5em;\n}\n.required[data-v-2ade5cc6] {\n _color: #721c24;\n _background-color: #f8d7da;\n border-color: #f5c6cb;\n}\n.cursor-pointer[data-v-2ade5cc6] {\n cursor: pointer;\n}\n.dropdown[data-v-2ade5cc6] {\n -webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.12),\n 0 2px 4px 0 rgba(0, 0, 0, 0.08);\n box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.08);\n background-color: #fff;\n color: #606f7b;\n border-radius: 0.25em;\n line-height: 1.25;\n text-align: left;\n}\n.dropdown > li[data-v-2ade5cc6] {\n padding: 0.5em 0.75em;\n}\n.active[data-v-2ade5cc6] {\n background: #dae1e7;\n}\n",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(i),r=i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"});return[n].concat(r).concat([o]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var s=e[o];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],s=r[0],a={id:e+":"+o,css:r[1],media:r[2],sourceMap:r[3]};i[s]?i[s].parts.push(a):n.push(i[s]={id:s,parts:[a]})}return n}n.r(t),n.d(t,"default",function(){return f});var o="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var r={},s=o&&(document.head||document.getElementsByTagName("head")[0]),a=null,c=0,d=!1,l=function(){},u=null,p="data-vue-ssr-id",h="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(e,t,n,o){d=n,u=o||{};var s=i(e,t);return v(s),function(t){for(var n=[],o=0;o<s.length;o++){var a=s[o];(c=r[a.id]).refs--,n.push(c)}t?v(s=i(e,t)):s=[];for(o=0;o<n.length;o++){var c;if(0===(c=n[o]).refs){for(var d=0;d<c.parts.length;d++)c.parts[d]();delete r[c.id]}}}}function v(e){for(var t=0;t<e.length;t++){var n=e[t],i=r[n.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](n.parts[o]);for(;o<n.parts.length;o++)i.parts.push(m(n.parts[o]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var s=[];for(o=0;o<n.parts.length;o++)s.push(m(n.parts[o]));r[n.id]={id:n.id,refs:1,parts:s}}}}function g(){var e=document.createElement("style");return e.type="text/css",s.appendChild(e),e}function m(e){var t,n,i=document.querySelector("style["+p+'~="'+e.id+'"]');if(i){if(d)return l;i.parentNode.removeChild(i)}if(h){var o=c++;i=a||(a=g()),t=x.bind(null,i,o,!1),n=x.bind(null,i,o,!0)}else i=g(),t=function(e,t){var n=t.css,i=t.media,o=t.sourceMap;i&&e.setAttribute("media",i);u.ssrId&&e.setAttribute(p,t.id);o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}var b=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function x(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=b(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}}])); |
115
package.json
{ | ||
"name": "vue-single-select", | ||
"version": "1.0.23", | ||
"description": "single select autocomplete dropdown for vue", | ||
"main": "dist/index", | ||
"unpkg": "dist/vue-single-select.js", | ||
"browser": { | ||
"./sfc": "dist/vue-single-select.vue" | ||
}, | ||
"scripts": { | ||
"prepublish": "npm build", | ||
"serve": "vue-cli-service serve", | ||
"vbuild": "vue-cli-service build", | ||
"lint": "vue-cli-service lint", | ||
"dev": "cross-env NODE_ENV=development webpack", | ||
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/robrogers3/vue-single-select.git" | ||
}, | ||
"keywords": [ | ||
"vue", | ||
"js", | ||
"dropdown", | ||
"autocomplete", | ||
"select", | ||
"element" | ||
], | ||
"author": "Rob Rogers", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/robrogers3/vue-single-select/issues" | ||
}, | ||
"homepage": "https://github.com/robrogers3/vue-single-select#readme", | ||
"peerDependencies": { | ||
"vue": "2.x" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-stage-3": "^6.24.1", | ||
"copy-webpack-plugin": "^4.5.2", | ||
"cross-env": "^5.0.5", | ||
"css-loader": "^0.28.7", | ||
"file-loader": "^1.1.4", | ||
"vue": "^2.5.11", | ||
"vue-loader": "14.2.2", | ||
"vue-template-compiler": "^2.4.4", | ||
"webpack": "^4.16.3", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-dev-server": "^2.9.1", | ||
"webpack-merge": "^4.1.3" | ||
} | ||
"name": "vue-single-select", | ||
"version": "1.0.25", | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules", | ||
"lint": "vue-cli-service lint", | ||
"prepublish": "npm build", | ||
"vbuild": "vue-cli-service build", | ||
"dev": "cross-env NODE_ENV=development webpack", | ||
"test:unit": "vue-cli-service test:unit", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@vue/cli-plugin-unit-jest": "^3.0.4", | ||
"@vue/cli-service": "^3.0.4", | ||
"@vue/test-utils": "^1.0.0-beta.25", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^8.0.4", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-stage-3": "^6.24.1", | ||
"cache-loader": "^1.2.2", | ||
"copy-webpack-plugin": "^4.5.2", | ||
"cross-env": "^5.0.5", | ||
"css-loader": "^1.0.0", | ||
"file-loader": "^2.0.0", | ||
"global": "^4.3.2", | ||
"vue": "^2.5.11", | ||
"vue-loader": "15.4.2", | ||
"vue-template-compiler": "^2.4.4", | ||
"webpack": "^4.16.3", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-dev-server": "^3.1.9", | ||
"webpack-merge": "^4.1.3" | ||
}, | ||
"unpkg": "dist/vue-single-select.js", | ||
"main": "dist/index", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/robrogers3/vue-single-select.git" | ||
}, | ||
"description": "single select autocomplete dropdown for vue", | ||
"author": "Rob Rogers", | ||
"homepage": "https://github.com/robrogers3/vue-single-select#readme", | ||
"bugs": { | ||
"url": "https://github.com/robrogers3/vue-single-select/issues" | ||
}, | ||
"browser": { | ||
"./sfc": "dist/vue-single-select.vue" | ||
}, | ||
"peerDependencies": { | ||
"vue": "2.x" | ||
}, | ||
"keywords": [ | ||
"vue", | ||
"js", | ||
"dropdown", | ||
"autocomplete", | ||
"select", | ||
"element" | ||
], | ||
"license": "ISC" | ||
} |
@@ -9,5 +9,4 @@ # vue-single-select | ||
## What It Does | ||
vue-single-select provides a ** simple** component for making long, unwieldy select boxes more friendly, like Chosen for jQuery. | ||
vue-single-select provides a **simple** interface to replace regular select elements with auto-complete select elements like Chosen for jQuery. | ||
## How Simple? | ||
@@ -28,10 +27,5 @@ | ||
Nope no Multi Select. See vue-multi-select for this. | ||
Nope no Multi Select. See vue-taggable-select for this. | ||
[Vue Single Select](https://www.npmjs.com/package/vue-simple-multi-select) | ||
No ajax loading. | ||
## Usage | ||
[Vue Taggable Select](https://www.npmjs.com/package/vue-taggable-select) | ||
### Install and Use Via CDN | ||
@@ -41,3 +35,3 @@ | ||
<div id="app"> | ||
<lable>Choose a fruit!</lable> | ||
<label>Choose a fruit!</label> | ||
<vue-single-select | ||
@@ -420,2 +414,6 @@ v-model="fruit" | ||
A. Nope not found here. | ||
A. Nope not found here. See vue-taggable-select | ||
Q. _Can I trust this?_ | ||
A. Yep. It's backed by tests using jest and vue test utils. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
942577
31
902
20
416
1