cube-ui
Version:
A fantastic mobile ui lib implement by Vue
1 lines • 4.76 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.checkbox=t():(e.cube=e.cube||{},e.cube.checkbox=t())}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="./",t(t.s=284)}({161:function(e,t,n){function o(e){n(168)}var r=n(9)(n(169),n(170),o,null,null);e.exports=r.exports},168:function(e,t){},169:function(e,t,n){var o,r,c;!function(n,i){r=[e,t],o=i,void 0!==(c="function"==typeof o?o.apply(t,r):o)&&(e.exports=c)}(0,function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={name:"cube-checkbox",props:{value:{type:[Boolean,String]},label:{type:[Boolean,String]},disabled:{type:Boolean,default:!1},option:{type:[Boolean,String,Object],default:function(){return{_def_option:!0}}},position:{type:String,default:"left"},shape:{type:String,default:"circle"},hollowStyle:{type:Boolean,default:!1}},data:function(){var e=this.$parent,t=e.$data._checkboxGroup;return{isInGroup:t,isInHorizontalGroup:t&&(e.$props.horizontal||e.$props.colNum>1)}},computed:{computedOption:function(){var e=this.option,t=this.label,n=this.disabled;return!0===e._def_option?e={label:t,value:t,disabled:n}:"string"==typeof e&&(e={label:e,value:e,disabled:!1}),e},checkValue:{get:function(){return this.isInGroup?this.$parent.value.indexOf(this.computedOption.value)>-1:Boolean(this.value)},set:function(e){var t=this.computedOption.value,n=t&&e?t:e;if(this.$emit("input",n),this.isInGroup){e=!this.checkValue;var o=e?"checked":"cancel-checked";this.$parent.$emit(o,t||e)}}},_containerClass:function(){return{"cube-checkbox-hollow":this.hollowStyle,"cube-checkbox_checked":this.checkValue,"cube-checkbox_disabled":this.computedOption.disabled,"border-right-1px":this.isInHorizontalGroup}},_wrapClass:function(){if(this.isInGroup&&!this.isInHorizontalGroup)return"border-bottom-1px"},isSquare:function(){return"square"===this.shape||this.hollowStyle},_borderIconClass:function(){return this.isSquare?"cubeic-square-border":"cubeic-round-border"},_rightIconClass:function(){return this.isSquare?"cubeic-square-right":"cubeic-right"}}},e.exports=t.default})},170:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"cube-checkbox",class:e._containerClass,attrs:{"data-pos":e.position}},[n("label",{staticClass:"cube-checkbox-wrap",class:e._wrapClass},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.checkValue,expression:"checkValue"}],staticClass:"cube-checkbox-input",attrs:{type:"checkbox",disabled:e.computedOption.disabled},domProps:{checked:Array.isArray(e.checkValue)?e._i(e.checkValue,null)>-1:e.checkValue},on:{change:function(t){var n=e.checkValue,o=t.target,r=!!o.checked;if(Array.isArray(n)){var c=e._i(n,null);o.checked?c<0&&(e.checkValue=n.concat([null])):c>-1&&(e.checkValue=n.slice(0,c).concat(n.slice(c+1)))}else e.checkValue=r}}}),e._v(" "),n("span",{staticClass:"cube-checkbox-ui",class:e._borderIconClass},[n("i",{class:e._rightIconClass})]),e._v(" "),n("span",{staticClass:"cube-checkbox-label"},[e._t("default",[e._v(e._s(e.computedOption.label))])],2)])])},staticRenderFns:[]}},284:function(e,t,n){var o,r,c;!function(i,a){r=[e,t,n(161)],o=a,void 0!==(c="function"==typeof o?o.apply(t,r):o)&&(e.exports=c)}(0,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){return e&&e.__esModule?e:{default:e}}(n);o.default.install=function(e){e.component(o.default.name,o.default)},t.default=o.default,e.exports=t.default})},9:function(e,t){e.exports=function(e,t,n,o,r){var c,i=e=e||{},a=typeof e.default;"object"!==a&&"function"!==a||(c=e,i=e.default);var s="function"==typeof i?i.options:i;t&&(s.render=t.render,s.staticRenderFns=t.staticRenderFns),o&&(s._scopeId=o);var u;if(r?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},s._ssrRegister=u):n&&(u=n),u){var l=s.functional,p=l?s.render:s.beforeCreate;l?s.render=function(e,t){return u.call(t),p(e,t)}:s.beforeCreate=p?[].concat(p,u):[u]}return{esModule:c,exports:i,options:s}}}})});