sprintify-ui 0.0.154 → 0.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.
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:required="required"
|
|
7
7
|
:prevent-submit="preventSubmit"
|
|
8
8
|
:name="name"
|
|
9
|
-
:step="
|
|
9
|
+
:step="stepNormalized"
|
|
10
10
|
:placeholder="placeholder"
|
|
11
11
|
:disabled="disabled"
|
|
12
12
|
:icon-left="icon"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script lang="ts" setup>
|
|
21
|
-
import { round } from 'lodash';
|
|
21
|
+
import { isNumber, round } from 'lodash';
|
|
22
22
|
import { PropType } from 'vue';
|
|
23
23
|
import BaseInput from './BaseInput.vue';
|
|
24
24
|
|
|
@@ -83,10 +83,16 @@ const props = defineProps({
|
|
|
83
83
|
|
|
84
84
|
const emit = defineEmits(['update:modelValue', 'focus', 'blur']);
|
|
85
85
|
|
|
86
|
+
const stepNormalized = computed<number>(() => {
|
|
87
|
+
if (props.step === undefined) return 1;
|
|
88
|
+
if (props.step === 0) return 1;
|
|
89
|
+
if (props.step === null) return 1;
|
|
90
|
+
if (!isNumber(props.step)) return 1;
|
|
91
|
+
return props.step;
|
|
92
|
+
});
|
|
93
|
+
|
|
86
94
|
const precision = computed(() => {
|
|
87
|
-
|
|
88
|
-
if (props.step === 0) return 0;
|
|
89
|
-
const parts = props.step.toString().split('.');
|
|
95
|
+
const parts = stepNormalized.value.toString().split('.');
|
|
90
96
|
if (parts.length === 1) return 0;
|
|
91
97
|
return parts[1].length;
|
|
92
98
|
});
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
v-model="valueInternal"
|
|
30
30
|
:required="required"
|
|
31
31
|
:name="name"
|
|
32
|
-
:step="
|
|
32
|
+
:step="stepNormalized"
|
|
33
33
|
:placeholder="placeholder"
|
|
34
34
|
:disabled="disabled"
|
|
35
35
|
:min="min"
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
<script lang="ts" setup>
|
|
73
73
|
import { useField } from '@/composables/field';
|
|
74
|
-
import { round } from 'lodash';
|
|
74
|
+
import { isNumber, round } from 'lodash';
|
|
75
75
|
import { PropType } from 'vue';
|
|
76
76
|
|
|
77
77
|
const AUTO_CORRECT_TIMEOUT = 2000;
|
|
@@ -135,11 +135,16 @@ const { hasErrorInternal, emitUpdate } = useField({
|
|
|
135
135
|
emit: emit,
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
const stepNormalized = computed<number>(() => {
|
|
139
|
+
if (props.step === undefined) return 1;
|
|
140
|
+
if (props.step === 0) return 1;
|
|
141
|
+
if (props.step === null) return 1;
|
|
142
|
+
if (!isNumber(props.step)) return 1;
|
|
143
|
+
return props.step;
|
|
144
|
+
});
|
|
145
|
+
|
|
138
146
|
const precision = computed(() => {
|
|
139
|
-
|
|
140
|
-
if (props.step === null) return 0;
|
|
141
|
-
if (props.step === 0) return 0;
|
|
142
|
-
const parts = props.step.toString().split('.');
|
|
147
|
+
const parts = stepNormalized.value.toString().split('.');
|
|
143
148
|
if (parts.length === 1) return 0;
|
|
144
149
|
return parts[1].length;
|
|
145
150
|
});
|
|
@@ -255,7 +260,7 @@ function increment() {
|
|
|
255
260
|
valueInternal.value = defaultValue.value;
|
|
256
261
|
} else {
|
|
257
262
|
const newValue = round(
|
|
258
|
-
realValueInternal.value +
|
|
263
|
+
realValueInternal.value + stepNormalized.value,
|
|
259
264
|
precision.value
|
|
260
265
|
);
|
|
261
266
|
if (!hasMax.value || newValue <= (props.max as number)) {
|
|
@@ -271,7 +276,7 @@ function decrement() {
|
|
|
271
276
|
valueInternal.value = defaultValue.value;
|
|
272
277
|
} else {
|
|
273
278
|
const newValue = round(
|
|
274
|
-
realValueInternal.value -
|
|
279
|
+
realValueInternal.value - stepNormalized.value,
|
|
275
280
|
precision.value
|
|
276
281
|
);
|
|
277
282
|
if (!hasMin.value || newValue >= (props.min as number)) {
|