UNPKG

h_ui

Version:

A Vue.js 2.0 UI Components Framework

1 lines 17.4 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 o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));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=929)}({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),o=n(14);t.exports=n(2)?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},111:function(t,e,n){var i=n(149),o="object"==typeof self&&self&&self.Object===Object&&self,r=i||o||Function("return this")();t.exports=r},112:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},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}},136:function(t,e,n){var i=n(111).Symbol;t.exports=i},138:function(t,e,n){var i=n(136),o=n(154),r=n(155),u=i?i.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):r(t)}},14:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},141:function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},149:function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,n(112))},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},154:function(t,e,n){var i=n(136),o=Object.prototype,r=o.hasOwnProperty,u=o.toString,a=i?i.toStringTag:void 0;t.exports=function(t){var e=r.call(t,a),n=t[a];try{t[a]=void 0;var i=!0}catch(t){}var o=u.call(t);return i&&(e?t[a]=n:delete t[a]),o}},155:function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},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,o){return t.call(e,n,i,o)}}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,o;if(e&&"function"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!i(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!i(o=n.call(t)))return o;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),o=n(1).document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.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),o=n(0),r=n(16),u=n(11),a=n(10),l=function(t,e,n){var s,c,f,d=t&l.F,p=t&l.G,h=t&l.S,v=t&l.P,b=t&l.B,m=t&l.W,w=p?o:o[e]||(o[e]={}),y=w.prototype,g=p?i:h?i[e]:(i[e]||{}).prototype;for(s in p&&(n=e),n)(c=!d&&g&&void 0!==g[s])&&a(w,s)||(f=c?g[s]:n[s],w[s]=p&&"function"!=typeof g[s]?n[s]:b&&c?r(f,i):m&&g[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?r(Function.call,f):f,v&&((w.virtual||(w.virtual={}))[s]=f,t&l.R&&y&&!y[s]&&u(y,s,f)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,t.exports=l},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,o,r,u,a){var l,s="function"==typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),i&&(s.functional=!0),r&&(s._scopeId="data-v-"+r),u?(l=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},s._ssrRegister=l):o&&(l=a?function(){o.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:o),l)if(s.functional){s._injectStyles=l;var c=s.render;s.render=function(t,e){return l.call(e),c(t,e)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,l):[l]}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})},493:function(t,e,n){"use strict";n.r(e);var i=n(494),o=n.n(i);for(var r in i)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(r);e.default=o.a},494:function(t,e,n){"use strict";var i=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(15)),r=i(n(931)),u=i(n(934)),a=i(n(53)),l=n(21),s=i(n(60)),c=i(n(937)),f="h-input-number",d="h-icon";function p(t,e){var n,i;try{n=t.toString().split(".")[1].length}catch(t){n=0}try{i=e.toString().split(".")[1].length}catch(t){i=0}var o=Math.pow(10,Math.max(n,i));return(Math.round(t*o)+Math.round(e*o))/o}var h={name:"InputNumber",mixins:[s.default],props:{max:{type:Number,default:r.default},min:{type:Number,default:u.default},step:{type:Number,default:1},value:{type:[Number,String],default:1,validator:function(t){return!(0,c.default)(Number(t))}},size:{validator:function(t){return(0,l.oneOf)(t,["small","large"])}},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:Boolean,default:!1},precision:{type:Number,validator:function(t){return t>=0&&t<=20}},setzero:{type:Boolean,default:!1},notScientificNotation:{type:Boolean,default:!1},tabindex:{type:[String,Number],default:"0",validator:function(t){var e=(0,a.default)(t,10);return e<=32767&&e>=-1}},focusAllSelect:{type:Boolean,default:!1},initNotShowNumber:{type:Boolean,default:!1},titleShow:{type:Boolean,default:!1},activeChange:{type:Boolean,default:!1},placeholder:{type:String,default:""},width:{type:Number,validator:function(t){return t>=80}}},data:function(){return{prefixCls:f,focused:!1,prepend:!0,append:!0,viewValue:this.value,oldValue:this.value}},computed:{upDisabled:{get:function(){return this.viewValue>=this.max},set:function(t){}},downDisabled:{get:function(){return this.viewValue<=this.min},set:function(t){}},precisionRegExp:function(){return new RegExp("\\.([0-9]{"+(this.precision+1)+"})")},wrapClasses:function(){var t;return["".concat(f),(t={},(0,o.default)(t,"".concat(f,"-").concat(this.size),!!this.size),(0,o.default)(t,"".concat(f,"-disabled"),this.disabled),(0,o.default)(t,"".concat(f,"-readonly"),this.readonly),(0,o.default)(t,"".concat(f,"-editable"),!this.editable),(0,o.default)(t,"".concat(f,"-focused"),this.focused),(0,o.default)(t,"".concat(f,"-group"),this.prepend||this.append),(0,o.default)(t,"".concat(f,"-group-with-prepend"),this.prepend),(0,o.default)(t,"".concat(f,"-group-with-append"),this.append),t)]},handlerClasses:function(){return"".concat(f,"-handler-wrap")},arrowClasser:function(){return"".concat(f,"-arrow-wrap")},upClasses:function(){return["".concat(f,"-handler"),"".concat(f,"-handler-up"),(0,o.default)({},"".concat(f,"-handler-up-disabled"),this.upDisabled)]},innerUpClasses:function(){return"".concat(f,"-handler-up-inner ").concat(d," iconfont icon-packup")},downClasses:function(){return["".concat(f,"-handler"),"".concat(f,"-handler-down"),(0,o.default)({},"".concat(f,"-handler-down-disabled"),this.downDisabled)]},innerDownClasses:function(){return"".concat(f,"-handler-down-inner ").concat(d," iconfont icon-unfold")},inputWrapClasses:function(){return"".concat(f,"-input-wrap")},inputClasses:function(){return"".concat(f,"-input")},wrapStyle:function(){var t={};return this.width&&(t.width="".concat(this.width,"px")),t}},methods:{preventDefault:function(t){t.preventDefault()},up:function(t){this.changeStep("up",t)},down:function(t){this.changeStep("down",t)},changeStep:function(t,e){if(this.disabled||this.readonly)return!1;var n=Number(this.oldValue),i=Number(this.step);if((0,c.default)(n))return!1;"up"===t?n=p(n,i):"down"===t&&(n=p(n,-i)),n=(n=n>this.max?this.max:n)<this.min?this.min:n,this.oldValue=n,this.setValue(n,!0)},setValue:function(t,e){var n=this,i=t;(0,c.default)(this.precision)||null===i||(i=Number(Number(i).toFixed(this.precision)),(0,c.default)(i)&&(i=0)),this.activeChange&&this.focused&&!e||(this.oldValue=null==i?i:i.toString(),this.viewValue=null==i?i:i.toString(),this.calcViewValue()),this.$emit("input",i),this.$nextTick((function(){n.$emit("on-change",i),n.dispatch("FormItem","on-form-change",i)}))},focus:function(t){this.oldValue=null==this.viewValue?this.viewValue:this.viewValue.toString(),this.focusAllSelect&&this.$refs.input.select(),this.focused=!0,this.$refs.input&&this.$refs.input.focus(),this.$emit("on-focus",t),this.dispatch("FormItem","on-form-focus")},blur:function(t){if(null!=t){if(""==t.target.value.trim()&&!this.setzero)return this.setValue(null),this.focused=!1,this.viewValue=null,this.dispatch("FormItem","on-form-blur",null),void this.$emit("on-blur",t);var e=Number(t.target.value.trim());this.focused=!1,e<this.min&&(e=this.min),this.setValue(e),this.dispatch("FormItem","on-form-blur",e),this.$emit("on-blur",t)}else this.focused=!1},keyDown:function(t){38===t.keyCode?(t.preventDefault(),this.up(t)):40===t.keyCode&&(t.preventDefault(),this.down(t))},change:function(t){var e=t.target.value.trim();if(0===(e=""==e&&this.setzero?"0":e).length)this.setValue(null);else if("input"==t.type&&e.match(/^\-{1}\.?$/))this.oldValue=null==e?e:e.toString();else{if("input"==t.type&&0===this.precision&&e.match(/\./))return t.target.value=this.oldValue,void(this.activeChange&&this.setValue(this.oldValue));if(void 0!==this.precision&&e.match(this.precisionRegExp))return t.target.value=this.oldValue,void(this.activeChange&&this.setValue(this.oldValue));var n=this.max;(0,c.default)(Number(e))?(t.target.value=this.oldValue,this.activeChange&&this.setValue(this.oldValue)):(e=e>n?n:e,t.target.value=e,this.viewValue=e,this.oldValue=null==e?e:e.toString(),this.activeChange&&this.setValue(e))}},outerChangeVal:function(t){var e=t,n=this.min,i=this.max;this.initNotShowNumber&&null===e||(e=Number(e),(0,c.default)(e)||(e>i?e=i:e<n&&(e=n))),this.activeChange&&this.focused||(this.oldValue=null==e?e:e.toString(),this.viewValue=null==e?e:e.toString(),this.calcViewValue())},calcViewValue:function(){if(null!=this.oldValue&&null!=this.oldValue)if(this.notScientificNotation){var t=(0,l.scientificNotationToString)(this.oldValue);this.viewValue=this.precision?(0,l.toFixedForString)(t,this.precision):t}else this.viewValue=this.precision?Number(this.oldValue).toFixed(this.precision):this.oldValue}},mounted:function(){window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui inputnumber lifecycle mounted"),!this.initNotShowNumber&&this.outerChangeVal(this.value),this.prepend=void 0!==this.$slots.prepend,this.append=void 0!==this.$slots.append,this.oldValue=null==this.viewValue?this.viewValue:this.viewValue.toString()},watch:{value:{immediate:!0,handler:function(t){if(window.$HUI&&window.$HUI.Log&&window.$HUI.Log.debug("h_ui inputnumber watch value change: "+t),null==t)return this.oldValue=null,void(this.viewValue=null);this.outerChangeVal(t)}},min:function(){this.outerChangeVal(this.oldValue)},max:function(){this.outerChangeVal(this.oldValue)}}};e.default=h},5:function(t,e,n){var i=n(12),o=n(25),r=n(17),u=Object.defineProperty;e.f=n(2)?Object.defineProperty:function(t,e,n){if(i(t),e=r(e,!0),i(n),o)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),o=n(18),r=n(7),u=n(35),a="["+u+"]",l=RegExp("^"+a+a+"*"),s=RegExp(a+a+"*$"),c=function(t,e,n){var o={},a=r((function(){return!!u[t]()||"​…"!="​…"[t]()})),l=o[t]=a?e(f):u[t];n&&(o[n]=l),i(i.P+i.F*a,"String",o)},f=c.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(l,"")),2&e&&(t=t.replace(s,"")),t};t.exports=c},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),o=n(71);i(i.G+i.F*(parseInt!=o),{parseInt:o})},71:function(t,e,n){var i=n(1).parseInt,o=n(51).trim,r=n(35),u=/^[-+]?0[xX]/;t.exports=8!==i(r+"08")||22!==i(r+"0x16")?function(t,e){var n=o(String(t),3);return i(n,e>>>0||(u.test(n)?16:10))}:i},737:function(t,e,n){"use strict";n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return o}));var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.wrapClasses,style:t.wrapStyle},[n("div",{class:t.handlerClasses},[n("div",{class:t.arrowClasser},[n("a",{class:t.upClasses,on:{click:t.up,mouse:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.preventDefault(e)}}},[n("span",{class:t.innerUpClasses,on:{click:t.preventDefault}})]),t._v(" "),n("a",{class:t.downClasses,on:{click:t.down,mouse:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?null:t.preventDefault(e)}}},[n("span",{class:t.innerDownClasses,on:{click:t.preventDefault}})])]),t._v(" "),t.append?n("div",{class:[t.prefixCls+"-append"]},[t._t("append")],2):t._e()]),t._v(" "),n("div",{class:t.inputWrapClasses},[n("input",{ref:"input",class:t.inputClasses,attrs:{disabled:t.disabled,autocomplete:"off",autofocus:t.autofocus,title:t.titleShow?t.viewValue:null,readonly:!t.editable||t.readonly,tabindex:t.tabindex,placeholder:t.placeholder},domProps:{value:null==t.viewValue?"":t.viewValue},on:{focus:t.focus,blur:t.blur,keydown:t.keyDown,input:t.change,change:t.change}})])])},o=[];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},929:function(t,e,n){"use strict";var i=n(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n(930)),r=n(32);o.default.install=function(t,e){(0,r.setGlobal)(t,e),t.component("HInputNumber",o.default),t.component("InputNumber",o.default)};var u=o.default;e.default=u},930:function(t,e,n){"use strict";n.r(e);var i=n(737),o=n(493);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);var u=n(4),a=Object(u.a)(o.default,i.a,i.b,!1,null,null,null);e.default=a.exports},931:function(t,e,n){t.exports=n(932)},932:function(t,e,n){n(933),t.exports=9007199254740991},933:function(t,e,n){var i=n(3);i(i.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},934:function(t,e,n){t.exports=n(935)},935:function(t,e,n){n(936),t.exports=-9007199254740991},936:function(t,e,n){var i=n(3);i(i.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},937:function(t,e,n){var i=n(938);t.exports=function(t){return i(t)&&t!=+t}},938:function(t,e,n){var i=n(138),o=n(141);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==i(t)}}})}));