@fmdeui/fmui 1.0.151 → 1.0.152

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.
@@ -43,11 +43,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
43
43
  const isNegative = strVal.startsWith("-");
44
44
  let pureVal = isNegative ? strVal.substring(1) : strVal;
45
45
  if (props.bType == "number") {
46
- let trimstr = pureVal.replace(/[^\d]/g, "");
46
+ const match = pureVal.match(/^-?\d*/);
47
+ let trimstr = match ? match[0] : "";
48
+ if (trimstr === "-") {
49
+ modelValue.value = trimstr;
50
+ emit("handleInput", 0);
51
+ return;
52
+ }
47
53
  const num = parseInt(trimstr, 10);
48
54
  const validNum = Number.isNaN(num) ? props.defaultValue : num;
49
- modelValue.value = isNegative ? -validNum : validNum;
50
- emit("handleInput", isNegative ? -validNum : validNum);
55
+ modelValue.value = validNum;
56
+ emit("handleInput", validNum);
51
57
  return;
52
58
  }
53
59
  let cleaned = pureVal.replace(/[^\d.]/g, "");
@@ -67,8 +73,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
67
73
  const [intPart, decPart] = cleaned.split(".");
68
74
  cleaned = `${intPart}.${decPart.substring(0, props.decimalPlaces)}`;
69
75
  }
70
- modelValue.value = isNegative ? -cleaned : cleaned;
71
- emit("handleInput", isNegative ? -cleaned : cleaned);
76
+ if (isNegative) {
77
+ if (cleaned === "" || cleaned === "0") {
78
+ cleaned = cleaned === "" ? "-" : pureVal === "-0" ? "-0" : "0";
79
+ if (pureVal === "-") cleaned = "-";
80
+ } else {
81
+ cleaned = "-" + cleaned;
82
+ }
83
+ }
84
+ if (cleaned === "-.") {
85
+ cleaned = "-0.";
86
+ }
87
+ modelValue.value = cleaned;
88
+ const numValue = Number(cleaned);
89
+ const finalNum = Number.isNaN(numValue) ? props.defaultValue !== -1 ? props.defaultValue : 0 : numValue;
90
+ emit("handleInput", finalNum);
72
91
  };
73
92
  watch(() => modelValue.value, (newvalue, oldValue) => {
74
93
  if (newvalue == "") {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.151 */
1
+ /*! fmdeui-fmui v1.0.152 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('exceljs'), require('@element-plus/icons-vue'), require('vue'), require('element-plus'), require('lodash-es'), require('js-cookie'), require('pinia'), require('vue-router'), require('@vueuse/core'), require('crypto-js'), require('xlsx-js-style'), require('vue-i18n'), require('sortablejs'), require('screenfull'), require('push.js'), require('mitt'), require('@microsoft/signalr'), require('axios')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'exceljs', '@element-plus/icons-vue', 'vue', 'element-plus', 'lodash-es', 'js-cookie', 'pinia', 'vue-router', '@vueuse/core', 'crypto-js', 'xlsx-js-style', 'vue-i18n', 'sortablejs', 'screenfull', 'push.js', 'mitt', '@microsoft/signalr', 'axios'], factory) :
@@ -27440,11 +27440,17 @@
27440
27440
  const isNegative = strVal.startsWith("-");
27441
27441
  let pureVal = isNegative ? strVal.substring(1) : strVal;
27442
27442
  if (props.bType == "number") {
27443
- let trimstr = pureVal.replace(/[^\d]/g, "");
27443
+ const match = pureVal.match(/^-?\d*/);
27444
+ let trimstr = match ? match[0] : "";
27445
+ if (trimstr === "-") {
27446
+ modelValue.value = trimstr;
27447
+ emit("handleInput", 0);
27448
+ return;
27449
+ }
27444
27450
  const num = parseInt(trimstr, 10);
27445
27451
  const validNum = Number.isNaN(num) ? props.defaultValue : num;
27446
- modelValue.value = isNegative ? -validNum : validNum;
27447
- emit("handleInput", isNegative ? -validNum : validNum);
27452
+ modelValue.value = validNum;
27453
+ emit("handleInput", validNum);
27448
27454
  return;
27449
27455
  }
27450
27456
  let cleaned = pureVal.replace(/[^\d.]/g, "");
@@ -27464,8 +27470,21 @@
27464
27470
  const [intPart, decPart] = cleaned.split(".");
27465
27471
  cleaned = `${intPart}.${decPart.substring(0, props.decimalPlaces)}`;
27466
27472
  }
27467
- modelValue.value = isNegative ? -cleaned : cleaned;
27468
- emit("handleInput", isNegative ? -cleaned : cleaned);
27473
+ if (isNegative) {
27474
+ if (cleaned === "" || cleaned === "0") {
27475
+ cleaned = cleaned === "" ? "-" : pureVal === "-0" ? "-0" : "0";
27476
+ if (pureVal === "-") cleaned = "-";
27477
+ } else {
27478
+ cleaned = "-" + cleaned;
27479
+ }
27480
+ }
27481
+ if (cleaned === "-.") {
27482
+ cleaned = "-0.";
27483
+ }
27484
+ modelValue.value = cleaned;
27485
+ const numValue = Number(cleaned);
27486
+ const finalNum = Number.isNaN(numValue) ? props.defaultValue !== -1 ? props.defaultValue : 0 : numValue;
27487
+ emit("handleInput", finalNum);
27469
27488
  };
27470
27489
  vue.watch(() => modelValue.value, (newvalue, oldValue) => {
27471
27490
  if (newvalue == "") {