hamzus-ui 0.0.63 → 0.0.65

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.63",
3
+ "version": "0.0.65",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -35,8 +35,17 @@
35
35
  // local var
36
36
 
37
37
  $: {
38
- value = formatInput(value)
39
- };
38
+ let newValue = formatInput(value);
39
+
40
+ if (newValue !== value) {
41
+ value = newValue;
42
+ hasChanged = value != initialValue;
43
+ } else if (onChange) {
44
+ console.log("in change");
45
+
46
+ onChange(value);
47
+ }
48
+ }
40
49
 
41
50
  // fnctions
42
51
  function formatInput(inputValue) {
@@ -47,7 +56,6 @@
47
56
 
48
57
  // Supprime tout sauf chiffres et un seul point
49
58
  inputValue = inputValue.replace(/[^0-9.]/g, '');
50
-
51
59
  }
52
60
 
53
61
  if (formatPattern.length == 0) {
@@ -81,7 +89,12 @@
81
89
  }
82
90
 
83
91
  onMount(() => {
84
- value = formatInput(value);
92
+ let newValue = formatInput(value);
93
+
94
+ if (newValue !== value) {
95
+ value = newValue;
96
+ }
97
+
85
98
  if (formatPattern.length !== 0) {
86
99
  initialValue = value;
87
100
  }
@@ -90,15 +103,6 @@
90
103
  function handleDisplay() {
91
104
  isVisible = !isVisible;
92
105
  }
93
-
94
- function handleChange(event) {
95
- value = formatInput(event.target.value);
96
- hasChanged = value != initialValue;
97
-
98
- if (onChange) {
99
- onChange(value);
100
- }
101
- }
102
106
  </script>
103
107
 
104
108
  <div
@@ -133,10 +137,9 @@
133
137
  <input
134
138
  on:focus={onFocus}
135
139
  on:blur={onBlur}
136
- on:input={handleChange}
137
140
  class="h4"
138
141
  {placeholder}
139
- type={(isVisible && type == 'password') || type === "number" ? 'text' : type}
142
+ type={(isVisible && type == 'password') || type === 'number' ? 'text' : type}
140
143
  {name}
141
144
  bind:value
142
145
  {required}