@fmdeui/fmui 1.0.155 → 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.
@@ -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: {};
@@ -35,6 +35,7 @@ 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;
38
39
  emit("handleInput", validNum);
39
40
  return;
40
41
  }
@@ -46,23 +47,47 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
46
47
  emit("handleInput", validNum);
47
48
  return;
48
49
  }
49
- if (val === "" || val === null || val === void 0) {
50
- const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
51
- emit("handleInput", validNum);
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;
56
+ }
57
+ if (cleaned.startsWith(".")) {
58
+ cleaned = "0" + cleaned;
59
+ }
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)}`;
52
66
  }
53
- emit("handleInput", val);
67
+ modelValue.value = cleaned;
68
+ emit("handleInput", cleaned);
54
69
  };
55
70
  watch(() => modelValue.value, (newvalue, oldValue) => {
56
- if (newvalue === null || newvalue === void 0 || newvalue === "") {
57
- 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
+ }
58
82
  }
59
83
  });
60
84
  return (_ctx, _cache) => {
85
+ const _component_el_input = resolveComponent("el-input");
61
86
  const _component_el_input_number = resolveComponent("el-input-number");
62
- return openBlock(), createBlock(_component_el_input_number, {
87
+ return __props.bType !== "money" ? (openBlock(), createBlock(_component_el_input, {
88
+ key: 0,
63
89
  modelValue: modelValue.value,
64
90
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
65
- controls: false,
66
91
  placeholder: __props.placeholder,
67
92
  onInput: handleInput
68
93
  }, createSlots({
@@ -97,7 +122,45 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
97
122
  ]),
98
123
  key: "3"
99
124
  } : void 0
100
- ]), 1032, ["modelValue", "placeholder"]);
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
131
+ }, createSlots({
132
+ _: 2
133
+ /* DYNAMIC */
134
+ }, [
135
+ _ctx.$slots.prepend ? {
136
+ name: "prepend",
137
+ fn: withCtx(() => [
138
+ renderSlot(_ctx.$slots, "prepend")
139
+ ]),
140
+ key: "0"
141
+ } : void 0,
142
+ _ctx.$slots.append ? {
143
+ name: "append",
144
+ fn: withCtx(() => [
145
+ renderSlot(_ctx.$slots, "append")
146
+ ]),
147
+ key: "1"
148
+ } : void 0,
149
+ _ctx.$slots.prefix ? {
150
+ name: "prefix",
151
+ fn: withCtx(() => [
152
+ renderSlot(_ctx.$slots, "prefix")
153
+ ]),
154
+ key: "2"
155
+ } : void 0,
156
+ _ctx.$slots.suffix ? {
157
+ name: "suffix",
158
+ fn: withCtx(() => [
159
+ renderSlot(_ctx.$slots, "suffix")
160
+ ]),
161
+ key: "3"
162
+ } : void 0
163
+ ]), 1032, ["modelValue", "placeholder"]));
101
164
  };
102
165
  }
103
166
  });
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.155 */
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) :
@@ -27433,6 +27433,7 @@
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;
27436
27437
  emit("handleInput", validNum);
27437
27438
  return;
27438
27439
  }
@@ -27444,23 +27445,47 @@
27444
27445
  emit("handleInput", validNum);
27445
27446
  return;
27446
27447
  }
27447
- if (val === "" || val === null || val === void 0) {
27448
- const validNum = props.defaultValue !== -1 ? props.defaultValue : 0;
27449
- emit("handleInput", validNum);
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;
27450
27454
  }
27451
- emit("handleInput", val);
27455
+ if (cleaned.startsWith(".")) {
27456
+ cleaned = "0" + cleaned;
27457
+ }
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)}`;
27464
+ }
27465
+ modelValue.value = cleaned;
27466
+ emit("handleInput", cleaned);
27452
27467
  };
27453
27468
  vue.watch(() => modelValue.value, (newvalue, oldValue) => {
27454
- if (newvalue === null || newvalue === void 0 || newvalue === "") {
27455
- 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
+ }
27456
27480
  }
27457
27481
  });
27458
27482
  return (_ctx, _cache) => {
27483
+ const _component_el_input = vue.resolveComponent("el-input");
27459
27484
  const _component_el_input_number = vue.resolveComponent("el-input-number");
27460
- return vue.openBlock(), vue.createBlock(_component_el_input_number, {
27485
+ return __props.bType !== "money" ? (vue.openBlock(), vue.createBlock(_component_el_input, {
27486
+ key: 0,
27461
27487
  modelValue: modelValue.value,
27462
27488
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
27463
- controls: false,
27464
27489
  placeholder: __props.placeholder,
27465
27490
  onInput: handleInput
27466
27491
  }, vue.createSlots({
@@ -27495,7 +27520,45 @@
27495
27520
  ]),
27496
27521
  key: "3"
27497
27522
  } : void 0
27498
- ]), 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"]));
27499
27562
  };
27500
27563
  }
27501
27564
  });