vxe-pc-ui 3.3.18 → 3.3.20

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 (38) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/number-input/src/number-input.js +26 -5
  3. package/es/pulldown/src/pulldown.js +7 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/icon/style/style.css +1 -1
  9. package/lib/icon/style/style.min.css +1 -1
  10. package/lib/index.umd.js +46 -17
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/number-input/src/number-input.js +37 -14
  13. package/lib/number-input/src/number-input.min.js +1 -1
  14. package/lib/pulldown/src/pulldown.js +7 -1
  15. package/lib/pulldown/src/pulldown.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/style.min.css +1 -1
  18. package/lib/ui/index.js +1 -1
  19. package/lib/ui/index.min.js +1 -1
  20. package/lib/ui/src/log.js +1 -1
  21. package/lib/ui/src/log.min.js +1 -1
  22. package/package.json +2 -2
  23. package/packages/number-input/src/number-input.ts +27 -5
  24. package/packages/pulldown/src/pulldown.ts +7 -1
  25. package/types/components/pulldown.d.ts +6 -1
  26. package/types/components/table.d.ts +18 -2
  27. /package/es/icon/{iconfont.1733331629052.ttf → iconfont.1733393122834.ttf} +0 -0
  28. /package/es/icon/{iconfont.1733331629052.woff → iconfont.1733393122834.woff} +0 -0
  29. /package/es/icon/{iconfont.1733331629052.woff2 → iconfont.1733393122834.woff2} +0 -0
  30. /package/es/{iconfont.1733331629052.ttf → iconfont.1733393122834.ttf} +0 -0
  31. /package/es/{iconfont.1733331629052.woff → iconfont.1733393122834.woff} +0 -0
  32. /package/es/{iconfont.1733331629052.woff2 → iconfont.1733393122834.woff2} +0 -0
  33. /package/lib/icon/style/{iconfont.1733331629052.ttf → iconfont.1733393122834.ttf} +0 -0
  34. /package/lib/icon/style/{iconfont.1733331629052.woff → iconfont.1733393122834.woff} +0 -0
  35. /package/lib/icon/style/{iconfont.1733331629052.woff2 → iconfont.1733393122834.woff2} +0 -0
  36. /package/lib/{iconfont.1733331629052.ttf → iconfont.1733393122834.ttf} +0 -0
  37. /package/lib/{iconfont.1733331629052.woff → iconfont.1733393122834.woff} +0 -0
  38. /package/lib/{iconfont.1733331629052.woff2 → iconfont.1733393122834.woff2} +0 -0
@@ -16,6 +16,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
16
16
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
18
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
+ var handleNumberString = function handleNumberString(val) {
20
+ if (_xeUtils.default.eqNull(val)) {
21
+ return '';
22
+ }
23
+ return "".concat(val);
24
+ };
19
25
  var _default2 = exports.default = (0, _comp.defineVxeComponent)({
20
26
  name: 'VxeNumberInput',
21
27
  mixins: [_ui.globalMixins.sizeMixin],
@@ -301,8 +307,8 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
301
307
  exponential = props.exponential;
302
308
  var inpMaxLength = $xeNumberInput.computeInpMaxLength;
303
309
  var digitsValue = $xeNumberInput.computeDigitsValue;
304
- var restVal = type === 'float' ? (0, _util.toFloatValueFixed)(val, digitsValue) : _xeUtils.default.toValueString(val);
305
- if (exponential && (val === restVal || _xeUtils.default.toValueString(val).toLowerCase() === _xeUtils.default.toNumber(restVal).toExponential())) {
310
+ var restVal = type === 'float' ? (0, _util.toFloatValueFixed)(val, digitsValue) : handleNumberString(val);
311
+ if (exponential && (val === restVal || handleNumberString(val).toLowerCase() === _xeUtils.default.toNumber(restVal).toExponential())) {
306
312
  return val;
307
313
  }
308
314
  return restVal.slice(0, inpMaxLength);
@@ -323,10 +329,15 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
323
329
  var formItemInfo = $xeNumberInput.formItemInfo;
324
330
  var value = val === '' || _xeUtils.default.eqNull(val) ? null : Number(val);
325
331
  var isChange = value !== props.value;
332
+ reactData.inputValue = inputValue || '';
326
333
  if (isChange) {
327
- reactData.inputValue = inputValue || '';
328
334
  $xeNumberInput.emitModel(value);
329
335
  }
336
+ if (reactData.inputValue !== inputValue) {
337
+ $xeNumberInput.$nextTick(function () {
338
+ reactData.inputValue = inputValue || '';
339
+ });
340
+ }
330
341
  $xeNumberInput.dispatchEvent('input', {
331
342
  value: value
332
343
  }, evnt);
@@ -450,21 +461,33 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
450
461
  var inputValue = reactData.inputValue;
451
462
  var inputReadonly = $xeNumberInput.computeInputReadonly;
452
463
  if (!inputReadonly) {
464
+ if (inputValue === '') {
465
+ var inpNumVal = null;
466
+ var inpValue = inputValue;
467
+ if (min || min === 0) {
468
+ inpNumVal = _xeUtils.default.toNumber(min);
469
+ inpValue = "".concat(inpNumVal);
470
+ }
471
+ $xeNumberInput.handleChange(inpNumVal, inpValue, {
472
+ type: 'check'
473
+ });
474
+ return;
475
+ }
453
476
  if (inputValue || min || max) {
454
- var inpNumVal = type === 'integer' ? _xeUtils.default.toInteger((0, _util.handleNumber)(inputValue)) : _xeUtils.default.toNumber((0, _util.handleNumber)(inputValue));
455
- if (!$xeNumberInput.validMinNum(inpNumVal)) {
456
- inpNumVal = min;
457
- } else if (!$xeNumberInput.validMaxNum(inpNumVal)) {
458
- inpNumVal = max;
477
+ var _inpNumVal = type === 'integer' ? _xeUtils.default.toInteger((0, _util.handleNumber)(inputValue)) : _xeUtils.default.toNumber((0, _util.handleNumber)(inputValue));
478
+ if (!$xeNumberInput.validMinNum(_inpNumVal)) {
479
+ _inpNumVal = min;
480
+ } else if (!$xeNumberInput.validMaxNum(_inpNumVal)) {
481
+ _inpNumVal = max;
459
482
  }
460
483
  if (exponential) {
461
- var inpStringVal = _xeUtils.default.toValueString(inputValue).toLowerCase();
462
- if (inpStringVal === _xeUtils.default.toNumber(inpNumVal).toExponential()) {
463
- inpNumVal = inpStringVal;
484
+ var inpStringVal = handleNumberString(inputValue).toLowerCase();
485
+ if (inpStringVal === _xeUtils.default.toNumber(_inpNumVal).toExponential()) {
486
+ _inpNumVal = inpStringVal;
464
487
  }
465
488
  }
466
- var inpValue = $xeNumberInput.getNumberValue(inpNumVal);
467
- $xeNumberInput.handleChange(inpValue === null ? null : Number(inpValue), inpValue, {
489
+ var _inpValue = $xeNumberInput.getNumberValue(_inpNumVal);
490
+ $xeNumberInput.handleChange(_inpValue === null ? null : Number(_inpValue), _inpValue, {
468
491
  type: 'check'
469
492
  });
470
493
  }
@@ -479,7 +502,7 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
479
502
  var inpImmediate = $xeNumberInput.computeInpImmediate;
480
503
  var value = inputValue ? Number(inputValue) : null;
481
504
  if (!inpImmediate) {
482
- $xeNumberInput.handleChange(value, "".concat(inputValue || ''), evnt);
505
+ $xeNumberInput.handleChange(value, handleNumberString(inputValue), evnt);
483
506
  }
484
507
  $xeNumberInput.afterCheckValue();
485
508
  reactData.isActivated = false;
@@ -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 _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):_xeUtils.default.toValueString(e);return!n||e!==t&&_xeUtils.default.toValueString(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;u&&(a.inputValue=t||"",i.emitModel(e)),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=this,t=e.reactData,n=e.type,i=e.min,u=e.max,a=e.exponential,t=t.inputValue;e.computeInputReadonly||(t||i||u)&&(n="integer"===n?_xeUtils.default.toInteger((0,_util.handleNumber)(t)):_xeUtils.default.toNumber((0,_util.handleNumber)(t)),e.validMinNum(n)?e.validMaxNum(n)||(n=u):n=i,a&&(u=_xeUtils.default.toValueString(t).toLowerCase())===_xeUtils.default.toNumber(n).toExponential()&&(n=u),i=e.getNumberValue(n),e.handleChange(null===i?null:Number(i),i,{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,"".concat(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=""===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)}});
@@ -298,8 +298,12 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
298
298
  },
299
299
  handleOptionEvent: function handleOptionEvent(evnt, option) {
300
300
  var $xePulldown = this;
301
+ var reactData = $xePulldown.reactData;
301
302
  if (!option.disabled) {
302
- $xePulldown.hidePanel();
303
+ if (reactData.visiblePanel) {
304
+ $xePulldown.hidePanel();
305
+ $xePulldown.dispatchEvent('hide-panel', {}, evnt);
306
+ }
303
307
  $xePulldown.dispatchEvent('option-click', {
304
308
  option: option
305
309
  }, evnt);
@@ -313,8 +317,10 @@ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
313
317
  if (trigger === 'click') {
314
318
  if (reactData.visiblePanel) {
315
319
  $xePulldown.hidePanel();
320
+ $xePulldown.dispatchEvent('hide-panel', {}, evnt);
316
321
  } else {
317
322
  $xePulldown.showPanel();
323
+ $xePulldown.dispatchEvent('show-panel', {}, evnt);
318
324
  }
319
325
  }
320
326
  $xePulldown.dispatchEvent('click', {
@@ -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"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils");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 _default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxePulldown",model:{prop:"value",event:"modelValue"},mixins:[_ui.globalMixins.sizeMixin,_ui.globalMixins.permissionMixin],props:{value:Boolean,disabled:Boolean,placement:String,trigger:{type:String,default:(0,_ui.getConfig)().pulldown.trigger},size:{type:String,default:function(){return(0,_ui.getConfig)().size}},options:Array,className:{type:[String,Function],default:(0,_ui.getConfig)().pulldown.className},popupClassName:[String,Function],showPopupShadow:Boolean,destroyOnClose:{type:Boolean,default:(0,_ui.getConfig)().pulldown.destroyOnClose},transfer:{type:Boolean,default:null}},inject:{$xeModal:{default:null},$xeDrawer:{default:null},$xeTable:{default:null},$xeForm:{default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,panelIndex:0,panelStyle:{},panelPlacement:null,visiblePanel:!1,isAniVisible:!1,isActivated:!1},internalData:{hpTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeBtnTransfer:function(){var e=this,t=e.$xeModal,n=e.$xeDrawer,i=e.$xeTable,l=e.$xeForm,e=e.transfer;if(null===e){var o=(0,_ui.getConfig)().pulldown.transfer;if(_xeUtils.default.isBoolean(o))return o;if(i||t||n||l)return!0}return e}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$pulldown:this},t))},emitModel:function(e){var t=this,n=t._events;n&&n.modelValue?t.$emit("modelValue",e):t.$emit("model-value",e)},updateZindex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},isPanelVisible:function(){return this.reactData.visiblePanel},updatePlacement:function(){var p=this,f=p,v=p.reactData;return p.$nextTick().then(function(){var e,t,n,i,l,o,a,r,u=f.placement,s=v.panelIndex,d=v.visiblePanel,c=p.computeBtnTransfer;return d&&(d=p.$refs.refPulldownContent,i=p.$refs.refPulldownPanel)&&d&&(e=d.offsetHeight,t=d.offsetWidth,n=i.offsetHeight,i=i.offsetWidth,s={zIndex:s},l=(d=(0,_dom.getAbsolutePos)(d)).boundingTop,o=d.visibleHeight,a=d.visibleWidth,r="bottom",c?(c=l+e,"top"===u?(r="top",c=l-n):u||(o<c+n+5&&(r="top",c=l-n),c<5&&(r="bottom",c=l+e)),a<(d=d.boundingLeft)+i+5&&(d-=d+i+5-a),d<5&&(d=5),Object.assign(s,{left:"".concat(d,"px"),top:"".concat(c,"px"),minWidth:"".concat(t,"px")})):"top"===u?(r="top",s.bottom="".concat(e,"px")):u||o<l+e+n&&5<l-e-n&&(r="top",s.bottom="".concat(e,"px")),v.panelStyle=s,v.panelPlacement=r),p.$nextTick()})},showPanel:function(){var t=this,n=t,i=t.reactData,l=t.internalData,e=t.computeBtnTransfer,o=t.$refs.refPulldownPanel;return i.initialized||(i.initialized=!0,e&&o&&document.body.appendChild(o)),new Promise(function(e){n.disabled?t.$nextTick(function(){e()}):(l.hpTimeout&&clearTimeout(l.hpTimeout),i.isActivated=!0,i.isAniVisible=!0,setTimeout(function(){i.visiblePanel=!0,t.emitModel(!0),t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this,n=t.reactData,i=t.internalData;return n.visiblePanel=!1,t.emitModel(!1),new Promise(function(e){n.isAniVisible?i.hpTimeout=window.setTimeout(function(){n.isAniVisible=!1,t.$nextTick(function(){e()})},350):t.$nextTick(function(){e()})})},togglePanel:function(){return this.reactData.visiblePanel?this.hidePanel():this.showPanel()},handleOptionEvent:function(e,t){t.disabled||(this.hidePanel(),this.dispatchEvent("option-click",{option:t},e))},clickTargetEvent:function(e){var t=this,n=t.reactData;"click"===t.trigger&&(n.visiblePanel?t.hidePanel():t.showPanel()),t.dispatchEvent("click",{$pulldown:t},e)},handleGlobalMousewheelEvent:function(e){var t=this,n=t.reactData,i=t.disabled,n=n.visiblePanel,l=t.$refs.refPulldownPanel;i||n&&((0,_dom.getEventTargetNode)(e,l).flag?t.updatePlacement():(t.hidePanel(),t.dispatchEvent("hide-panel",{},e)))},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=t.disabled,l=n.visiblePanel,o=t.$refs.refElem,a=t.$refs.refPulldownPanel;i||(n.isActivated=(0,_dom.getEventTargetNode)(e,o).flag||(0,_dom.getEventTargetNode)(e,a).flag,l&&!n.isActivated&&(t.hidePanel(),t.dispatchEvent("hide-panel",{},e)))},handleGlobalBlurEvent:function(e){var t=this.reactData;t.visiblePanel&&(t.isActivated=!1,this.hidePanel(),this.dispatchEvent("hide-panel",{},e))},renderDefaultPanel:function(e,t){var n=this,i=n.$scopedSlots.option;return e("div",{class:"vxe-pulldown--panel-list"},t?t.map(function(t){return e("div",{class:"vxe-pulldown--panel-item",on:{click:function(e){n.handleOptionEvent(e,t)}}},i?i({$pulldown:n,option:t}):"".concat(t.label||""))}):[])},renderVN:function(e){var t=this,n=t.$scopedSlots,i=t.reactData,l=t.className,o=t.options,a=t.popupClassName,r=t.showPopupShadow,u=t.destroyOnClose,s=t.disabled,d=i.initialized,c=i.isActivated,p=i.isAniVisible,f=i.visiblePanel,v=i.panelStyle,i=i.panelPlacement,m=t.computeBtnTransfer,h=t.computeSize,b=n.default,P=n.header,w=n.footer,n=n.dropdown;return e("div",{ref:"refElem",class:["vxe-pulldown",l?_xeUtils.default.isFunction(l)?l({$pulldown:t}):l:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(h),h),"is--visible",f),"is--disabled",s),"is--active",c)]},[e("div",{ref:"refPulldownContent",class:"vxe-pulldown--content",on:{click:t.clickTargetEvent}},b?b({$pulldown:t}):[]),e("div",{ref:"refPulldownPanel",class:["vxe-table--ignore-clear vxe-pulldown--panel",a?_xeUtils.default.isFunction(a)?a({$pulldown:t}):a:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(h),h),"is--shadow",r),"is--transfer",m),"ani--leave",p),"ani--enter",f)],attrs:{placement:i},style:v},d?[e("div",{class:"vxe-pulldown--panel-wrapper"},d&&(!u||f||p)?[P?e("div",{class:"vxe-pulldown--panel-header"},P({$pulldown:t})):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-pulldown--panel-body"},n?n({$pulldown:t}):[t.renderDefaultPanel(e,o)]),w?e("div",{class:"vxe-pulldown--panel-footer"},w({$pulldown:t})):(0,_ui.renderEmptyElement)(t)]:[])]:[])])}},watch:{value:function(e){this.reactData.isActivated=!!e,e?this.showPanel():this.hidePanel()}},created:function(){var e=this;e.value&&e.showPanel(),_ui.globalEvents.on(e,"mousewheel",e.handleGlobalMousewheelEvent),_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.refPulldownPanel;e&&e.parentNode&&e.parentNode.removeChild(e),_ui.globalEvents.off(this,"mousewheel"),_ui.globalEvents.off(this,"mousedown"),_ui.globalEvents.off(this,"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"),_dom=require("../../ui/src/dom"),_utils=require("../../ui/src/utils");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 _default2=exports.default=(0,_comp.defineVxeComponent)({name:"VxePulldown",model:{prop:"value",event:"modelValue"},mixins:[_ui.globalMixins.sizeMixin,_ui.globalMixins.permissionMixin],props:{value:Boolean,disabled:Boolean,placement:String,trigger:{type:String,default:(0,_ui.getConfig)().pulldown.trigger},size:{type:String,default:function(){return(0,_ui.getConfig)().size}},options:Array,className:{type:[String,Function],default:(0,_ui.getConfig)().pulldown.className},popupClassName:[String,Function],showPopupShadow:Boolean,destroyOnClose:{type:Boolean,default:(0,_ui.getConfig)().pulldown.destroyOnClose},transfer:{type:Boolean,default:null}},inject:{$xeModal:{default:null},$xeDrawer:{default:null},$xeTable:{default:null},$xeForm:{default:null}},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{initialized:!1,panelIndex:0,panelStyle:{},panelPlacement:null,visiblePanel:!1,isAniVisible:!1,isActivated:!1},internalData:{hpTimeout:void 0}}},computed:Object.assign(Object.assign({},{}),{computeBtnTransfer:function(){var e=this,t=e.$xeModal,n=e.$xeDrawer,i=e.$xeTable,l=e.$xeForm,e=e.transfer;if(null===e){var o=(0,_ui.getConfig)().pulldown.transfer;if(_xeUtils.default.isBoolean(o))return o;if(i||t||n||l)return!0}return e}}),methods:{dispatchEvent:function(e,t,n){this.$emit(e,(0,_ui.createEvent)(n,{$pulldown:this},t))},emitModel:function(e){var t=this,n=t._events;n&&n.modelValue?t.$emit("modelValue",e):t.$emit("model-value",e)},updateZindex:function(){var e=this.reactData;e.panelIndex<(0,_utils.getLastZIndex)()&&(e.panelIndex=(0,_utils.nextZIndex)())},isPanelVisible:function(){return this.reactData.visiblePanel},updatePlacement:function(){var p=this,f=p,v=p.reactData;return p.$nextTick().then(function(){var e,t,n,i,l,o,a,r,s=f.placement,u=v.panelIndex,d=v.visiblePanel,c=p.computeBtnTransfer;return d&&(d=p.$refs.refPulldownContent,i=p.$refs.refPulldownPanel)&&d&&(e=d.offsetHeight,t=d.offsetWidth,n=i.offsetHeight,i=i.offsetWidth,u={zIndex:u},l=(d=(0,_dom.getAbsolutePos)(d)).boundingTop,o=d.visibleHeight,a=d.visibleWidth,r="bottom",c?(c=l+e,"top"===s?(r="top",c=l-n):s||(o<c+n+5&&(r="top",c=l-n),c<5&&(r="bottom",c=l+e)),a<(d=d.boundingLeft)+i+5&&(d-=d+i+5-a),d<5&&(d=5),Object.assign(u,{left:"".concat(d,"px"),top:"".concat(c,"px"),minWidth:"".concat(t,"px")})):"top"===s?(r="top",u.bottom="".concat(e,"px")):s||o<l+e+n&&5<l-e-n&&(r="top",u.bottom="".concat(e,"px")),v.panelStyle=u,v.panelPlacement=r),p.$nextTick()})},showPanel:function(){var t=this,n=t,i=t.reactData,l=t.internalData,e=t.computeBtnTransfer,o=t.$refs.refPulldownPanel;return i.initialized||(i.initialized=!0,e&&o&&document.body.appendChild(o)),new Promise(function(e){n.disabled?t.$nextTick(function(){e()}):(l.hpTimeout&&clearTimeout(l.hpTimeout),i.isActivated=!0,i.isAniVisible=!0,setTimeout(function(){i.visiblePanel=!0,t.emitModel(!0),t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this,n=t.reactData,i=t.internalData;return n.visiblePanel=!1,t.emitModel(!1),new Promise(function(e){n.isAniVisible?i.hpTimeout=window.setTimeout(function(){n.isAniVisible=!1,t.$nextTick(function(){e()})},350):t.$nextTick(function(){e()})})},togglePanel:function(){return this.reactData.visiblePanel?this.hidePanel():this.showPanel()},handleOptionEvent:function(e,t){var n=this.reactData;t.disabled||(n.visiblePanel&&(this.hidePanel(),this.dispatchEvent("hide-panel",{},e)),this.dispatchEvent("option-click",{option:t},e))},clickTargetEvent:function(e){var t=this,n=t.reactData;"click"===t.trigger&&(n.visiblePanel?(t.hidePanel(),t.dispatchEvent("hide-panel",{},e)):(t.showPanel(),t.dispatchEvent("show-panel",{},e))),t.dispatchEvent("click",{$pulldown:t},e)},handleGlobalMousewheelEvent:function(e){var t=this,n=t.reactData,i=t.disabled,n=n.visiblePanel,l=t.$refs.refPulldownPanel;i||n&&((0,_dom.getEventTargetNode)(e,l).flag?t.updatePlacement():(t.hidePanel(),t.dispatchEvent("hide-panel",{},e)))},handleGlobalMousedownEvent:function(e){var t=this,n=t.reactData,i=t.disabled,l=n.visiblePanel,o=t.$refs.refElem,a=t.$refs.refPulldownPanel;i||(n.isActivated=(0,_dom.getEventTargetNode)(e,o).flag||(0,_dom.getEventTargetNode)(e,a).flag,l&&!n.isActivated&&(t.hidePanel(),t.dispatchEvent("hide-panel",{},e)))},handleGlobalBlurEvent:function(e){var t=this.reactData;t.visiblePanel&&(t.isActivated=!1,this.hidePanel(),this.dispatchEvent("hide-panel",{},e))},renderDefaultPanel:function(e,t){var n=this,i=n.$scopedSlots.option;return e("div",{class:"vxe-pulldown--panel-list"},t?t.map(function(t){return e("div",{class:"vxe-pulldown--panel-item",on:{click:function(e){n.handleOptionEvent(e,t)}}},i?i({$pulldown:n,option:t}):"".concat(t.label||""))}):[])},renderVN:function(e){var t=this,n=t.$scopedSlots,i=t.reactData,l=t.className,o=t.options,a=t.popupClassName,r=t.showPopupShadow,s=t.destroyOnClose,u=t.disabled,d=i.initialized,c=i.isActivated,p=i.isAniVisible,f=i.visiblePanel,v=i.panelStyle,i=i.panelPlacement,h=t.computeBtnTransfer,m=t.computeSize,b=n.default,P=n.header,w=n.footer,n=n.dropdown;return e("div",{ref:"refElem",class:["vxe-pulldown",l?_xeUtils.default.isFunction(l)?l({$pulldown:t}):l:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(m),m),"is--visible",f),"is--disabled",u),"is--active",c)]},[e("div",{ref:"refPulldownContent",class:"vxe-pulldown--content",on:{click:t.clickTargetEvent}},b?b({$pulldown:t}):[]),e("div",{ref:"refPulldownPanel",class:["vxe-table--ignore-clear vxe-pulldown--panel",a?_xeUtils.default.isFunction(a)?a({$pulldown:t}):a:"",_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"size--".concat(m),m),"is--shadow",r),"is--transfer",h),"ani--leave",p),"ani--enter",f)],attrs:{placement:i},style:v},d?[e("div",{class:"vxe-pulldown--panel-wrapper"},d&&(!s||f||p)?[P?e("div",{class:"vxe-pulldown--panel-header"},P({$pulldown:t})):(0,_ui.renderEmptyElement)(t),e("div",{class:"vxe-pulldown--panel-body"},n?n({$pulldown:t}):[t.renderDefaultPanel(e,o)]),w?e("div",{class:"vxe-pulldown--panel-footer"},w({$pulldown:t})):(0,_ui.renderEmptyElement)(t)]:[])]:[])])}},watch:{value:function(e){this.reactData.isActivated=!!e,e?this.showPanel():this.hidePanel()}},created:function(){var e=this;e.value&&e.showPanel(),_ui.globalEvents.on(e,"mousewheel",e.handleGlobalMousewheelEvent),_ui.globalEvents.on(e,"mousedown",e.handleGlobalMousedownEvent),_ui.globalEvents.on(e,"blur",e.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.refPulldownPanel;e&&e.parentNode&&e.parentNode.removeChild(e),_ui.globalEvents.off(this,"mousewheel"),_ui.globalEvents.off(this,"mousedown"),_ui.globalEvents.off(this,"blur")},render:function(e){return this.renderVN(e)}});