@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.150",
3
+ "version": "0.19.151",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -765,7 +765,14 @@ export default defineComponent({
765
765
  setCaretAtTheEnd(input.value)
766
766
  return
767
767
  }
768
- if (!toEmit.endsWith('.')) {
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
- if (this.type === 'number' && !/^[\d.]$/.test(e.key)) {
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
  }
@@ -8,6 +8,7 @@
8
8
  placeholder="Test reactivity"
9
9
  :disabled="disabledInput"
10
10
  />
11
+ {{ numberVal }}
11
12
  </div>
12
13
  <div style="padding-bottom: 10px">
13
14
  <div>switch the disalbed prop: {{ disabledInput }}</div>