vue-material/dist/components/mdRatingBar/index.js

6 lines
6.2 KiB
JavaScript
Raw Permalink Normal View History

2017-06-19 16:27:45 +00:00
/*!
2017-06-22 11:00:36 +00:00
* Vue Material v0.7.3
2017-06-19 16:27:45 +00:00
* 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=466)})({0:function(t,n){t.exports=function(t,n,e,o,i){var r,c=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(r=t,c=t.default);var u="function"==typeof c?c.options:c;n&&(u.render=n.render,u.staticRenderFns=n.staticRenderFns),o&&(u._scopeId=o);var a;if(i?(a=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},u._ssrRegister=a):e&&(a=e),a){var l=u.functional,d=l?u.render:u.beforeCreate;l?u.render=function(t,n){return a.call(n),d(t,n)}:u.beforeCreate=d?[].concat(d,a):[a]}return{esModule:r,exports:c,options:u}}},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?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",c.default),t.material.styles.push(u.default)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=i;var r=e(344),c=o(r),s=e(282),u=o(s);t.exports=n.default},175:function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0});var i=e(1),r=o(i),c=24;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:[r.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":-c*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?o:n.mdMaxRating,!0})),o},checkSrc:function(t){return t&&/.+\.(svg|png)/.test(t)?t:null},onMouseOut:function