@fmdeui/fmui 1.0.154 → 1.0.156

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;
@@ -107,8 +107,12 @@ export declare const FmInputNumber: {
107
107
  }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
108
108
  $slots: {
109
109
  prepend?(_: {}): any;
110
+ prepend?(_: {}): any;
111
+ append?(_: {}): any;
110
112
  append?(_: {}): any;
111
113
  prefix?(_: {}): any;
114
+ prefix?(_: {}): any;
115
+ suffix?(_: {}): any;
112
116
  suffix?(_: {}): any;
113
117
  };
114
118
  });
@@ -3,8 +3,12 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  prepend?(_: {}): any;
6
+ prepend?(_: {}): any;
7
+ append?(_: {}): any;
6
8
  append?(_: {}): any;
7
9
  prefix?(_: {}): any;
10
+ prefix?(_: {}): any;
11
+ suffix?(_: {}): any;
8
12
  suffix?(_: {}): any;
9
13
  };
10
14
  refs: {};
@@ -32,12 +36,12 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
32
36
  default: number;
33
37
  };
34
38
  modelValue: {
35
- type: PropType<string | number>;
39
+ type: PropType<number>;
36
40
  required: true;
37
41
  };
38
42
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
39
43
  handleInput: (...args: any[]) => void;
40
- "update:modelValue": (value: string | number) => void;
44
+ "update:modelValue": (value: number) => void;
41
45
  }, string, PublicProps, Readonly< ExtractPropTypes<{
42
46
  placeholder: {
43
47
  type: StringConstructor;
@@ -59,11 +63,11 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
59
63
  default: number;
60
64
  };
61
65
  modelValue: {
62
- type: PropType<string | number>;
66
+ type: PropType<number>;
63
67
  required: true;
64
68
  };
65
69
  }>> & Readonly<{
66
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
70
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
67
71
  onHandleInput?: ((...args: any[]) => any) | undefined;
68
72
  }>, {
69
73
  defaultValue: number;
@@ -39,76 +39,95 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
39
39
  emit("handleInput", validNum);
40
40
  return;
41
41
  }
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);
42
+ if (props.bType == "number") {
43
+ let trimstr = String(val).replace(/[^\d]/g, "");
44
+ const num = parseInt(trimstr, 10);
45
+ const validNum = Number.isNaN(num) ? props.defaultValue : num;
46
+ modelValue.value = validNum;
47
+ emit("handleInput", validNum);
70
48
  return;
71
49
  }
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
- }
50
+ let cleaned = String(val).replace(/[^\d.]/g, "");
51
+ const dotIndex = cleaned.indexOf(".");
52
+ if (dotIndex !== -1) {
53
+ const before = cleaned.substring(0, dotIndex + 1);
54
+ const after = cleaned.substring(dotIndex + 1).replace(/\./g, "");
55
+ cleaned = before + after;
85
56
  }
86
- let finalStr = sign + intPart;
87
- if (decPart !== "") {
88
- finalStr += "." + decPart;
57
+ if (cleaned.startsWith(".")) {
58
+ cleaned = "0" + cleaned;
89
59
  }
90
- if (finalStr === "" || finalStr === "-" || finalStr === "-.") {
91
- finalStr = "0";
92
- } else {
93
- modelValue.value = finalStr;
60
+ const parts = cleaned.split(".");
61
+ parts[0] = parts[0].replace(/^0+/, "") || "0";
62
+ cleaned = parts.join(".");
63
+ if (cleaned.includes(".")) {
64
+ const [intPart, decPart] = cleaned.split(".");
65
+ cleaned = `${intPart}.${decPart.substring(0, props.decimalPlaces)}`;
94
66
  }
95
- const numValue = Number(finalStr);
96
- const finalNum = Number.isNaN(numValue) ? props.defaultValue !== -1 ? props.defaultValue : 0 : numValue;
97
- emit("handleInput", finalNum);
67
+ modelValue.value = cleaned;
68
+ emit("handleInput", cleaned);
98
69
  };
99
70
  watch(() => modelValue.value, (newvalue, oldValue) => {
100
- if (newvalue == "" || newvalue === "-" || newvalue === "-.") {
101
- modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
71
+ if (props.bType == "number") {
72
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
73
+ modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
74
+ }
75
+ } else {
76
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
77
+ const validNum = props.defaultValue == -1 ? 0 : props.defaultValue;
78
+ modelValue.value = validNum;
79
+ } else {
80
+ emit("handleInput", newvalue);
81
+ }
102
82
  }
103
83
  });
104
84
  return (_ctx, _cache) => {
105
85
  const _component_el_input = resolveComponent("el-input");
106
- return openBlock(), createBlock(_component_el_input, {
86
+ const _component_el_input_number = resolveComponent("el-input-number");
87
+ return __props.bType !== "money" ? (openBlock(), createBlock(_component_el_input, {
88
+ key: 0,
107
89
  modelValue: modelValue.value,
108
90
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
109
91
  placeholder: __props.placeholder,
110
- onInput: handleInput,
111
- type: "text"
92
+ onInput: handleInput
93
+ }, createSlots({
94
+ _: 2
95
+ /* DYNAMIC */
96
+ }, [
97
+ _ctx.$slots.prepend ? {
98
+ name: "prepend",
99
+ fn: withCtx(() => [
100
+ renderSlot(_ctx.$slots, "prepend")
101
+ ]),
102
+ key: "0"
103
+ } : void 0,
104
+ _ctx.$slots.append ? {
105
+ name: "append",
106
+ fn: withCtx(() => [
107
+ renderSlot(_ctx.$slots, "append")
108
+ ]),
109
+ key: "1"
110
+ } : void 0,
111
+ _ctx.$slots.prefix ? {
112
+ name: "prefix",
113
+ fn: withCtx(() => [
114
+ renderSlot(_ctx.$slots, "prefix")
115
+ ]),
116
+ key: "2"
117
+ } : void 0,
118
+ _ctx.$slots.suffix ? {
119
+ name: "suffix",
120
+ fn: withCtx(() => [
121
+ renderSlot(_ctx.$slots, "suffix")
122
+ ]),
123
+ key: "3"
124
+ } : void 0
125
+ ]), 1032, ["modelValue", "placeholder"])) : (openBlock(), createBlock(_component_el_input_number, {
126
+ key: 1,
127
+ modelValue: modelValue.value,
128
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue.value = $event),
129
+ controls: false,
130
+ placeholder: __props.placeholder
112
131
  }, createSlots({
113
132
  _: 2
114
133
  /* DYNAMIC */
@@ -141,7 +160,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
141
160
  ]),
142
161
  key: "3"
143
162
  } : void 0
144
- ]), 1032, ["modelValue", "placeholder"]);
163
+ ]), 1032, ["modelValue", "placeholder"]));
145
164
  };
146
165
  }
147
166
  });
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.154 */
1
+ /*! fmdeui-fmui v1.0.156 */
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) :
@@ -27437,76 +27437,57 @@
27437
27437
  emit("handleInput", validNum);
27438
27438
  return;
27439
27439
  }
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);
27440
+ if (props.bType == "number") {
27441
+ let trimstr = String(val).replace(/[^\d]/g, "");
27442
+ const num = parseInt(trimstr, 10);
27443
+ const validNum = Number.isNaN(num) ? props.defaultValue : num;
27444
+ modelValue.value = validNum;
27445
+ emit("handleInput", validNum);
27468
27446
  return;
27469
27447
  }
27470
- if (body.startsWith(".")) {
27471
- body = "0" + body;
27448
+ let cleaned = String(val).replace(/[^\d.]/g, "");
27449
+ const dotIndex = cleaned.indexOf(".");
27450
+ if (dotIndex !== -1) {
27451
+ const before = cleaned.substring(0, dotIndex + 1);
27452
+ const after = cleaned.substring(dotIndex + 1).replace(/\./g, "");
27453
+ cleaned = before + after;
27472
27454
  }
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
- }
27455
+ if (cleaned.startsWith(".")) {
27456
+ cleaned = "0" + cleaned;
27483
27457
  }
27484
- let finalStr = sign + intPart;
27485
- if (decPart !== "") {
27486
- finalStr += "." + decPart;
27458
+ const parts = cleaned.split(".");
27459
+ parts[0] = parts[0].replace(/^0+/, "") || "0";
27460
+ cleaned = parts.join(".");
27461
+ if (cleaned.includes(".")) {
27462
+ const [intPart, decPart] = cleaned.split(".");
27463
+ cleaned = `${intPart}.${decPart.substring(0, props.decimalPlaces)}`;
27487
27464
  }
27488
- if (finalStr === "" || finalStr === "-" || finalStr === "-.") {
27489
- finalStr = "0";
27490
- } else {
27491
- modelValue.value = finalStr;
27492
- }
27493
- const numValue = Number(finalStr);
27494
- const finalNum = Number.isNaN(numValue) ? props.defaultValue !== -1 ? props.defaultValue : 0 : numValue;
27495
- emit("handleInput", finalNum);
27465
+ modelValue.value = cleaned;
27466
+ emit("handleInput", cleaned);
27496
27467
  };
27497
27468
  vue.watch(() => modelValue.value, (newvalue, oldValue) => {
27498
- if (newvalue == "" || newvalue === "-" || newvalue === "-.") {
27499
- modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
27469
+ if (props.bType == "number") {
27470
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
27471
+ modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
27472
+ }
27473
+ } else {
27474
+ if (newvalue === null || newvalue === void 0 || newvalue === "") {
27475
+ const validNum = props.defaultValue == -1 ? 0 : props.defaultValue;
27476
+ modelValue.value = validNum;
27477
+ } else {
27478
+ emit("handleInput", newvalue);
27479
+ }
27500
27480
  }
27501
27481
  });
27502
27482
  return (_ctx, _cache) => {
27503
27483
  const _component_el_input = vue.resolveComponent("el-input");
27504
- return vue.openBlock(), vue.createBlock(_component_el_input, {
27484
+ const _component_el_input_number = vue.resolveComponent("el-input-number");
27485
+ return __props.bType !== "money" ? (vue.openBlock(), vue.createBlock(_component_el_input, {
27486
+ key: 0,
27505
27487
  modelValue: modelValue.value,
27506
27488
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
27507
27489
  placeholder: __props.placeholder,
27508
- onInput: handleInput,
27509
- type: "text"
27490
+ onInput: handleInput
27510
27491
  }, vue.createSlots({
27511
27492
  _: 2
27512
27493
  /* DYNAMIC */
@@ -27539,7 +27520,45 @@
27539
27520
  ]),
27540
27521
  key: "3"
27541
27522
  } : void 0
27542
- ]), 1032, ["modelValue", "placeholder"]);
27523
+ ]), 1032, ["modelValue", "placeholder"])) : (vue.openBlock(), vue.createBlock(_component_el_input_number, {
27524
+ key: 1,
27525
+ modelValue: modelValue.value,
27526
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue.value = $event),
27527
+ controls: false,
27528
+ placeholder: __props.placeholder
27529
+ }, vue.createSlots({
27530
+ _: 2
27531
+ /* DYNAMIC */
27532
+ }, [
27533
+ _ctx.$slots.prepend ? {
27534
+ name: "prepend",
27535
+ fn: vue.withCtx(() => [
27536
+ vue.renderSlot(_ctx.$slots, "prepend")
27537
+ ]),
27538
+ key: "0"
27539
+ } : void 0,
27540
+ _ctx.$slots.append ? {
27541
+ name: "append",
27542
+ fn: vue.withCtx(() => [
27543
+ vue.renderSlot(_ctx.$slots, "append")
27544
+ ]),
27545
+ key: "1"
27546
+ } : void 0,
27547
+ _ctx.$slots.prefix ? {
27548
+ name: "prefix",
27549
+ fn: vue.withCtx(() => [
27550
+ vue.renderSlot(_ctx.$slots, "prefix")
27551
+ ]),
27552
+ key: "2"
27553
+ } : void 0,
27554
+ _ctx.$slots.suffix ? {
27555
+ name: "suffix",
27556
+ fn: vue.withCtx(() => [
27557
+ vue.renderSlot(_ctx.$slots, "suffix")
27558
+ ]),
27559
+ key: "3"
27560
+ } : void 0
27561
+ ]), 1032, ["modelValue", "placeholder"]));
27543
27562
  };
27544
27563
  }
27545
27564
  });