@dataloop-ai/components 0.19.150 → 0.19.151
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/package.json
CHANGED
|
@@ -765,7 +765,14 @@ export default defineComponent({
|
|
|
765
765
|
setCaretAtTheEnd(input.value)
|
|
766
766
|
return
|
|
767
767
|
}
|
|
768
|
-
|
|
768
|
+
/**
|
|
769
|
+
* if the number ends with a dot followed by multiple zeros
|
|
770
|
+
* then we should not replace the inputs value with the parsed number
|
|
771
|
+
*/
|
|
772
|
+
if (
|
|
773
|
+
!toEmit.endsWith('.') &&
|
|
774
|
+
!new RegExp(/\.\d*0+$/, 'g').test(toEmit)
|
|
775
|
+
) {
|
|
769
776
|
input.value.innerHTML = String(Number(toEmit))
|
|
770
777
|
.toString()
|
|
771
778
|
.replace(/ /g, ' ')
|
|
@@ -1105,7 +1112,28 @@ export default defineComponent({
|
|
|
1105
1112
|
methods: {
|
|
1106
1113
|
onKeydown(e: KeyboardEvent) {
|
|
1107
1114
|
if (e.key !== 'Backspace') {
|
|
1108
|
-
|
|
1115
|
+
/**
|
|
1116
|
+
* Allow only numbers
|
|
1117
|
+
* Allow decimal point
|
|
1118
|
+
* Allow arrow keys
|
|
1119
|
+
* Allow delete
|
|
1120
|
+
* Allow control/meta keys
|
|
1121
|
+
* Allow select all
|
|
1122
|
+
*/
|
|
1123
|
+
if (
|
|
1124
|
+
this.type === 'number' &&
|
|
1125
|
+
!/^[\d.]$/.test(e.key) &&
|
|
1126
|
+
![
|
|
1127
|
+
'ArrowLeft',
|
|
1128
|
+
'ArrowRight',
|
|
1129
|
+
'Backspace',
|
|
1130
|
+
'Delete',
|
|
1131
|
+
'Control',
|
|
1132
|
+
'Meta',
|
|
1133
|
+
'a'
|
|
1134
|
+
].includes(e.key) &&
|
|
1135
|
+
!(e.ctrlKey || e.metaKey)
|
|
1136
|
+
) {
|
|
1109
1137
|
e.preventDefault()
|
|
1110
1138
|
return
|
|
1111
1139
|
}
|