UNPKG

vue-material-chips

Version:

Vue.js plugin made for chips using material theme

1 lines 8.26 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.MaterialChips=e():t.MaterialChips=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){var r=n(1);"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);(0,n(4).default)("1810644a",r,!0,{})},function(t,e,n){(e=n(2)(!1)).push([t.i,'.mt-chip{display:inline-block;font-weight:500;color:rgba(0,0,0,.6);line-height:32px;background-color:#e4e4e4;margin-bottom:5px;margin-right:5px;position:relative;padding:0 16px !important;height:34px;font-size:14px;border-radius:50px}.mt-chip img{float:left;margin:0 6px 0 -16px;height:34px;width:34px;border-radius:50%;border-style:none}.mt-chip-large{height:48px;font-size:16px;border-radius:50px;padding:0 16px !important}.mt-chip-large img{height:48px;width:48px}.mt-chip-large span{margin-left:4px !important;line-height:46px !important}.mt-chip-large .mt-close-large{margin-right:6px !important}.mt-chip-small{padding:0 12px !important;height:34px;font-size:12px;border-radius:50px}.mt-close{position:relative;right:-2px;top:4px;width:16px;height:16px;cursor:pointer;display:inline-block}.mt-close:before{transform:rotate(45deg)}.mt-close:after,.mt-close:before{position:absolute;left:8px;top:1px;content:" ";height:13px;width:2px;background-color:#333}.mt-close:after{transform:rotate(-45deg)}.mt-close-large{right:-4px;top:2px}.mt-close-large:after,.mt-close-large:before{left:8px;height:16px;width:2px}.mt-close-small{right:0;top:4px}.mt-close-small:after,.mt-close-small:before{left:7px;top:2px;height:11px;width:2px}',""]),t.exports=e},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),i=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[n].concat(i).concat([o]).join("\n")}var a,s,c;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"==typeof t&&(t=[[null,t,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var s=0;s<t.length;s++){var c=[].concat(t[s]);r&&o[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),e.push(c))}},e}},function(t,e,n){"use strict";n.r(e);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(t,e,n,r,o,i,a,s){var c,p="function"==typeof t?t.options:t;if(e&&(p.render=e,p.staticRenderFns=n,p._compiled=!0),r&&(p.functional=!0),i&&(p._scopeId="data-v-"+i),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},p._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(p.functional){p._injectStyles=c;var u=p.render;p.render=function(t,e){return c.call(e),u(t,e)}}else{var l=p.beforeCreate;p.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:p}}({name:"VueMaterialChips",props:{chipType:{type:String,default:function(){return""}},cssClass:{type:String,default:function(){return""}},chipData:{type:Array,required:!0,default:function(){return[]}},onChipRemove:{type:Function}},data:function(){return{currentChips:this.$props.chipData}},computed:{computedCssClass:function(){var t=this.$props,e=t.chipType,n=t.cssClass,r="";return e&&(r="mt-chip-".concat(e)),n&&(r="".concat(r," ").concat(n)),r}},methods:{isObjectLoaded:function(t){return t&&"object"===r(t)&&Object.keys(t).length>0},onRemoveClick:function(t,e){this.$data.currentChips=this.$data.currentChips.filter((function(t,n){return n!=e})),this.$props.onChipRemove(t,this.$data.currentChips)}}},(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",t._l(t.currentChips,(function(e,r){return n("div",{staticClass:"mt-chip",class:t.computedCssClass},[t.isObjectLoaded(e)&&e.imgUrl?n("img",{attrs:{src:e.imgUrl,alt:"No image found"}}):t._e(),t._v(" "),n("span",[t._v(t._s(t.isObjectLoaded(e)?e.value:e))]),t._v(" "),t.onChipRemove?n("div",{staticClass:"mt-close",class:t.chipType?"mt-close-"+t.chipType:"",attrs:{alt:"close"},on:{click:function(n){return t.onRemoveClick(e,r)}}}):t._e()])})),0)}),[],!1,null,null,null).exports;n(0),e.default=o},function(t,e,n){"use strict";function r(t,e){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],a=i[0],s={id:t+":"+o,css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}n.r(e),n.d(e,"default",(function(){return d}));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 i={},a=o&&(document.head||document.getElementsByTagName("head")[0]),s=null,c=0,p=!1,u=function(){},l=null,f="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function d(t,e,n,o){p=n,l=o||{};var a=r(t,e);return h(a),function(e){for(var n=[],o=0;o<a.length;o++){var s=a[o];(c=i[s.id]).refs--,n.push(c)}e?h(a=r(t,e)):a=[];for(o=0;o<n.length;o++){var c;if(0===(c=n[o]).refs){for(var p=0;p<c.parts.length;p++)c.parts[p]();delete i[c.id]}}}}function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=i[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(g(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var a=[];for(o=0;o<n.parts.length;o++)a.push(g(n.parts[o]));i[n.id]={id:n.id,refs:1,parts:a}}}}function m(){var t=document.createElement("style");return t.type="text/css",a.appendChild(t),t}function g(t){var e,n,r=document.querySelector('style[data-vue-ssr-id~="'+t.id+'"]');if(r){if(p)return u;r.parentNode.removeChild(r)}if(f){var o=c++;r=s||(s=m()),e=x.bind(null,r,o,!1),n=x.bind(null,r,o,!0)}else r=m(),e=b.bind(null,r),n=function(){r.parentNode.removeChild(r)};return e(t),function(r){if(r){if(r.css===t.css&&r.media===t.media&&r.sourceMap===t.sourceMap)return;e(t=r)}else n()}}var v,y=(v=[],function(t,e){return v[t]=e,v.filter(Boolean).join("\n")});function x(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=y(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function b(t,e){var n=e.css,r=e.media,o=e.sourceMap;if(r&&t.setAttribute("media",r),l.ssrId&&t.setAttribute("data-vue-ssr-id",e.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}}])}));