mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-03 17:05:16 +03:00
UBER-316 Date picker is not editable by keyboard (#3283)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
adda89d0c6
commit
3910f2d1f9
@ -105,8 +105,10 @@
|
|||||||
edits = edits
|
edits = edits
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isNull = (currentDate: Date | null, full: boolean = false): boolean => {
|
export const isNull = (currentDate: Date | null | undefined = undefined, full: boolean = false): boolean => {
|
||||||
dateToEdits(currentDate)
|
if (currentDate !== undefined) {
|
||||||
|
dateToEdits(currentDate)
|
||||||
|
}
|
||||||
let result: boolean = false
|
let result: boolean = false
|
||||||
edits.forEach((edit, i) => {
|
edits.forEach((edit, i) => {
|
||||||
if (edit.value === -1 && full && i > 2) result = true
|
if (edit.value === -1 && full && i > 2) result = true
|
||||||
@ -134,7 +136,7 @@
|
|||||||
} else {
|
} else {
|
||||||
edits[index].value = edits[index].value * 10 + num
|
edits[index].value = edits[index].value * 10 + num
|
||||||
}
|
}
|
||||||
if (!isNull(currentDate, false) && !startTyping) {
|
if (!isNull() && !startTyping) {
|
||||||
fixEdits()
|
fixEdits()
|
||||||
currentDate = setValue(edits[index].value, currentDate, ed)
|
currentDate = setValue(edits[index].value, currentDate, ed)
|
||||||
dateToEdits(currentDate)
|
dateToEdits(currentDate)
|
||||||
@ -148,7 +150,7 @@
|
|||||||
else if (selected === 'hour' && (shouldNext || edits[3].value > 2)) selected = 'min'
|
else if (selected === 'hour' && (shouldNext || edits[3].value > 2)) selected = 'min'
|
||||||
}
|
}
|
||||||
if (ev.code === 'Enter') {
|
if (ev.code === 'Enter') {
|
||||||
if (!isNull(currentDate, false)) dispatch('close')
|
if (!isNull(currentDate)) dispatch('close')
|
||||||
}
|
}
|
||||||
if (ev.code === 'Backspace') {
|
if (ev.code === 'Backspace') {
|
||||||
edits[index].value = -1
|
edits[index].value = -1
|
||||||
|
Loading…
Reference in New Issue
Block a user