h_ui
Version:
A Vue.js 2.0 UI Components Framework
1 lines • 10.3 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("h_ui/dist/lib/util/global.js"),require("h_ui/dist/lib/mixins/locale.js"),require("h_ui/dist/lib/mixins/emitter.js")):"function"==typeof define&&define.amd?define("h_ui/lib",["h_ui/dist/lib/util/global.js","h_ui/dist/lib/mixins/locale.js","h_ui/dist/lib/mixins/emitter.js"],e):"object"==typeof exports?exports["h_ui/lib"]=e(require("h_ui/dist/lib/util/global.js"),require("h_ui/dist/lib/mixins/locale.js"),require("h_ui/dist/lib/mixins/emitter.js")):t["h_ui/lib"]=e(t["h_ui/dist/lib/util/global.js"],t["h_ui/dist/lib/mixins/locale.js"],t["h_ui/dist/lib/mixins/emitter.js"])}(window,(function(t,e,n){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.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 i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));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="/dist/lib/",n(n.s=983)}({0:function(t,e){var n=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},1:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},10:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},11:function(t,e,n){var r=n(5),i=n(14);t.exports=n(2)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},12:function(t,e,n){var r=n(6);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},14:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},15:function(t,e,n){var r=n(38);t.exports=function(t,e,n){return e in t?r(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.__esModule=!0,t.exports.default=t.exports},16:function(t,e,n){var r=n(27);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},17:function(t,e,n){var r=n(6);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},2:function(t,e,n){t.exports=!n(7)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},24:function(t,e,n){var r=n(6),i=n(1).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},25:function(t,e,n){t.exports=!n(2)&&!n(7)((function(){return 7!=Object.defineProperty(n(24)("div"),"a",{get:function(){return 7}}).a}))},27:function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},3:function(t,e,n){var r=n(1),i=n(0),o=n(16),u=n(11),a=n(10),s=function(t,e,n){var c,l,f,d=t&s.F,p=t&s.G,h=t&s.S,v=t&s.P,_=t&s.B,b=t&s.W,y=p?i:i[e]||(i[e]={}),x=y.prototype,m=p?r:h?r[e]:(r[e]||{}).prototype;for(c in p&&(n=e),n)(l=!d&&m&&void 0!==m[c])&&a(y,c)||(f=l?m[c]:n[c],y[c]=p&&"function"!=typeof m[c]?n[c]:_&&l?o(f,r):b&&m[c]==f?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((y.virtual||(y.virtual={}))[c]=f,t&s.R&&x&&!x[c]&&u(x,c,f)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},32:function(e,n){e.exports=t},38:function(t,e,n){t.exports=n(39)},39:function(t,e,n){n(40);var r=n(0).Object;t.exports=function(t,e,n){return r.defineProperty(t,e,n)}},4:function(t,e,n){"use strict";function r(t,e,n,r,i,o,u,a){var s,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),o&&(c._scopeId="data-v-"+o),u?(s=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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},c._ssrRegister=s):i&&(s=a?function(){i.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:i),s)if(c.functional){c._injectStyles=s;var l=c.render;c.render=function(t,e){return s.call(e),l(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,s):[s]}return{exports:t,options:c}}n.d(e,"a",(function(){return r}))},40:function(t,e,n){var r=n(3);r(r.S+r.F*!n(2),"Object",{defineProperty:n(5).f})},49:function(t,n){t.exports=e},5:function(t,e,n){var r=n(12),i=n(25),o=n(17),u=Object.defineProperty;e.f=n(2)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},527:function(t,e,n){"use strict";n.r(e);var r=n(528),i=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);e.default=i.a},528:function(t,e,n){"use strict";var r=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(15)),o=r(n(49)),u=r(n(60)),a="h-rate",s={name:"Rate",mixins:[o.default,u.default],props:{count:{type:Number,default:5},value:{type:Number,default:0},allowHalf:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},showText:{type:Boolean,default:!1},name:{type:String},clearable:{type:Boolean,default:!1},character:{type:String,default:""},icon:{type:String,default:""},customIcon:{type:String,default:""}},data:function(){return{prefixCls:a,hoverIndex:-1,isHover:!1,isHalf:this.allowHalf&&this.value.toString().indexOf(".")>=0,currentValue:this.value}},computed:{classes:function(){return["".concat(a),(0,i.default)({},"".concat(a,"-disabled"),this.disabled)]},iconClasses:function(){var t;return["h-icon",(t={},(0,i.default)(t,"iconfont icon-".concat(this.icon),""!==this.icon),(0,i.default)(t,"".concat(this.customIcon),""!==this.customIcon),t)]},showCharacter:function(){return""!==this.character||""!==this.icon||""!==this.customIcon}},watch:{value:function(t){this.currentValue=t},currentValue:function(t){this.setHalf(t)}},methods:{starCls:function(t){var e,n=this.hoverIndex,r=this.isHover?n:this.currentValue,o=!1,u=!1;return r>=t&&(o=!0),u=this.isHover?r===t:Math.ceil(this.currentValue)===t,[(e={},(0,i.default)(e,"".concat(a,"-star"),!this.showCharacter),(0,i.default)(e,"".concat(a,"-star-chart"),this.showCharacter),(0,i.default)(e,"".concat(a,"-star-full"),!u&&o||u&&!this.isHalf),(0,i.default)(e,"".concat(a,"-star-half"),u&&this.isHalf),(0,i.default)(e,"".concat(a,"-star-zero"),!o),e)]},handleMousemove:function(t,e){if(!this.disabled){if(this.isHover=!0,this.allowHalf){var n=e.target.getAttribute("type")||!1;this.isHalf="half"===n}else this.isHalf=!1;this.hoverIndex=t}},handleMouseleave:function(){this.disabled||(this.isHover=!1,this.setHalf(this.currentValue),this.hoverIndex=-1)},setHalf:function(t){this.isHalf=this.allowHalf&&t.toString().indexOf(".")>=0},handleClick:function(t){var e=t;this.disabled||(this.isHalf&&(e-=.5),this.clearable&&Math.abs(e-this.currentValue)<.01&&(e=0),this.currentValue=e,this.$emit("input",e),this.$emit("on-change",e),this.dispatch("FormItem","on-form-change",e))}}};e.default=s},6:function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},60:function(t,e){t.exports=n},7:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},750:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i}));var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.classes,on:{mouseleave:t.handleMouseleave}},[n("input",{attrs:{type:"hidden",name:t.name},domProps:{value:t.currentValue}}),t._v(" "),t._l(t.count,(function(e){return n("div",{key:e,class:t.starCls(e),on:{mousemove:function(n){return t.handleMousemove(e,n)},click:function(n){return t.handleClick(e)}}},[t.showCharacter?[n("span",{class:[t.prefixCls+"-star-first"],attrs:{type:"half"}},[""!==t.character?[t._v(t._s(t.character))]:n("i",{class:t.iconClasses,attrs:{type:"half"}})],2),t._v(" "),n("span",{class:[t.prefixCls+"-star-second"]},[""!==t.character?[t._v(t._s(t.character))]:n("i",{class:t.iconClasses})],2)]:[n("span",{class:[t.prefixCls+"-star-content"],attrs:{type:"half"}})]],2)})),t._v(" "),t.showText?n("div",{directives:[{name:"show",rawName:"v-show",value:t.currentValue>0,expression:"currentValue > 0"}],class:[t.prefixCls+"-text"]},[t._t("default",[n("span",[t._v(t._s(t.currentValue))]),t._v(" "),t.currentValue<=1?n("span",[t._v(t._s(t.t("i.rate.star")))]):n("span",[t._v(t._s(t.t("i.rate.stars")))])])],2):t._e()],2)},i=[];r._withStripped=!0},8:function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},983:function(t,e,n){"use strict";var r=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(984)),o=n(32);i.default.install=function(t,e){(0,o.setGlobal)(t,e),t.component("HRate",i.default),t.component("Rate",i.default)};var u=i.default;e.default=u},984:function(t,e,n){"use strict";n.r(e);var r=n(750),i=n(527);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);var u=n(4),a=Object(u.a)(i.default,r.a,r.b,!1,null,null,null);e.default=a.exports}})}));