hamzus-ui 0.0.82 → 0.0.84

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.82",
3
+ "version": "0.0.84",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -35,17 +35,6 @@
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 && isMounted) {
45
- onChange(value);
46
- }
47
- }
48
-
49
38
  // fnctions
50
39
  function formatInput(inputValue) {
51
40
  // verifier que c est un nombre
@@ -87,9 +76,30 @@
87
76
  return formattedValue;
88
77
  }
89
78
 
79
+ function handleChange() {
80
+ if (!isMounted) {
81
+ return
82
+ }
83
+ let newValue = formatInput(value);
84
+
85
+ // si la valeur formater est pas egal alors on update
86
+ if (newValue !== value) {
87
+ value = newValue;
88
+ }
89
+
90
+ onChange(value)
91
+ }
92
+
90
93
  onMount(() => {
91
94
  isMounted = false;
92
95
 
96
+ let newValue = formatInput(value);
97
+
98
+ // si la valeur formater est pas egal alors on update
99
+ if (newValue !== value) {
100
+ value = newValue;
101
+ }
102
+
93
103
  isMounted = true;
94
104
  });
95
105
 
@@ -130,6 +140,7 @@
130
140
  <input
131
141
  on:focus={onFocus}
132
142
  on:blur={onBlur}
143
+ on:input={handleChange}
133
144
  class="h4"
134
145
  {placeholder}
135
146
  type={(isVisible && type == 'password') || type === 'number' ? 'text' : type}