vxe-pc-ui 3.3.23 → 3.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/number-input/src/number-input.js +5 -5
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/ui/index.js +1 -1
  6. package/es/ui/src/log.js +1 -1
  7. package/lib/icon/style/style.css +1 -1
  8. package/lib/icon/style/style.min.css +1 -1
  9. package/lib/index.umd.js +6 -6
  10. package/lib/index.umd.min.js +1 -1
  11. package/lib/number-input/src/number-input.js +4 -4
  12. package/lib/number-input/src/number-input.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/style.min.css +1 -1
  15. package/lib/ui/index.js +1 -1
  16. package/lib/ui/index.min.js +1 -1
  17. package/lib/ui/src/log.js +1 -1
  18. package/lib/ui/src/log.min.js +1 -1
  19. package/package.json +1 -1
  20. package/packages/number-input/src/number-input.ts +5 -5
  21. /package/es/icon/{iconfont.1733572708126.ttf → iconfont.1733649304143.ttf} +0 -0
  22. /package/es/icon/{iconfont.1733572708126.woff → iconfont.1733649304143.woff} +0 -0
  23. /package/es/icon/{iconfont.1733572708126.woff2 → iconfont.1733649304143.woff2} +0 -0
  24. /package/es/{iconfont.1733572708126.ttf → iconfont.1733649304143.ttf} +0 -0
  25. /package/es/{iconfont.1733572708126.woff → iconfont.1733649304143.woff} +0 -0
  26. /package/es/{iconfont.1733572708126.woff2 → iconfont.1733649304143.woff2} +0 -0
  27. /package/lib/icon/style/{iconfont.1733572708126.ttf → iconfont.1733649304143.ttf} +0 -0
  28. /package/lib/icon/style/{iconfont.1733572708126.woff → iconfont.1733649304143.woff} +0 -0
  29. /package/lib/icon/style/{iconfont.1733572708126.woff2 → iconfont.1733649304143.woff2} +0 -0
  30. /package/lib/{iconfont.1733572708126.ttf → iconfont.1733649304143.ttf} +0 -0
  31. /package/lib/{iconfont.1733572708126.woff → iconfont.1733649304143.woff} +0 -0
  32. /package/lib/{iconfont.1733572708126.woff2 → iconfont.1733649304143.woff2} +0 -0
@@ -327,7 +327,7 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
327
327
  var reactData = $xeNumberInput.reactData;
328
328
  var $xeForm = $xeNumberInput.$xeForm;
329
329
  var formItemInfo = $xeNumberInput.formItemInfo;
330
- var value = val === '' || _xeUtils.default.eqNull(val) ? null : Number(val);
330
+ var value = (0, _utils.eqEmptyValue)(val) ? null : Number(val);
331
331
  var isChange = value !== props.value;
332
332
  reactData.inputValue = inputValue || '';
333
333
  if (isChange) {
@@ -461,14 +461,14 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
461
461
  var inputValue = reactData.inputValue;
462
462
  var inputReadonly = $xeNumberInput.computeInputReadonly;
463
463
  if (!inputReadonly) {
464
- if (inputValue === '') {
464
+ if ((0, _utils.eqEmptyValue)(inputValue)) {
465
465
  var inpNumVal = null;
466
466
  var inpValue = inputValue;
467
467
  if (min || min === 0) {
468
468
  inpNumVal = _xeUtils.default.toNumber(min);
469
469
  inpValue = "".concat(inpNumVal);
470
470
  }
471
- $xeNumberInput.handleChange(inpNumVal, inpValue, {
471
+ $xeNumberInput.handleChange(inpNumVal, "".concat(inpValue || ''), {
472
472
  type: 'check'
473
473
  });
474
474
  return;
@@ -487,7 +487,7 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
487
487
  }
488
488
  }
489
489
  var _inpValue = $xeNumberInput.getNumberValue(_inpNumVal);
490
- $xeNumberInput.handleChange(_inpValue === null ? null : Number(_inpValue), _inpValue, {
490
+ $xeNumberInput.handleChange((0, _utils.eqEmptyValue)(_inpValue) ? null : Number(_inpValue), _inpValue, {
491
491
  type: 'check'
492
492
  });
493
493
  }
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../..//ui/src/vn"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}var handleNumberString=function(e){return _xeUtils.default.eqNull(e)?"":"".concat(e)},_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeNumberInput",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"number"},clearable:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.clearable}},readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},placeholder:String,maxLength:[String,Number],autoComplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.size||(0,_ui.getConfig)().size}},multiple:Boolean,min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.exponential}},controls:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.controls}},digits:{type:[String,Number],default:function(){return(0,_ui.getConfig)().numberInput.digits}},prefixIcon:String,suffixIcon:String,maxlength:[String,Number],autocomplete:String},inject:{$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{isActivated:!1,inputValue:""},internalData:{dnTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeFormReadonly:function(){var e=this.$xeForm,t=this.readonly;return null===t?!!e&&e.readonly:t},computeIsDisabled:function(){var e=this.$xeForm,t=this.disabled;return null===t?!!e&&e.disabled:t},computeDigitsValue:function(){return _xeUtils.default.toInteger(this.digits)||1},computeStepValue:function(){var e=this.type,t=this.computeDigitsValue,n=this.step;return"integer"===e?_xeUtils.default.toInteger(n)||1:"float"===e?_xeUtils.default.toNumber(n)||1/Math.pow(10,t):_xeUtils.default.toNumber(n)||1},computeIsClearable:function(){return this.clearable},computeInputReadonly:function(){var e=this.multiple;return this.computeFormReadonly||e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().numberInput.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseInput")},computeInpMaxLength:function(){var e=this.maxLength,t=this.maxlength;return _xeUtils.default.toNumber(e||t)||16},computeInpImmediate:function(){var e=this.type;return this.immediate||!("number"===e||"integer"===e||"float"===e)},computeNumValue:function(){var e=this.reactData,t=this.type,e=e.inputValue;return"integer"===t?_xeUtils.default.toInteger((0,_util.handleNumber)(e)):_xeUtils.default.toNumber((0,_util.handleNumber)(e))},computeNumLabel:function(){var e=this.reactData.inputValue;return _xeUtils.default.toString(e)},computeIsDisabledSubtractNumber:function(){var e=this.reactData,t=this.min,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n<=_xeUtils.default.toNumber(t)},computeIsDisabledAddNumber:function(){var e=this.reactData,t=this.max,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n>=_xeUtils.default.toNumber(t)}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$numberInput:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},focus:function(){var e=this.reactData,t=this.$refs.refInputTarget;return e.isActivated=!0,t.focus(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInputTarget.blur(),e.isActivated=!1,this.$nextTick()},select:function(){var e=this.reactData;return this.$refs.refInputTarget.select(),e.isActivated=!1,this.$nextTick()},getNumberValue:function(e){var t=this.type,n=this.exponential,i=this.computeInpMaxLength,u=this.computeDigitsValue,t="float"===t?(0,_util.toFloatValueFixed)(e,u):handleNumberString(e);return!n||e!==t&&handleNumberString(e).toLowerCase()!==_xeUtils.default.toNumber(t).toExponential()?t.slice(0,i):e},triggerEvent:function(e){var t=this.reactData.inputValue;this.dispatchEvent(e.type,{value:t},e)},handleChange:function(e,t,n){var i=this,u=i,a=i.reactData,r=i.$xeForm,l=i.formItemInfo,e=""===e||_xeUtils.default.eqNull(e)?null:Number(e),u=e!==u.value;a.inputValue=t||"",u&&i.emitModel(e),a.inputValue!==t&&i.$nextTick(function(){a.inputValue=t||""}),i.dispatchEvent("input",{value:e},n),u&&(i.dispatchEvent("change",{value:e},n),r)&&l&&r.triggerItemEvent(n,l.itemConfig.field,e)},emitInputEvent:function(e,t){var n=this.reactData,i=this.computeInpImmediate,u=""===e||_xeUtils.default.eqNull(e)?null:_xeUtils.default.toNumber(e);n.inputValue=e,i?this.handleChange(u,e,t):this.dispatchEvent("input",{value:u},t)},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.computeInpImmediate||this.triggerEvent(e)},focusEvent:function(e){this.reactData.isActivated=!0,this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("prefix-click",{value:t},e))},clearValueEvent:function(e,t){this.focus(),this.handleChange(null,"",e),this.dispatchEvent("clear",{value:t},e)},clickSuffixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("suffix-click",{value:t},e))},initValue:function(){var e,t=this.reactData,n=this.type,t=t.inputValue,i=this.computeDigitsValue;"float"===n&&t&&(n="",e=null,t&&(n=(0,_util.toFloatValueFixed)(t,i),e=Number(n)),t!==e)&&this.handleChange(e,n,{type:"init"})},validMaxNum:function(e){return null===this.max||_xeUtils.default.toNumber(e)<=_xeUtils.default.toNumber(this.max)},validMinNum:function(e){return null===this.min||_xeUtils.default.toNumber(e)>=_xeUtils.default.toNumber(this.min)},afterCheckValue:function(){var e,t,n=this,i=n.reactData,u=n.type,a=n.min,r=n.max,l=n.exponential,i=i.inputValue;n.computeInputReadonly||(""===i?(e=null,t=i,!a&&0!==a||(e=_xeUtils.default.toNumber(a),t="".concat(e)),n.handleChange(e,t,{type:"check"})):(i||a||r)&&(e="integer"===u?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),n.validMinNum(e)?n.validMaxNum(e)||(e=r):e=a,l&&(t=handleNumberString(i).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=t),u=n.getNumberValue(e),n.handleChange(null===u?null:Number(u),u,{type:"check"})))},blurEvent:function(e){var t=this,n=t.reactData,i=t.$xeForm,u=t.formItemInfo,a=n.inputValue,r=t.computeInpImmediate,l=a?Number(a):null;r||t.handleChange(l,handleNumberString(a),e),t.afterCheckValue(),n.isActivated=!1,t.dispatchEvent("blur",{value:l},e),i&&u&&i.triggerItemEvent(e,u.itemConfig.field,l)},numberChange:function(e,t){var n=this,i=n.reactData,u=n.min,a=n.max,i=i.inputValue,r=n.computeStepValue,i="integer"===n.type?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),e=e?_xeUtils.default.add(i,r):_xeUtils.default.subtract(i,r),i=n.validMinNum(e)?n.validMaxNum(e)?e:a:u;n.emitInputEvent(n.getNumberValue(i),t)},numberNextEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,a=t.computeIsDisabledSubtractNumber;t.numberStopDown(),i||u||a||t.numberChange(!1,e),t.dispatchEvent("next-number",{value:n.inputValue},e)},numberDownNextEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberPrevEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,a=t.computeIsDisabledAddNumber;t.numberStopDown(),i||u||a||t.numberChange(!0,e),t.dispatchEvent("prev-number",{value:n.inputValue},e)},numberKeydownEvent:function(e){var t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);(t||n)&&(e.preventDefault(),t?this.numberPrevEvent(e):this.numberNextEvent(e))},keydownEvent:function(e){var t=this.exponential,n=this.controls,i=e.ctrlKey,u=e.shiftKey,a=e.altKey,r=e.keyCode,l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),s=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);i||u||a||!(_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR)||(!t||69!==r)&&65<=r&&r<=90||186<=r&&r<=188||191<=r)||e.preventDefault(),l?this.afterCheckValue():(o||s)&&n&&this.numberKeydownEvent(e),this.triggerEvent(e)},keyupEvent:function(e){this.triggerEvent(e)},numberStopDown:function(){var e=this.internalData,t=e.dnTimeout;t&&(clearTimeout(t),e.dnTimeout=void 0)},numberDownPrevEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberMousedownEvent:function(e){var t,n=this,i=n.internalData;n.numberStopDown(),0===e.button&&((t=(0,_dom.hasClass)(e.currentTarget,"is--prev"))?n.numberPrevEvent(e):n.numberNextEvent(e),i.dnTimeout=window.setTimeout(function(){t?n.numberDownPrevEvent(e):n.numberDownNextEvent(e)},500))},wheelEvent:function(e){var t=this,n=t.reactData;t.controls&&n.isActivated&&(0<(n=e.deltaY)?t.numberNextEvent(e):n<0&&t.numberPrevEvent(e),e.preventDefault()),t.triggerEvent(e)},clickEvent:function(e){this.triggerEvent(e)},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=n.isActivated,u=t.$refs.refElem,a=t.$refs.refInputPanel;!t.computeIsDisabled&&i&&(n.isActivated=(0,_dom.getEventTargetNode)(e,u).flag||(0,_dom.getEventTargetNode)(e,a).flag,n.isActivated||t.afterCheckValue())},handleGlobalKeydownEvent:function(e){var t,n,i,u=this,a=u.reactData,r=u.clearable;u.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),i=a.isActivated,t&&(i&&u.afterCheckValue(),a.isActivated=i=!1),n&&r&&i&&u.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.reactData.isActivated&&this.afterCheckValue()},renderNumberIcon:function(e){var t=this,n=t.computeIsDisabledAddNumber,i=t.computeIsDisabledSubtractNumber;return e("div",{class:"vxe-input--control-icon"},[e("div",{class:"vxe-input--number-icon"},[e("div",{class:["vxe-input--number-btn is--prev",{"is--disabled":n}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_PREV_NUM})]),e("div",{class:["vxe-input--number-btn is--next",{"is--disabled":i}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_NEXT_NUM})])])])},renderPrefixIcon:function(e){var t=this.$scopedSlots,n=this.prefixIcon,t=t.prefix;return t||n?e("div",{class:"vxe-number-input--prefix",on:{click:this.clickPrefixEvent}},[e("div",{class:"vxe-number-input--prefix-icon"},t?(0,_vn.getSlotVNs)(t({})):[e("i",{class:n})])]):null},renderSuffixIcon:function(e){var t=this,n=t.$scopedSlots,i=t.suffixIcon,u=t.reactData.inputValue,n=n.suffix,a=t.computeIsClearable;return e("div",{class:["vxe-number-input--suffix",{"is--clear":a&&!t.computeIsDisabled&&!(""===u||_xeUtils.default.eqNull(u))}]},[a?e("div",{class:"vxe-number-input--clear-icon",on:{click:t.clearValueEvent}},[e("i",{class:(0,_ui.getIcon)().INPUT_CLEAR})]):(0,_ui.renderEmptyElement)(t),t.renderExtraSuffixIcon(e),n||i?e("div",{class:"vxe-number-input--suffix-icon",on:{click:t.clickSuffixEvent}},n?(0,_vn.getSlotVNs)(n({})):[e("i",{class:i})]):(0,_ui.renderEmptyElement)(t)])},renderExtraSuffixIcon:function(e){return this.controls?this.renderNumberIcon(e):(0,_ui.renderEmptyElement)(this)},renderVN:function(e){var t,n,i,u,a,r=this,l=r.reactData,o=r.className,s=r.controls,c=r.type,m=r.align,d=r.name,f=r.autocomplete,p=r.autoComplete,v=l.inputValue,l=l.isActivated,h=r.computeSize,b=r.computeIsDisabled,_=r.computeNumLabel;return r.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-number-input--readonly","type--".concat(c),o]},_):(_=r.computeInputReadonly,t=r.computeInpMaxLength,n=r.computeInpPlaceholder,i=r.computeIsClearable,u=r.renderPrefixIcon(e),a=r.renderSuffixIcon(e),e("div",{ref:"refElem",class:["vxe-number-input","type--".concat(c),o,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(h),h),"is--".concat(m),m),"is--controls",s),"is--prefix",!!u),"is--suffix",!!a),"is--disabled",b),"is--active",l),"show--clear",i&&!b&&!(""===v||_xeUtils.default.eqNull(v)))],attrs:{spellcheck:!1}},[u||(0,_ui.renderEmptyElement)(r),e("div",{class:"vxe-number-input--wrapper"},[e("input",{ref:"refInputTarget",class:"vxe-number-input--inner",domProps:{value:v},attrs:{name:d,type:"text",placeholder:n,maxlength:t,readonly:_,disabled:b,autocomplete:p||f},on:{keydown:r.keydownEvent,keyup:r.keyupEvent,wheel:r.wheelEvent,click:r.clickEvent,input:r.inputEvent,change:r.changeEvent,focus:r.focusEvent,blur:r.blurEvent}})]),a||(0,_ui.renderEmptyElement)(r)]))}},watch:{value:function(e){this.reactData.inputValue=e},type:function(){var e=this.reactData;Object.assign(e,{inputValue:this.value}),this.initValue()}},created:function(){this.reactData.inputValue=this.value,this.initValue()},mounted:function(){var e=this;_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this;e.numberStopDown(),e.afterCheckValue(),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},render:function(e){return this.renderVN(e)}});
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../..//ui/src/vn"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}var handleNumberString=function(e){return _xeUtils.default.eqNull(e)?"":"".concat(e)},_default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxeNumberInput",mixins:[_ui.globalMixins.sizeMixin],model:{prop:"value",event:"modelValue"},props:{value:[String,Number],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"number"},clearable:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.clearable}},readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},placeholder:String,maxLength:[String,Number],autoComplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return(0,_ui.getConfig)().numberInput.size||(0,_ui.getConfig)().size}},multiple:Boolean,min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.exponential}},controls:{type:Boolean,default:function(){return(0,_ui.getConfig)().numberInput.controls}},digits:{type:[String,Number],default:function(){return(0,_ui.getConfig)().numberInput.digits}},prefixIcon:String,suffixIcon:String,maxlength:[String,Number],autocomplete:String},inject:{$xeForm:{default:null},formItemInfo:{from:"xeFormItemInfo",default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{isActivated:!1,inputValue:""},internalData:{dnTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeFormReadonly:function(){var e=this.$xeForm,t=this.readonly;return null===t?!!e&&e.readonly:t},computeIsDisabled:function(){var e=this.$xeForm,t=this.disabled;return null===t?!!e&&e.disabled:t},computeDigitsValue:function(){return _xeUtils.default.toInteger(this.digits)||1},computeStepValue:function(){var e=this.type,t=this.computeDigitsValue,n=this.step;return"integer"===e?_xeUtils.default.toInteger(n)||1:"float"===e?_xeUtils.default.toNumber(n)||1/Math.pow(10,t):_xeUtils.default.toNumber(n)||1},computeIsClearable:function(){return this.clearable},computeInputReadonly:function(){var e=this.multiple;return this.computeFormReadonly||e},computeInpPlaceholder:function(){var e=this.placeholder;return(e=e||(0,_ui.getConfig)().numberInput.placeholder)?(0,_utils.getFuncText)(e):(0,_ui.getI18n)("vxe.base.pleaseInput")},computeInpMaxLength:function(){var e=this.maxLength,t=this.maxlength;return _xeUtils.default.toNumber(e||t)||16},computeInpImmediate:function(){var e=this.type;return this.immediate||!("number"===e||"integer"===e||"float"===e)},computeNumValue:function(){var e=this.reactData,t=this.type,e=e.inputValue;return"integer"===t?_xeUtils.default.toInteger((0,_util.handleNumber)(e)):_xeUtils.default.toNumber((0,_util.handleNumber)(e))},computeNumLabel:function(){var e=this.reactData.inputValue;return _xeUtils.default.toString(e)},computeIsDisabledSubtractNumber:function(){var e=this.reactData,t=this.min,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n<=_xeUtils.default.toNumber(t)},computeIsDisabledAddNumber:function(){var e=this.reactData,t=this.max,e=e.inputValue,n=this.computeNumValue;return!(!e&&0!==e||null===t)&&n>=_xeUtils.default.toNumber(t)}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$numberInput:this},t))},emitModel:function(e){var t=this._events;t&&t.modelValue?this.$emit("modelValue",e):this.$emit("model-value",e)},focus:function(){var e=this.reactData,t=this.$refs.refInputTarget;return e.isActivated=!0,t.focus(),this.$nextTick()},blur:function(){var e=this.reactData;return this.$refs.refInputTarget.blur(),e.isActivated=!1,this.$nextTick()},select:function(){var e=this.reactData;return this.$refs.refInputTarget.select(),e.isActivated=!1,this.$nextTick()},getNumberValue:function(e){var t=this.type,n=this.exponential,i=this.computeInpMaxLength,u=this.computeDigitsValue,t="float"===t?(0,_util.toFloatValueFixed)(e,u):handleNumberString(e);return!n||e!==t&&handleNumberString(e).toLowerCase()!==_xeUtils.default.toNumber(t).toExponential()?t.slice(0,i):e},triggerEvent:function(e){var t=this.reactData.inputValue;this.dispatchEvent(e.type,{value:t},e)},handleChange:function(e,t,n){var i=this,u=i,a=i.reactData,r=i.$xeForm,l=i.formItemInfo,e=(0,_utils.eqEmptyValue)(e)?null:Number(e),u=e!==u.value;a.inputValue=t||"",u&&i.emitModel(e),a.inputValue!==t&&i.$nextTick(function(){a.inputValue=t||""}),i.dispatchEvent("input",{value:e},n),u&&(i.dispatchEvent("change",{value:e},n),r)&&l&&r.triggerItemEvent(n,l.itemConfig.field,e)},emitInputEvent:function(e,t){var n=this.reactData,i=this.computeInpImmediate,u=""===e||_xeUtils.default.eqNull(e)?null:_xeUtils.default.toNumber(e);n.inputValue=e,i?this.handleChange(u,e,t):this.dispatchEvent("input",{value:u},t)},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.computeInpImmediate||this.triggerEvent(e)},focusEvent:function(e){this.reactData.isActivated=!0,this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("prefix-click",{value:t},e))},clearValueEvent:function(e,t){this.focus(),this.handleChange(null,"",e),this.dispatchEvent("clear",{value:t},e)},clickSuffixEvent:function(e){var t=this.reactData;this.computeIsDisabled||(t=t.inputValue,this.dispatchEvent("suffix-click",{value:t},e))},initValue:function(){var e,t=this.reactData,n=this.type,t=t.inputValue,i=this.computeDigitsValue;"float"===n&&t&&(n="",e=null,t&&(n=(0,_util.toFloatValueFixed)(t,i),e=Number(n)),t!==e)&&this.handleChange(e,n,{type:"init"})},validMaxNum:function(e){return null===this.max||_xeUtils.default.toNumber(e)<=_xeUtils.default.toNumber(this.max)},validMinNum:function(e){return null===this.min||_xeUtils.default.toNumber(e)>=_xeUtils.default.toNumber(this.min)},afterCheckValue:function(){var e,t,n=this,i=n.reactData,u=n.type,a=n.min,r=n.max,l=n.exponential,i=i.inputValue;n.computeInputReadonly||((0,_utils.eqEmptyValue)(i)?(e=null,t=i,!a&&0!==a||(e=_xeUtils.default.toNumber(a),t="".concat(e)),n.handleChange(e,"".concat(t||""),{type:"check"})):(i||a||r)&&(e="integer"===u?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),n.validMinNum(e)?n.validMaxNum(e)||(e=r):e=a,l&&(t=handleNumberString(i).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=t),u=n.getNumberValue(e),n.handleChange((0,_utils.eqEmptyValue)(u)?null:Number(u),u,{type:"check"})))},blurEvent:function(e){var t=this,n=t.reactData,i=t.$xeForm,u=t.formItemInfo,a=n.inputValue,r=t.computeInpImmediate,l=a?Number(a):null;r||t.handleChange(l,handleNumberString(a),e),t.afterCheckValue(),n.isActivated=!1,t.dispatchEvent("blur",{value:l},e),i&&u&&i.triggerItemEvent(e,u.itemConfig.field,l)},numberChange:function(e,t){var n=this,i=n.reactData,u=n.min,a=n.max,i=i.inputValue,r=n.computeStepValue,i="integer"===n.type?_xeUtils.default.toInteger((0,_util.handleNumber)(i)):_xeUtils.default.toNumber((0,_util.handleNumber)(i)),e=e?_xeUtils.default.add(i,r):_xeUtils.default.subtract(i,r),i=n.validMinNum(e)?n.validMaxNum(e)?e:a:u;n.emitInputEvent(n.getNumberValue(i),t)},numberNextEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,a=t.computeIsDisabledSubtractNumber;t.numberStopDown(),i||u||a||t.numberChange(!1,e),t.dispatchEvent("next-number",{value:n.inputValue},e)},numberDownNextEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberPrevEvent:function(e){var t=this,n=t.reactData,i=t.computeIsDisabled,u=t.computeFormReadonly,a=t.computeIsDisabledAddNumber;t.numberStopDown(),i||u||a||t.numberChange(!0,e),t.dispatchEvent("prev-number",{value:n.inputValue},e)},numberKeydownEvent:function(e){var t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);(t||n)&&(e.preventDefault(),t?this.numberPrevEvent(e):this.numberNextEvent(e))},keydownEvent:function(e){var t=this.exponential,n=this.controls,i=e.ctrlKey,u=e.shiftKey,a=e.altKey,r=e.keyCode,l=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),s=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);i||u||a||!(_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.SPACEBAR)||(!t||69!==r)&&65<=r&&r<=90||186<=r&&r<=188||191<=r)||e.preventDefault(),l?this.afterCheckValue():(o||s)&&n&&this.numberKeydownEvent(e),this.triggerEvent(e)},keyupEvent:function(e){this.triggerEvent(e)},numberStopDown:function(){var e=this.internalData,t=e.dnTimeout;t&&(clearTimeout(t),e.dnTimeout=void 0)},numberDownPrevEvent:function(e){var t=this;t.internalData.dnTimeout=window.setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberMousedownEvent:function(e){var t,n=this,i=n.internalData;n.numberStopDown(),0===e.button&&((t=(0,_dom.hasClass)(e.currentTarget,"is--prev"))?n.numberPrevEvent(e):n.numberNextEvent(e),i.dnTimeout=window.setTimeout(function(){t?n.numberDownPrevEvent(e):n.numberDownNextEvent(e)},500))},wheelEvent:function(e){var t=this,n=t.reactData;t.controls&&n.isActivated&&(0<(n=e.deltaY)?t.numberNextEvent(e):n<0&&t.numberPrevEvent(e),e.preventDefault()),t.triggerEvent(e)},clickEvent:function(e){this.triggerEvent(e)},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=n.isActivated,u=t.$refs.refElem,a=t.$refs.refInputPanel;!t.computeIsDisabled&&i&&(n.isActivated=(0,_dom.getEventTargetNode)(e,u).flag||(0,_dom.getEventTargetNode)(e,a).flag,n.isActivated||t.afterCheckValue())},handleGlobalKeydownEvent:function(e){var t,n,i,u=this,a=u.reactData,r=u.clearable;u.computeIsDisabled||(t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.TAB),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.DELETE),i=a.isActivated,t&&(i&&u.afterCheckValue(),a.isActivated=i=!1),n&&r&&i&&u.clearValueEvent(e,null))},handleGlobalBlurEvent:function(){this.reactData.isActivated&&this.afterCheckValue()},renderNumberIcon:function(e){var t=this,n=t.computeIsDisabledAddNumber,i=t.computeIsDisabledSubtractNumber;return e("div",{class:"vxe-input--control-icon"},[e("div",{class:"vxe-input--number-icon"},[e("div",{class:["vxe-input--number-btn is--prev",{"is--disabled":n}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_PREV_NUM})]),e("div",{class:["vxe-input--number-btn is--next",{"is--disabled":i}],on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:(0,_ui.getIcon)().NUMBER_INPUT_NEXT_NUM})])])])},renderPrefixIcon:function(e){var t=this.$scopedSlots,n=this.prefixIcon,t=t.prefix;return t||n?e("div",{class:"vxe-number-input--prefix",on:{click:this.clickPrefixEvent}},[e("div",{class:"vxe-number-input--prefix-icon"},t?(0,_vn.getSlotVNs)(t({})):[e("i",{class:n})])]):null},renderSuffixIcon:function(e){var t=this,n=t.$scopedSlots,i=t.suffixIcon,u=t.reactData.inputValue,n=n.suffix,a=t.computeIsClearable;return e("div",{class:["vxe-number-input--suffix",{"is--clear":a&&!t.computeIsDisabled&&!(""===u||_xeUtils.default.eqNull(u))}]},[a?e("div",{class:"vxe-number-input--clear-icon",on:{click:t.clearValueEvent}},[e("i",{class:(0,_ui.getIcon)().INPUT_CLEAR})]):(0,_ui.renderEmptyElement)(t),t.renderExtraSuffixIcon(e),n||i?e("div",{class:"vxe-number-input--suffix-icon",on:{click:t.clickSuffixEvent}},n?(0,_vn.getSlotVNs)(n({})):[e("i",{class:i})]):(0,_ui.renderEmptyElement)(t)])},renderExtraSuffixIcon:function(e){return this.controls?this.renderNumberIcon(e):(0,_ui.renderEmptyElement)(this)},renderVN:function(e){var t,n,i,u,a,r=this,l=r.reactData,o=r.className,s=r.controls,c=r.type,m=r.align,d=r.name,p=r.autocomplete,f=r.autoComplete,v=l.inputValue,l=l.isActivated,h=r.computeSize,b=r.computeIsDisabled,_=r.computeNumLabel;return r.computeFormReadonly?e("div",{ref:"refElem",class:["vxe-number-input--readonly","type--".concat(c),o]},_):(_=r.computeInputReadonly,t=r.computeInpMaxLength,n=r.computeInpPlaceholder,i=r.computeIsClearable,u=r.renderPrefixIcon(e),a=r.renderSuffixIcon(e),e("div",{ref:"refElem",class:["vxe-number-input","type--".concat(c),o,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(h),h),"is--".concat(m),m),"is--controls",s),"is--prefix",!!u),"is--suffix",!!a),"is--disabled",b),"is--active",l),"show--clear",i&&!b&&!(""===v||_xeUtils.default.eqNull(v)))],attrs:{spellcheck:!1}},[u||(0,_ui.renderEmptyElement)(r),e("div",{class:"vxe-number-input--wrapper"},[e("input",{ref:"refInputTarget",class:"vxe-number-input--inner",domProps:{value:v},attrs:{name:d,type:"text",placeholder:n,maxlength:t,readonly:_,disabled:b,autocomplete:f||p},on:{keydown:r.keydownEvent,keyup:r.keyupEvent,wheel:r.wheelEvent,click:r.clickEvent,input:r.inputEvent,change:r.changeEvent,focus:r.focusEvent,blur:r.blurEvent}})]),a||(0,_ui.renderEmptyElement)(r)]))}},watch:{value:function(e){this.reactData.inputValue=e},type:function(){var e=this.reactData;Object.assign(e,{inputValue:this.value}),this.initValue()}},created:function(){this.reactData.inputValue=this.value,this.initValue()},mounted:function(){var e=this;_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"keydown",e.handleGlobalKeydownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this;e.numberStopDown(),e.afterCheckValue(),_ui.globalEvents.off(e,"mousedown"),_ui.globalEvents.off(e,"keydown"),_ui.globalEvents.off(e,"blur")},render:function(e){return this.renderVN(e)}});