@snack-uikit/fields 0.48.6 → 0.48.8
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.48.8 (2025-07-09)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/calendar@0.12.13](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/calendar/CHANGELOG.md)
|
|
10
|
+
* [@snack-uikit/list@0.31.2](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/list/CHANGELOG.md)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## 0.48.7 (2025-07-07)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **PDS-2451:** unable input 0 into field time ([9a29bbf](https://github.com/cloud-ru-tech/snack-uikit/commit/9a29bbf94f5ecebf111b4f2909047248d40dc390))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
6
27
|
## 0.48.6 (2025-07-07)
|
|
7
28
|
|
|
8
29
|
### Only dependencies have been changed
|
|
@@ -127,7 +127,8 @@ function useDateField(_ref) {
|
|
|
127
127
|
if (slotKey) {
|
|
128
128
|
const value = getSlot(slotKey);
|
|
129
129
|
const {
|
|
130
|
-
max
|
|
130
|
+
max,
|
|
131
|
+
min
|
|
131
132
|
} = slotsInfo[slotKey];
|
|
132
133
|
const numberValue = Number(value) || 0;
|
|
133
134
|
if (e.key === 'ArrowRight') {
|
|
@@ -151,31 +152,36 @@ function useDateField(_ref) {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
if (/^\d+$/.test(e.key)) {
|
|
155
|
+
const digit = Number(e.key);
|
|
154
156
|
const slotValue = parseInt(numberValue.toString() + e.key, 10) || 0;
|
|
155
157
|
const valueLength = slotValue.toString().length;
|
|
156
158
|
const maxLength = max.toString().length;
|
|
159
|
+
const isTheLastInput = value.match(/^0+$/) && maxLength === 2 && digit === 0;
|
|
157
160
|
if (valueLength < maxLength) {
|
|
158
|
-
slotValue
|
|
161
|
+
if (slotValue || slotValue >= min) {
|
|
162
|
+
updateSlot(slotKey, slotValue);
|
|
163
|
+
if (isTheLastInput) checkInputAndGoNext(slotKey);
|
|
164
|
+
}
|
|
159
165
|
if (slotValue * 10 > max) {
|
|
160
166
|
checkInputAndGoNext(slotKey);
|
|
161
167
|
}
|
|
162
168
|
} else if (valueLength > maxLength) {
|
|
163
|
-
if (
|
|
169
|
+
if (digit * 10 > max) {
|
|
164
170
|
updateSlot(slotKey, e.key);
|
|
165
171
|
checkInputAndGoNext(slotKey);
|
|
166
|
-
} else {
|
|
167
|
-
|
|
172
|
+
} else if (digit || digit >= min) {
|
|
173
|
+
updateSlot(slotKey, e.key);
|
|
168
174
|
}
|
|
169
175
|
} else {
|
|
170
176
|
if (slotValue <= max) {
|
|
171
177
|
updateSlot(slotKey, slotValue);
|
|
172
178
|
checkInputAndGoNext(slotKey);
|
|
173
179
|
} else {
|
|
174
|
-
if (
|
|
180
|
+
if (digit * 10 > max) {
|
|
175
181
|
updateSlot(slotKey, e.key);
|
|
176
182
|
checkInputAndGoNext(slotKey);
|
|
177
|
-
} else {
|
|
178
|
-
|
|
183
|
+
} else if (digit || digit >= min) {
|
|
184
|
+
updateSlot(slotKey, e.key);
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
}
|
|
@@ -93,7 +93,7 @@ export function useDateField({ inputRef, onChange, readonly, locale = DEFAULT_LO
|
|
|
93
93
|
const slotKey = getSlotKeyFromIndex(clickIndex);
|
|
94
94
|
if (slotKey) {
|
|
95
95
|
const value = getSlot(slotKey);
|
|
96
|
-
const { max } = slotsInfo[slotKey];
|
|
96
|
+
const { max, min } = slotsInfo[slotKey];
|
|
97
97
|
const numberValue = Number(value) || 0;
|
|
98
98
|
if (e.key === 'ArrowRight') {
|
|
99
99
|
if (isAllSelected() || slotKey === slotOrder[slotOrder.length - 1]) {
|
|
@@ -117,22 +117,28 @@ export function useDateField({ inputRef, onChange, readonly, locale = DEFAULT_LO
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
if (/^\d+$/.test(e.key)) {
|
|
120
|
+
const digit = Number(e.key);
|
|
120
121
|
const slotValue = parseInt(numberValue.toString() + e.key, 10) || 0;
|
|
121
122
|
const valueLength = slotValue.toString().length;
|
|
122
123
|
const maxLength = max.toString().length;
|
|
124
|
+
const isTheLastInput = value.match(/^0+$/) && maxLength === 2 && digit === 0;
|
|
123
125
|
if (valueLength < maxLength) {
|
|
124
|
-
slotValue
|
|
126
|
+
if (slotValue || slotValue >= min) {
|
|
127
|
+
updateSlot(slotKey, slotValue);
|
|
128
|
+
if (isTheLastInput)
|
|
129
|
+
checkInputAndGoNext(slotKey);
|
|
130
|
+
}
|
|
125
131
|
if (slotValue * 10 > max) {
|
|
126
132
|
checkInputAndGoNext(slotKey);
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
else if (valueLength > maxLength) {
|
|
130
|
-
if (
|
|
136
|
+
if (digit * 10 > max) {
|
|
131
137
|
updateSlot(slotKey, e.key);
|
|
132
138
|
checkInputAndGoNext(slotKey);
|
|
133
139
|
}
|
|
134
|
-
else {
|
|
135
|
-
|
|
140
|
+
else if (digit || digit >= min) {
|
|
141
|
+
updateSlot(slotKey, e.key);
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
else {
|
|
@@ -141,12 +147,12 @@ export function useDateField({ inputRef, onChange, readonly, locale = DEFAULT_LO
|
|
|
141
147
|
checkInputAndGoNext(slotKey);
|
|
142
148
|
}
|
|
143
149
|
else {
|
|
144
|
-
if (
|
|
150
|
+
if (digit * 10 > max) {
|
|
145
151
|
updateSlot(slotKey, e.key);
|
|
146
152
|
checkInputAndGoNext(slotKey);
|
|
147
153
|
}
|
|
148
|
-
else {
|
|
149
|
-
|
|
154
|
+
else if (digit || digit >= min) {
|
|
155
|
+
updateSlot(slotKey, e.key);
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.48.
|
|
7
|
+
"version": "0.48.8",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.12",
|
|
40
|
-
"@snack-uikit/calendar": "0.12.
|
|
40
|
+
"@snack-uikit/calendar": "0.12.13",
|
|
41
41
|
"@snack-uikit/color-picker": "0.3.35",
|
|
42
42
|
"@snack-uikit/divider": "3.2.7",
|
|
43
43
|
"@snack-uikit/dropdown": "0.5.0",
|
|
44
44
|
"@snack-uikit/icons": "0.27.1",
|
|
45
45
|
"@snack-uikit/input-private": "4.7.3",
|
|
46
|
-
"@snack-uikit/list": "0.31.
|
|
46
|
+
"@snack-uikit/list": "0.31.2",
|
|
47
47
|
"@snack-uikit/scroll": "0.10.2",
|
|
48
48
|
"@snack-uikit/skeleton": "0.6.6",
|
|
49
49
|
"@snack-uikit/slider": "0.3.22",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@snack-uikit/locale": "*"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "e25c748c1a490abfd80ba40b9ef26c077080af29"
|
|
69
69
|
}
|
|
@@ -170,7 +170,7 @@ export function useDateField({
|
|
|
170
170
|
|
|
171
171
|
if (slotKey) {
|
|
172
172
|
const value = getSlot(slotKey);
|
|
173
|
-
const { max } = slotsInfo[slotKey];
|
|
173
|
+
const { max, min } = slotsInfo[slotKey];
|
|
174
174
|
|
|
175
175
|
const numberValue = Number(value) || 0;
|
|
176
176
|
|
|
@@ -198,34 +198,39 @@ export function useDateField({
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
if (/^\d+$/.test(e.key)) {
|
|
201
|
+
const digit = Number(e.key);
|
|
201
202
|
const slotValue = parseInt(numberValue.toString() + e.key, 10) || 0;
|
|
202
203
|
|
|
203
204
|
const valueLength = slotValue.toString().length;
|
|
204
205
|
const maxLength = max.toString().length;
|
|
206
|
+
const isTheLastInput = value.match(/^0+$/) && maxLength === 2 && digit === 0;
|
|
205
207
|
|
|
206
208
|
if (valueLength < maxLength) {
|
|
207
|
-
slotValue
|
|
209
|
+
if (slotValue || slotValue >= min) {
|
|
210
|
+
updateSlot(slotKey, slotValue);
|
|
211
|
+
if (isTheLastInput) checkInputAndGoNext(slotKey);
|
|
212
|
+
}
|
|
208
213
|
|
|
209
214
|
if (slotValue * 10 > max) {
|
|
210
215
|
checkInputAndGoNext(slotKey);
|
|
211
216
|
}
|
|
212
217
|
} else if (valueLength > maxLength) {
|
|
213
|
-
if (
|
|
218
|
+
if (digit * 10 > max) {
|
|
214
219
|
updateSlot(slotKey, e.key);
|
|
215
220
|
checkInputAndGoNext(slotKey);
|
|
216
|
-
} else {
|
|
217
|
-
|
|
221
|
+
} else if (digit || digit >= min) {
|
|
222
|
+
updateSlot(slotKey, e.key);
|
|
218
223
|
}
|
|
219
224
|
} else {
|
|
220
225
|
if (slotValue <= max) {
|
|
221
226
|
updateSlot(slotKey, slotValue);
|
|
222
227
|
checkInputAndGoNext(slotKey);
|
|
223
228
|
} else {
|
|
224
|
-
if (
|
|
229
|
+
if (digit * 10 > max) {
|
|
225
230
|
updateSlot(slotKey, e.key);
|
|
226
231
|
checkInputAndGoNext(slotKey);
|
|
227
|
-
} else {
|
|
228
|
-
|
|
232
|
+
} else if (digit || digit >= min) {
|
|
233
|
+
updateSlot(slotKey, e.key);
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
}
|