hamzus-ui 0.0.83 → 0.0.85

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": "hamzus-ui",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -35,16 +35,7 @@
35
35
  // local var
36
36
  let isMounted = false;
37
37
 
38
- $: if (value != undefined) {
39
- let newValue = formatInput(value);
40
-
41
- if (newValue !== value) {
42
- value = newValue;
43
- hasChanged = value != initialValue;
44
- } else if (onChange) {
45
- onChange(value);
46
- }
47
- }
38
+ $: handleChange(value)
48
39
 
49
40
  // fnctions
50
41
  function formatInput(inputValue) {
@@ -86,10 +77,32 @@
86
77
 
87
78
  return formattedValue;
88
79
  }
80
+ function handleChange(val) {
81
+ if (!isMounted) {
82
+ return
83
+ }
84
+
85
+ let newValue = formatInput(value);
86
+
87
+ // si la valeur formater est pas egal alors on update
88
+ if (newValue !== value) {
89
+ value = newValue;
90
+ }
91
+
92
+
93
+ onChange(value)
94
+ }
89
95
 
90
96
  onMount(() => {
91
97
  isMounted = false;
92
98
 
99
+ let newValue = formatInput(value);
100
+
101
+ // si la valeur formater est pas egal alors on update
102
+ if (newValue !== value) {
103
+ value = newValue;
104
+ }
105
+
93
106
  isMounted = true;
94
107
  });
95
108