intelliwaketssveltekitv25 0.1.86 → 0.1.87

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.
@@ -1,5 +1,11 @@
1
1
  <script lang="ts">
2
- import { CleanNumber, CleanNumberNull, CleanNumbers } from '@solidbasisventures/intelliwaketsfoundation'
2
+ import {
3
+ CleanNumber,
4
+ CleanNumberNull,
5
+ CleanNumbers,
6
+ ToDigits,
7
+ ToDigitsMax
8
+ } from '@solidbasisventures/intelliwaketsfoundation'
3
9
  import { tick } from 'svelte'
4
10
  import { HandleKeyDownNumerics, type TInputNumberAttributes } from './Functions'
5
11
  import { useActions } from './useActions'
@@ -31,9 +37,18 @@
31
37
  if (!isFocused) {
32
38
  tick()
33
39
  .then(() => {
34
- let newDisplayValue = useValue != null ? CleanNumber(useValue * displayMultiplier, constrainDecimals).toFixed(constrainDecimals) : !!otherProps.required ? '0' : ''
35
- if (!!decimalsMax && newDisplayValue.includes('.')) {
36
- newDisplayValue = newDisplayValue.replace(/\.?0+$/, '')
40
+ let newDisplayValue: string
41
+ if (useValue === null) {
42
+ newDisplayValue = !!otherProps.required ? '0' : ''
43
+ } else {
44
+ const workingValue = useValue * displayMultiplier
45
+ if (decimalsMax) {
46
+ newDisplayValue = ToDigitsMax(workingValue, decimalsMax)
47
+ } else if (decimals) {
48
+ newDisplayValue = ToDigits(workingValue, decimals)
49
+ } else {
50
+ newDisplayValue = ToDigits(workingValue)
51
+ }
37
52
  }
38
53
 
39
54
  if (displayValue !== newDisplayValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",