@fmdeui/fmui 1.0.153 → 1.0.155

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.
@@ -18,15 +18,15 @@ export declare const FmInputNumber: {
18
18
  default: number;
19
19
  };
20
20
  modelValue: {
21
- type: PropType<string | number>;
21
+ type: PropType<number>;
22
22
  required: true;
23
23
  };
24
24
  }>> & Readonly<{
25
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
25
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
26
26
  onHandleInput?: ((...args: any[]) => any) | undefined;
27
27
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
28
28
  handleInput: (...args: any[]) => void;
29
- "update:modelValue": (value: string | number) => void;
29
+ "update:modelValue": (value: number) => void;
30
30
  }, PublicProps, {
31
31
  defaultValue: number;
32
32
  placeholder: string;
@@ -57,11 +57,11 @@ export declare const FmInputNumber: {
57
57
  default: number;
58
58
  };
59
59
  modelValue: {
60
- type: PropType<string | number>;
60
+ type: PropType<number>;
61
61
  required: true;
62
62
  };
63
63
  }>> & Readonly<{
64
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
64
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
65
65
  onHandleInput?: ((...args: any[]) => any) | undefined;
66
66
  }>, {}, {}, {}, {}, {
67
67
  defaultValue: number;
@@ -90,15 +90,15 @@ export declare const FmInputNumber: {
90
90
  default: number;
91
91
  };
92
92
  modelValue: {
93
- type: PropType<string | number>;
93
+ type: PropType<number>;
94
94
  required: true;
95
95
  };
96
96
  }>> & Readonly<{
97
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
97
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
98
98
  onHandleInput?: ((...args: any[]) => any) | undefined;
99
99
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
100
100
  handleInput: (...args: any[]) => void;
101
- "update:modelValue": (value: string | number) => void;
101
+ "update:modelValue": (value: number) => void;
102
102
  }, string, {
103
103
  defaultValue: number;
104
104
  placeholder: string;
@@ -32,12 +32,12 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
32
32
  default: number;
33
33
  };
34
34
  modelValue: {
35
- type: PropType<string | number>;
35
+ type: PropType<number>;
36
36
  required: true;
37
37
  };
38
38
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
39
39
  handleInput: (...args: any[]) => void;
40
- "update:modelValue": (value: string | number) => void;
40
+ "update:modelValue": (value: number) => void;
41
41
  }, string, PublicProps, Readonly< ExtractPropTypes<{
42
42
  placeholder: {
43
43
  type: StringConstructor;
@@ -59,11 +59,11 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
59
59
  default: number;
60
60
  };
61
61
  modelValue: {
62
- type: PropType<string | number>;
62
+ type: PropType<number>;
63
63
  required: true;
64
64
  };
65
65
  }>> & Readonly<{
66
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
66
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
67
67
  onHandleInput?: ((...args: any[]) => any) | undefined;
68
68
  }>, {
69
69
  defaultValue: number;
@@ -35,77 +35,36 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
35
35
  const handleInput = (val) => {
36
36
  if (val === "" || val === null || val === void 0) {
37
37
  const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
38
- modelValue.value = validNum;
39
38
  emit("handleInput", validNum);
40
39
  return;
41
40
  }
42
- let strVal = String(val);
43
- strVal = strVal.replace(/[^\d.-]/g, "");
44
- if (strVal.indexOf("-") !== -1) {
45
- if (!strVal.startsWith("-")) {
46
- strVal = strVal.replace(/-/g, "");
47
- } else {
48
- const rest = strVal.substring(1);
49
- if (rest.includes("-")) {
50
- strVal = "-" + rest.replace(/-/g, "");
51
- }
52
- }
53
- }
54
- const dotCount = (strVal.match(/\./g) || []).length;
55
- if (dotCount > 1) {
56
- const firstDotIndex = strVal.indexOf(".");
57
- const before = strVal.substring(0, firstDotIndex + 1);
58
- const after = strVal.substring(firstDotIndex + 1).replace(/\./g, "");
59
- strVal = before + after;
60
- }
61
- let sign = "";
62
- let body = strVal;
63
- if (body.startsWith("-")) {
64
- sign = "-";
65
- body = body.substring(1);
66
- }
67
- if (body === "") {
68
- modelValue.value = sign;
69
- emit("handleInput", sign);
41
+ if (props.bType == "number") {
42
+ let trimstr = String(val).replace(/[^\d]/g, "");
43
+ const num = parseInt(trimstr, 10);
44
+ const validNum = Number.isNaN(num) ? props.defaultValue : num;
45
+ modelValue.value = validNum;
46
+ emit("handleInput", validNum);
70
47
  return;
71
48
  }
72
- if (body.startsWith(".")) {
73
- body = "0" + body;
74
- }
75
- const parts = body.split(".");
76
- let intPart = parts[0];
77
- let decPart = parts.length > 1 ? parts[1] : "";
78
- intPart = intPart.replace(/^0+/, "") || "0";
79
- if (props.bType === "number") {
80
- decPart = "";
81
- } else {
82
- if (decPart.length > props.decimalPlaces) {
83
- decPart = decPart.substring(0, props.decimalPlaces);
84
- }
85
- }
86
- let finalStr = sign + intPart;
87
- if (decPart !== "") {
88
- finalStr += "." + decPart;
89
- }
90
- modelValue.value = finalStr;
91
- if (finalStr === "" || finalStr === "-" || finalStr === "-.") {
92
- finalStr = "0";
49
+ if (val === "" || val === null || val === void 0) {
50
+ const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
51
+ emit("handleInput", validNum);
93
52
  }
94
- emit("handleInput", finalStr);
53
+ emit("handleInput", val);
95
54
  };
96
55
  watch(() => modelValue.value, (newvalue, oldValue) => {
97
- if (newvalue == "" || newvalue === "-" || newvalue === "-.") {
56
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
98
57
  modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
99
58
  }
100
59
  });
101
60
  return (_ctx, _cache) => {
102
- const _component_el_input = resolveComponent("el-input");
103
- return openBlock(), createBlock(_component_el_input, {
61
+ const _component_el_input_number = resolveComponent("el-input-number");
62
+ return openBlock(), createBlock(_component_el_input_number, {
104
63
  modelValue: modelValue.value,
105
64
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
65
+ controls: false,
106
66
  placeholder: __props.placeholder,
107
- onInput: handleInput,
108
- type: "text"
67
+ onInput: handleInput
109
68
  }, createSlots({
110
69
  _: 2
111
70
  /* DYNAMIC */
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.153 */
1
+ /*! fmdeui-fmui v1.0.155 */
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) :
@@ -27433,77 +27433,36 @@
27433
27433
  const handleInput = (val) => {
27434
27434
  if (val === "" || val === null || val === void 0) {
27435
27435
  const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
27436
- modelValue.value = validNum;
27437
27436
  emit("handleInput", validNum);
27438
27437
  return;
27439
27438
  }
27440
- let strVal = String(val);
27441
- strVal = strVal.replace(/[^\d.-]/g, "");
27442
- if (strVal.indexOf("-") !== -1) {
27443
- if (!strVal.startsWith("-")) {
27444
- strVal = strVal.replace(/-/g, "");
27445
- } else {
27446
- const rest = strVal.substring(1);
27447
- if (rest.includes("-")) {
27448
- strVal = "-" + rest.replace(/-/g, "");
27449
- }
27450
- }
27451
- }
27452
- const dotCount = (strVal.match(/\./g) || []).length;
27453
- if (dotCount > 1) {
27454
- const firstDotIndex = strVal.indexOf(".");
27455
- const before = strVal.substring(0, firstDotIndex + 1);
27456
- const after = strVal.substring(firstDotIndex + 1).replace(/\./g, "");
27457
- strVal = before + after;
27458
- }
27459
- let sign = "";
27460
- let body = strVal;
27461
- if (body.startsWith("-")) {
27462
- sign = "-";
27463
- body = body.substring(1);
27464
- }
27465
- if (body === "") {
27466
- modelValue.value = sign;
27467
- emit("handleInput", sign);
27439
+ if (props.bType == "number") {
27440
+ let trimstr = String(val).replace(/[^\d]/g, "");
27441
+ const num = parseInt(trimstr, 10);
27442
+ const validNum = Number.isNaN(num) ? props.defaultValue : num;
27443
+ modelValue.value = validNum;
27444
+ emit("handleInput", validNum);
27468
27445
  return;
27469
27446
  }
27470
- if (body.startsWith(".")) {
27471
- body = "0" + body;
27472
- }
27473
- const parts = body.split(".");
27474
- let intPart = parts[0];
27475
- let decPart = parts.length > 1 ? parts[1] : "";
27476
- intPart = intPart.replace(/^0+/, "") || "0";
27477
- if (props.bType === "number") {
27478
- decPart = "";
27479
- } else {
27480
- if (decPart.length > props.decimalPlaces) {
27481
- decPart = decPart.substring(0, props.decimalPlaces);
27482
- }
27483
- }
27484
- let finalStr = sign + intPart;
27485
- if (decPart !== "") {
27486
- finalStr += "." + decPart;
27487
- }
27488
- modelValue.value = finalStr;
27489
- if (finalStr === "" || finalStr === "-" || finalStr === "-.") {
27490
- finalStr = "0";
27447
+ if (val === "" || val === null || val === void 0) {
27448
+ const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
27449
+ emit("handleInput", validNum);
27491
27450
  }
27492
- emit("handleInput", finalStr);
27451
+ emit("handleInput", val);
27493
27452
  };
27494
27453
  vue.watch(() => modelValue.value, (newvalue, oldValue) => {
27495
- if (newvalue == "" || newvalue === "-" || newvalue === "-.") {
27454
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
27496
27455
  modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
27497
27456
  }
27498
27457
  });
27499
27458
  return (_ctx, _cache) => {
27500
- const _component_el_input = vue.resolveComponent("el-input");
27501
- return vue.openBlock(), vue.createBlock(_component_el_input, {
27459
+ const _component_el_input_number = vue.resolveComponent("el-input-number");
27460
+ return vue.openBlock(), vue.createBlock(_component_el_input_number, {
27502
27461
  modelValue: modelValue.value,
27503
27462
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
27463
+ controls: false,
27504
27464
  placeholder: __props.placeholder,
27505
- onInput: handleInput,
27506
- type: "text"
27465
+ onInput: handleInput
27507
27466
  }, vue.createSlots({
27508
27467
  _: 2
27509
27468
  /* DYNAMIC */