hamzus-ui 0.0.62 → 0.0.64
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
|
@@ -34,7 +34,16 @@
|
|
|
34
34
|
|
|
35
35
|
// local var
|
|
36
36
|
|
|
37
|
-
$:
|
|
37
|
+
$: {
|
|
38
|
+
let newValue = formatInput(value);
|
|
39
|
+
|
|
40
|
+
if (newValue !== value) {
|
|
41
|
+
value = newValue;
|
|
42
|
+
hasChanged = value != initialValue;
|
|
43
|
+
} else if (onChange) {
|
|
44
|
+
onChange(value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
38
47
|
|
|
39
48
|
// fnctions
|
|
40
49
|
function formatInput(inputValue) {
|
|
@@ -45,7 +54,6 @@
|
|
|
45
54
|
|
|
46
55
|
// Supprime tout sauf chiffres et un seul point
|
|
47
56
|
inputValue = inputValue.replace(/[^0-9.]/g, '');
|
|
48
|
-
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
if (formatPattern.length == 0) {
|
|
@@ -79,7 +87,12 @@
|
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
onMount(() => {
|
|
82
|
-
|
|
90
|
+
let newValue = formatInput(value);
|
|
91
|
+
|
|
92
|
+
if (newValue !== value) {
|
|
93
|
+
value = newValue;
|
|
94
|
+
}
|
|
95
|
+
|
|
83
96
|
if (formatPattern.length !== 0) {
|
|
84
97
|
initialValue = value;
|
|
85
98
|
}
|
|
@@ -88,15 +101,6 @@
|
|
|
88
101
|
function handleDisplay() {
|
|
89
102
|
isVisible = !isVisible;
|
|
90
103
|
}
|
|
91
|
-
|
|
92
|
-
function handleChange(event) {
|
|
93
|
-
value = formatInput(event.target.value);
|
|
94
|
-
hasChanged = value != initialValue;
|
|
95
|
-
|
|
96
|
-
if (onChange) {
|
|
97
|
-
onChange(value);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
104
|
</script>
|
|
101
105
|
|
|
102
106
|
<div
|
|
@@ -131,10 +135,9 @@
|
|
|
131
135
|
<input
|
|
132
136
|
on:focus={onFocus}
|
|
133
137
|
on:blur={onBlur}
|
|
134
|
-
on:input={handleChange}
|
|
135
138
|
class="h4"
|
|
136
139
|
{placeholder}
|
|
137
|
-
type={(isVisible && type == 'password') || type ===
|
|
140
|
+
type={(isVisible && type == 'password') || type === 'number' ? 'text' : type}
|
|
138
141
|
{name}
|
|
139
142
|
bind:value
|
|
140
143
|
{required}
|