th-vue-material
Version:
Material Design for Vue.js
6 lines • 6.03 kB
JavaScript
/*!
* Vue Material v0.7.2-rc.1
* Made with love by Marcos Moura
* Released under the MIT License.
*/
!(function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.VueMaterial=n():t.VueMaterial=n()})(this,(function(){return (function(t){function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var e={};return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},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,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/",n(n.s=461)})({0:function(t,n){t.exports=function(t,n,e,o){var i,c=t=t||{},r=typeof t.default;"object"!==r&&"function"!==r||(i=t,c=t.default);var s="function"==typeof c?c.options:c;if(n&&(s.render=n.render,s.staticRenderFns=n.staticRenderFns),e&&(s._scopeId=e),o){var u=s.computed||(s.computed={});Object.keys(o).forEach((function(t){var n=o[t];u[t]=function(){return n}}))}return{esModule:i,exports:c,options:s}}},1:function(t,n,e){"use strict";function o(t){if(!t)return null;var n=t.mdTheme;return n||"md-theme"!==t.$options._componentTag||(n=t.mdName),n||o(t.$parent)}Object.defineProperty(n,"__esModule",{value:!0}),n.default={props:{mdTheme:String},computed:{mdEffectiveTheme:function(){return o(this)||this.$material.currentTheme},themeClass:function(){return this.$material.prefix+this.mdEffectiveTheme}},watch:{mdTheme:function(t){this.$material.useTheme(t)}},beforeMount:function(){var t=this.mdTheme;this.$material.useTheme(t||"default")}},t.exports=n.default},100:function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function i(t){t.component("md-rating-bar",r.default),t.material.styles.push(u.default)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=i;var c=e(340),r=o(c),s=e(278),u=o(s);t.exports=n.default},172:function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e(1),i=(function(t){return t&&t.__esModule?t:{default:t}})(o);n.default={props:{mdMaxRating:{type:Number,default:5},disabled:Boolean,value:{type:Number,default:0},mdIconSize:{type:Number,default:1},mdFullIconset:String,mdEmptyIconset:String,mdFullIcon:{type:String,default:"star"},mdEmptyIcon:{type:String,default:"star"}},mixins:[i.default],data:function(){return{srcFullIcon:null,srcEmptyIcon:null,rating:this.value}},mounted:function(){this.srcFullIcon=this.checkSrc(this.mdFullIcon),this.srcEmptyIcon=this.checkSrc(this.mdEmptyIcon)},computed:{emptyIcon:function(){return this.mdEmptyIconset?"":this.mdEmptyIcon},fullIcon:function(){return this.mdFullIconset?"":this.mdFullIcon},iconClasses:function(){var t={};return this.mdIconSize&&(t["md-size-"+this.mdIconSize+"x"]=!0),t},fullIconStyle:function(){return{width:100/this.mdMaxRating*this.rating+"%","margin-left":-24*this.mdIconSize*this.mdMaxRating+"px"}}},watch:{mdFullIcon:function(){this.srcFullIcon=this.checkSrc(this.mdFullIcon)},mdEmptyIcon:function(){this.srcEmptyIcon=this.checkSrc(this.mdEmptyIcon)},value:function(){this.rating=this.value}},methods:{hoverStars:function(t){this.disabled||(this.rating=this.getIconIndex(t.currentTarget),this.$emit("hover",this.rating))},clickStars:function(t){if(!this.disabled){var n=this.getIconIndex(t.currentTarget);this.$emit("input",n),this.$emit("change",n)}},getIconIndex:function(t){var n=this,e=this.$el.querySelectorAll(".md-empty-icon > .md-icon, .md-full-icon > .md-icon"),o=-1;return e=Array.prototype.slice.call(e),e.some((function(e,i){if(e===t)return o=(i+1)%n.mdMaxRating,o=o||n.mdMaxRating,!0})),o},checkSrc:function(t){return t&&/.+\.(svg|png)/.test(t)?t:null},onMouseOut:function(){this.rating=this.value}}},t.exports=n.default},241:function(t,n){},278:function(t,n){t.exports=".THEME_NAME.md-rating-bar>.md-empty-icon .md-icon{color:BACKGROUND-CONTRAST-0.26}.THEME_NAME.md-rating-bar>.md-full-icon .md-icon{color:BACKGROUND-CONTRAST-0.38}.THEME_NAME.md-rating-bar.md-primary>.md-full-icon .md-icon{color:PRIMARY-COLOR}.THEME_NAME.md-rating-bar.md-accent>.md-full-icon .md-icon{color:ACCENT-COLOR}.THEME_NAME.md-rating-bar.md-warn>.md-full-icon .md-icon{color:WARN-COLOR}\n"},340:function(t,n,e){e(241);var o=e(0)(e(172),e(404),null,null);t.exports=o.exports},404:function(t,n){t.exports={render:function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"md-rating-bar",class:[t.themeClass],attrs:{disabled:t.disabled}},[t.srcEmptyIcon?e("div",{staticClass:"md-empty-icon"},t._l(t.mdMaxRating,(function(n){return t.srcEmptyIcon?e("md-icon",{key:n,class:[t.iconClasses],attrs:{"md-src":t.srcEmptyIcon},nativeOn:{mouseover:function(n){t.hoverStars(n)},click:function(n){t.clickStars(n)},mouseout:function(n){t.onMouseOut(n)}}}):t._e()}))):e("div",{staticClass:"md-empty-icon"},t._l(t.mdMaxRating,(function(n){return e("md-icon",{key:n,class:[t.iconClasses],attrs:{"md-iconset":t.mdEmptyIconset},domProps:{innerHTML:t._s(t.emptyIcon)},nativeOn:{mouseover:function(n){t.hoverStars(n)},click:function(n){t.clickStars(n)},mouseout:function(n){t.onMouseOut(n)}}})}))),t._v(" "),t.srcFullIcon?e("div",{staticClass:"md-full-icon",style:t.fullIconStyle},t._l(t.mdMaxRating,(function(n){return t.srcFullIcon?e("md-icon",{key:n,class:[t.iconClasses],attrs:{"md-src":t.srcFullIcon},nativeOn:{mouseover:function(n){t.hoverStars(n)},click:function(n){t.clickStars(n)},mouseout:function(n){t.onMouseOut(n)}}}):t._e()}))):e("div",{staticClass:"md-full-icon",style:t.fullIconStyle},t._l(t.mdMaxRating,(function(n){return e("md-icon",{key:n,class:[t.iconClasses],attrs:{"md-iconset":t.mdFullIconset},domProps:{innerHTML:t._s(t.fullIcon)},nativeOn:{mouseover:function(n){t.hoverStars(n)},click:function(n){t.clickStars(n)},mouseout:function(n){t.onMouseOut(n)}}})})))])},staticRenderFns:[]}},461:function(t,n,e){t.exports=e(100)}})}));