UNPKG

h_ui

Version:

A Vue.js 2.0 UI Components Framework

1 lines 15.8 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("h_ui/dist/lib/util/tools.js"),require("h_ui/dist/lib/util/global.js"),require("h_ui/dist/lib/mixins/emitter.js")):"function"==typeof define&&define.amd?define("h_ui/lib",["h_ui/dist/lib/util/tools.js","h_ui/dist/lib/util/global.js","h_ui/dist/lib/mixins/emitter.js"],e):"object"==typeof exports?exports["h_ui/lib"]=e(require("h_ui/dist/lib/util/tools.js"),require("h_ui/dist/lib/util/global.js"),require("h_ui/dist/lib/mixins/emitter.js")):t["h_ui/lib"]=e(t["h_ui/dist/lib/util/tools.js"],t["h_ui/dist/lib/util/global.js"],t["h_ui/dist/lib/mixins/emitter.js"])}(window,(function(t,e,n){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},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=980)}({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 i=n(5),r=n(14);t.exports=n(2)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},12:function(t,e,n){var i=n(6);t.exports=function(t){if(!i(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 i=n(38);t.exports=function(t,e,n){return e in t?i(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 i=n(27);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},17:function(t,e,n){var i=n(6);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},18:function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},2:function(t,e,n){t.exports=!n(7)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},21:function(e,n){e.exports=t},24:function(t,e,n){var i=n(6),r=n(1).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.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 i=n(1),r=n(0),o=n(16),u=n(11),a=n(10),c=function(t,e,n){var s,l,f,d=t&c.F,p=t&c.G,h=t&c.S,v=t&c.P,b=t&c.B,m=t&c.W,g=p?r:r[e]||(r[e]={}),y=g.prototype,w=p?i:h?i[e]:(i[e]||{}).prototype;for(s in p&&(n=e),n)(l=!d&&w&&void 0!==w[s])&&a(g,s)||(f=l?w[s]:n[s],g[s]=p&&"function"!=typeof w[s]?n[s]:b&&l?o(f,i):m&&w[s]==f?function(t){var e=function(e,n,i){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,i)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((g.virtual||(g.virtual={}))[s]=f,t&c.R&&y&&!y[s]&&u(y,s,f)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},32:function(t,n){t.exports=e},35:function(t,e){t.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},38:function(t,e,n){t.exports=n(39)},39:function(t,e,n){n(40);var i=n(0).Object;t.exports=function(t,e,n){return i.defineProperty(t,e,n)}},4:function(t,e,n){"use strict";function i(t,e,n,i,r,o,u,a){var c,s="function"==typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),i&&(s.functional=!0),o&&(s._scopeId="data-v-"+o),u?(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__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},s._ssrRegister=c):r&&(c=a?function(){r.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(s.functional){s._injectStyles=c;var l=s.render;s.render=function(t,e){return c.call(e),l(t,e)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:s}}n.d(e,"a",(function(){return i}))},40:function(t,e,n){var i=n(3);i(i.S+i.F*!n(2),"Object",{defineProperty:n(5).f})},5:function(t,e,n){var i=n(12),r=n(25),o=n(17),u=Object.defineProperty;e.f=n(2)?Object.defineProperty:function(t,e,n){if(i(t),e=o(e,!0),i(n),r)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}},51:function(t,e,n){var i=n(3),r=n(18),o=n(7),u=n(35),a="["+u+"]",c=RegExp("^"+a+a+"*"),s=RegExp(a+a+"*$"),l=function(t,e,n){var r={},a=o((function(){return!!u[t]()||"​…"!="​…"[t]()})),c=r[t]=a?e(f):u[t];n&&(r[n]=c),i(i.P+i.F*a,"String",r)},f=l.trim=function(t,e){return t=String(r(t)),1&e&&(t=t.replace(c,"")),2&e&&(t=t.replace(s,"")),t};t.exports=l},523:function(t,e,n){"use strict";n.r(e);var i=n(524),r=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e.default=r.a},524:function(t,e,n){"use strict";var i=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(n(15)),o=i(n(53)),u=n(21),a=i(n(60)),c="h-radio",s={name:"Radio",mixins:[a.default],props:{value:{type:[String,Number,Boolean],default:!1},trueValue:{type:[String,Number,Boolean],default:!0},falseValue:{type:[String,Number,Boolean],default:!1},label:{type:[String,Number]},text:{type:[String,Number,Boolean],default:null},disabled:{type:Boolean,default:!1},size:{validator:function(t){return(0,u.oneOf)(t,["small","large","default"])}},readonly:{type:Boolean,default:!1},tabindex:{type:[String,Number],default:"0",validator:function(t){var e=(0,o.default)(t,10);return e<=32767&&e>=-1}},canCancel:{type:Boolean,default:!1}},data:function(){return{currentValue:this.value,group:!1,parent:(0,u.findComponentsUpward)(this,"RadioGroup"),isFocus:!1,viewValue:this.text||this.value}},computed:{showBtnIcon:function(){return!!this.parent&&("button"==this.parent.type&&this.parent.btnIcon&&this.parent.btnIconOnlyChecked?this.currentValue:!!this.parent.btnIcon&&"button"==this.parent.type)},wrapClasses:function(){var t;return["".concat(c,"-wrapper"),(t={},(0,r.default)(t,"".concat(c,"-group-item"),this.group),(0,r.default)(t,"".concat(c,"-wrapper-checked"),this.currentValue),(0,r.default)(t,"".concat(c,"-wrapper-disabled"),this.disabled),(0,r.default)(t,"".concat(c,"-").concat(this.size),!!this.size),t)]},radioClasses:function(){var t;return["".concat(c),(t={},(0,r.default)(t,"".concat(c,"-checked"),this.currentValue),(0,r.default)(t,"".concat(c,"-disabled"),this.disabled),(0,r.default)(t,"".concat(c,"-btnIcon"),this.showBtnIcon),t)]},innerClasses:function(){return["".concat(c,"-inner"),(0,r.default)({},"".concat(c,"-inner-focus"),this.isFocus)]},inputClasses:function(){return"".concat(c,"-input")}},mounted:function(){window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui radio lifecycle mounted"),this.parent&&(this.group=!0),this.group?this.parent.updateValue(!0):this.updateValue()},methods:{change:function(t){if(this.disabled)return!1;var e=t.target.checked;this.currentValue=e;var n=e?this.trueValue:this.falseValue;this.$emit("input",n),this.group&&void 0!==this.label&&this.parent.change({value:this.label,checked:this.value}),this.group||(this.$emit("on-change",n),this.dispatch("FormItem","on-form-change",n))},radioClick:function(){if(!this.group&&this.currentValue&&this.canCancel){var t=this.falseValue;this.$emit("input",t),this.$emit("on-change",t),this.dispatch("FormItem","on-form-change",t),this.blur()}this.parent&&this.currentValue&&this.canCancel&&(this.parent.change({value:"",checked:this.falseValue}),this.blur()),this.parent&&this.currentValue&&this.parent.canCancel&&(this.parent.change({value:"",checked:this.falseValue}),this.blur()),this.$emit("on-click"),this.dispatch("RadioGroup","on-group-click")},updateValue:function(){this.currentValue=this.value===this.trueValue},focus:function(t){this.$refs.input.focus(),this.isFocus=!0,this.$emit("on-focus",t),this.dispatch("FormItem","on-form-focus")},blur:function(t){this.$refs.input.blur(),this.isFocus=!1,this.$emit("on-blur",t),this.dispatch("FormItem","on-form-blur")},getTabIndex:function(){var t=this.tabindex;return"0"===String(t)&&this.parent&&"0"!==String(this.parent.tabindex)&&(t=this.parent.tabindex),t}},watch:{value:function(t){if(window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui radio watch value change: "+t),t!==this.trueValue&&t!==this.falseValue)throw new Error("Value should be trueValue or falseValue.");this.updateValue()},currentValue:function(t){this.viewValue=this.text||t}}};e.default=s},525:function(t,e,n){"use strict";n.r(e);var i=n(526),r=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e.default=r.a},526:function(t,e,n){"use strict";var i=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(n(15)),o=i(n(53)),u=n(21),a=i(n(60)),c="h-radio-group",s={name:"RadioGroup",mixins:[a.default],props:{value:{type:[String,Number],default:""},size:{validator:function(t){return(0,u.oneOf)(t,["small","large","default"])}},type:{validator:function(t){return(0,u.oneOf)(t,["button"])}},vertical:{type:Boolean,default:!1},canCancel:{type:Boolean,default:!1},btnIcon:{type:Boolean,default:!1},btnIconOnlyChecked:{type:Boolean,default:!1},tabindex:{type:[String,Number],default:"0",validator:function(t){var e=(0,o.default)(t,10);return e<=32767&&e>=-1}}},data:function(){return{currentValue:this.value,childrens:[],viewValue:""}},computed:{classes:function(){var t;return["".concat(c),(t={},(0,r.default)(t,"".concat(c,"-").concat(this.size),!!this.size),(0,r.default)(t,"h-radio-".concat(this.size),!!this.size),(0,r.default)(t,"".concat(c,"-").concat(this.type),!!this.type),(0,r.default)(t,"".concat(c,"-vertical"),this.vertical),t)]}},mounted:function(){var t=this;window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui radiogroup lifecycle mounted"),this.updateValue(!0),this.getViewVlaue(this.value),this.$on("on-group-click",(function(){t.$emit("on-click")}))},methods:{updateValue:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.value;this.childrens=(0,u.findComponentsDownward)(this,"Radio"),this.childrens&&this.childrens.forEach((function(t){t.currentValue=e===t.label,t.group=!0})),t||this.dispatch("FormItem","on-form-change",e)},change:function(t){this.currentValue=t.value,this.updateValue(),this.$emit("input",t.value),this.$emit("on-change",t.value),this.dispatch("FormItem","on-form-change",t.value)},focus:function(){if(this.$slots.default){var t=this.$slots.default.filter((function(t){return!(!t.componentOptions||!t.componentOptions.tag||t.componentInstance.disabled||!t.componentInstance.currentValue)}))[0];t||(t=this.$slots.default.filter((function(t){var e=t.componentOptions&&t.componentOptions.tag;return e&&t.componentInstance.disabled&&t.componentInstance.currentValue&&(t.componentInstance.currentValue=!1),e&&!t.componentInstance.disabled}))[0])&&t.componentInstance&&(t.componentInstance.currentValue=!0,this.$emit("input",t.componentInstance.label)),t&&t.componentInstance&&t.componentInstance.focus()}},blur:function(){this.$slots.default.filter((function(t){return!(!t.componentOptions||!t.componentOptions.tag||!t.componentInstance.currentValue)}))[0].componentInstance.blur()},getViewVlaue:function(t){if(this.childrens){var e="";this.childrens.forEach((function(n){t==n.label&&(e=n.text||n.label)})),this.viewValue=e}else this.viewValue=t}},watch:{value:function(){window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui radiogroup watch value change: "+this.value),this.updateValue()},currentValue:function(t){this.getViewVlaue(t)}},beforeDestroy:function(){window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui radiogroup lifecycle beforeDestroy"),this.$off("on-group-click")}};e.default=s},53:function(t,e,n){t.exports=n(69)},6:function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},60:function(t,e){t.exports=n},69:function(t,e,n){n(70),t.exports=n(0).parseInt},7:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},70:function(t,e,n){var i=n(3),r=n(71);i(i.G+i.F*(parseInt!=r),{parseInt:r})},71:function(t,e,n){var i=n(1).parseInt,r=n(51).trim,o=n(35),u=/^[-+]?0[xX]/;t.exports=8!==i(o+"08")||22!==i(o+"0x16")?function(t,e){var n=r(String(t),3);return i(n,e>>>0||(u.test(n)?16:10))}:i},748:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return r}));var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{class:t.wrapClasses},[n("span",{class:t.radioClasses,on:{click:t.radioClick}},[n("span",{class:t.innerClasses}),t._v(" "),n("input",{ref:"input",class:t.inputClasses,attrs:{type:"radio",disabled:t.disabled,readonly:t.readonly,tabindex:t.getTabIndex()},domProps:{checked:t.currentValue},on:{focus:t.focus,blur:t.blur,change:t.change}})]),t._t("default",[t._v(t._s(t.text||t.label))])],2)},r=[];i._withStripped=!0},749:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return r}));var i=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{class:t.classes},[t._t("default")],2)},r=[];i._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},980:function(t,e,n){"use strict";var i=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=i(n(981)),o=i(n(982)),u=n(32);r.default.install=function(t,e){(0,u.setGlobal)(t,e),t.component("HRadio",r.default),t.component("Radio",r.default),t.component("HRadioGroup",o.default),t.component("RadioGroup",o.default)},r.default.Group=o.default;var a=r.default;e.default=a},981:function(t,e,n){"use strict";n.r(e);var i=n(748),r=n(523);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);var u=n(4),a=Object(u.a)(r.default,i.a,i.b,!1,null,null,null);e.default=a.exports},982:function(t,e,n){"use strict";n.r(e);var i=n(749),r=n(525);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);var u=n(4),a=Object(u.a)(r.default,i.a,i.b,!1,null,null,null);e.default=a.exports}})}));