@veritree/ui 0.83.0 → 0.83.2
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
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
:disabled="isDisabled"
|
|
9
9
|
:class="[
|
|
10
10
|
// default styles
|
|
11
|
-
headless
|
|
12
|
-
? 'button'
|
|
13
|
-
: isIcon
|
|
14
|
-
? 'relative inline-flex items-center justify-center rounded-full [&_svg]:max-h-full [&_svg]:max-w-full'
|
|
15
|
-
: 'button-base',
|
|
11
|
+
headless ? 'button' : isIcon ? null : 'button-base',
|
|
16
12
|
// variant styles
|
|
17
13
|
headless
|
|
18
14
|
? `button--${variant}`
|
|
@@ -23,11 +19,11 @@
|
|
|
23
19
|
? 'border-gray-500 text-gray-100 hover:bg-white hover:text-gray-700'
|
|
24
20
|
: 'button--secondary'
|
|
25
21
|
: isTertiary
|
|
26
|
-
? '
|
|
22
|
+
? 'button--tertiary'
|
|
27
23
|
: isDark
|
|
28
|
-
? '
|
|
24
|
+
? 'button--dark'
|
|
29
25
|
: isIcon
|
|
30
|
-
? '
|
|
26
|
+
? 'button--icon'
|
|
31
27
|
: null,
|
|
32
28
|
// sizes styles
|
|
33
29
|
headless
|
|
@@ -22,36 +22,10 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
|
|
25
|
-
// data() {
|
|
26
|
-
// return {
|
|
27
|
-
// expanded: false,
|
|
28
|
-
// };
|
|
29
|
-
// },
|
|
30
|
-
|
|
31
25
|
computed: {
|
|
32
|
-
// id() {
|
|
33
|
-
// return this.apiDetails().idIcon;
|
|
34
|
-
// },
|
|
35
|
-
|
|
36
|
-
// idGroup() {
|
|
37
|
-
// return this.apiDetails().idGroup;
|
|
38
|
-
// },
|
|
39
|
-
|
|
40
26
|
expanded() {
|
|
41
27
|
return this.apiDetails().visible;
|
|
42
28
|
},
|
|
43
29
|
},
|
|
44
|
-
|
|
45
|
-
mounted() {
|
|
46
|
-
// const icon = {
|
|
47
|
-
// id: this.id,
|
|
48
|
-
// idGroup: this.idGroup,
|
|
49
|
-
// };
|
|
50
|
-
// this.apiDisclosure().register('icons', icon);
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
beforeDestroy() {
|
|
54
|
-
// this.apiDisclosure().unregister('icons', this.id);
|
|
55
|
-
},
|
|
56
30
|
};
|
|
57
31
|
</script>
|
|
@@ -66,6 +66,10 @@ export default {
|
|
|
66
66
|
return {
|
|
67
67
|
event: null,
|
|
68
68
|
key: null,
|
|
69
|
+
/**
|
|
70
|
+
* @property {boolean} isDirty - Indicates whether the input field has been modified by the user.
|
|
71
|
+
*/
|
|
72
|
+
isDirty: false,
|
|
69
73
|
};
|
|
70
74
|
},
|
|
71
75
|
|
|
@@ -97,9 +101,15 @@ export default {
|
|
|
97
101
|
options = {};
|
|
98
102
|
}
|
|
99
103
|
|
|
100
|
-
|
|
104
|
+
if (this.value === null || this.value === undefined) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.value === 0 && !this.isDirty) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
101
111
|
|
|
102
|
-
return
|
|
112
|
+
return Number(this.value).toLocaleString(this.locale, options);
|
|
103
113
|
},
|
|
104
114
|
set(value) {
|
|
105
115
|
// value without formatting that will be
|
|
@@ -123,6 +133,10 @@ export default {
|
|
|
123
133
|
},
|
|
124
134
|
},
|
|
125
135
|
|
|
136
|
+
beforeDestroy() {
|
|
137
|
+
this.isDirty = false;
|
|
138
|
+
},
|
|
139
|
+
|
|
126
140
|
methods: {
|
|
127
141
|
/**
|
|
128
142
|
* Unformats a formatted number string by removing commas and converting it to an integer.
|
|
@@ -164,6 +178,7 @@ export default {
|
|
|
164
178
|
onInput(e) {
|
|
165
179
|
this.event = 'input';
|
|
166
180
|
this.valueComputed = e.target.value;
|
|
181
|
+
this.isDirty = true;
|
|
167
182
|
},
|
|
168
183
|
|
|
169
184
|
onBlur(e) {
|
|
@@ -187,6 +202,11 @@ export default {
|
|
|
187
202
|
* @param {Event} e - The keydown event object.
|
|
188
203
|
*/
|
|
189
204
|
onKeyDown(e) {
|
|
205
|
+
// if select all (Ctrl + A) is pressed, don't prevent default
|
|
206
|
+
if (e.key === 'a' && (e.ctrlKey || e.metaKey)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
190
210
|
if (
|
|
191
211
|
!/^[0-9.,]$/.test(e.key) &&
|
|
192
212
|
!['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(
|