edvoyui-component-library-test-flight 0.0.161 → 0.0.162
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.
- package/dist/{EUINumberInput.vue.d.ts → input/EUINumberInput.vue.d.ts} +1 -1
- package/dist/input/EUINumberInput.vue.d.ts.map +1 -0
- package/dist/library-vue-ts.cjs.js +1 -1
- package/dist/library-vue-ts.css +1 -1
- package/dist/library-vue-ts.es.js +515 -508
- package/dist/library-vue-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/components/HelloWorld.vue +3 -3
- package/src/components/input/EUINumberInput.vue +23 -18
- package/dist/EUINumberInput.vue.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
:value="modelValue"
|
|
54
54
|
:min="min"
|
|
55
55
|
:max="max"
|
|
56
|
-
:step="step"
|
|
56
|
+
:step="step || 1"
|
|
57
57
|
:placeholder="placeholder"
|
|
58
58
|
:name="name"
|
|
59
59
|
:class="[
|
|
@@ -71,13 +71,12 @@
|
|
|
71
71
|
:disabled="disabled"
|
|
72
72
|
:readonly="readonly"
|
|
73
73
|
autocomplete="off"
|
|
74
|
-
pattern="^[0-9]{1,3}$"
|
|
75
74
|
inputmode="numeric"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
75
|
+
pattern="^([0-9]{1,5}(\.[0-9]{1,2})?|100000(\.0{1,2})?)$"
|
|
76
|
+
@keypress="(e) => { if (!/[0-9.]/.test(e.key)) e.preventDefault();}"
|
|
77
|
+
@wheel.prevent=""
|
|
78
|
+
@keydown.up.prevent=""
|
|
79
|
+
@keydown.down.prevent=""
|
|
81
80
|
@input="emitInput"
|
|
82
81
|
@focus="hasFocus = true"
|
|
83
82
|
@blur="hasFocus = false"
|
|
@@ -179,23 +178,29 @@ const input = ref<HTMLInputElement>();
|
|
|
179
178
|
const id = "id"; //generateUID();
|
|
180
179
|
|
|
181
180
|
const emit = defineEmits(["update:modelValue"]);
|
|
181
|
+
|
|
182
182
|
const emitInput = (event: Event) => {
|
|
183
183
|
const inputEl = event.target as HTMLInputElement;
|
|
184
|
-
|
|
184
|
+
const newValue = parseFloat(inputEl.value);
|
|
185
185
|
|
|
186
|
-
//
|
|
187
|
-
if (isNaN(newValue)) {
|
|
188
|
-
newValue
|
|
186
|
+
// Only emit valid numbers within range
|
|
187
|
+
if (!isNaN(newValue)) {
|
|
188
|
+
if (newValue >= props.min && newValue <= props.max) {
|
|
189
|
+
emit("update:modelValue", newValue);
|
|
190
|
+
} else if (newValue > props.max) {
|
|
191
|
+
emit("update:modelValue", props.max);
|
|
192
|
+
inputEl.value = String(props.max);
|
|
193
|
+
} else if (newValue < props.min) {
|
|
194
|
+
emit("update:modelValue", props.min);
|
|
195
|
+
inputEl.value = String(props.min);
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
emit("update:modelValue", props.min);
|
|
199
|
+
inputEl.value = String(props.min);
|
|
189
200
|
}
|
|
201
|
+
};
|
|
190
202
|
|
|
191
|
-
// Clamp the value between 0 and 100
|
|
192
|
-
if (newValue < props.min) newValue = props.min;
|
|
193
|
-
if (newValue > props.max) newValue = props.max;
|
|
194
203
|
|
|
195
|
-
// Update both input display and v-model
|
|
196
|
-
inputEl.value = String(newValue);
|
|
197
|
-
emit("update:modelValue", newValue);
|
|
198
|
-
};
|
|
199
204
|
|
|
200
205
|
const inputValue = computed(() => {
|
|
201
206
|
return props.modelValue === 0 ? true : !!props.modelValue;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EUINumberInput.vue.d.ts","sourceRoot":"","sources":["../src/components/input/EUINumberInput.vue"],"names":[],"mappings":"AACA,cAAc,4GAA4G,CAAC;AAC3H,OAAO,0HAA0H,CAAC;;AAElI,wBAA0F"}
|