mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
TSK-404 Add number value check in editor (#2367)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
19429e2977
commit
e70ca4f65e
@ -72,7 +72,7 @@
|
||||
|
||||
<Card
|
||||
label={tracker.string.TimeSpendReportAdd}
|
||||
canSave={data.value !== 0}
|
||||
canSave={Number.isFinite(data.value) && data.value !== 0}
|
||||
okAction={create}
|
||||
on:close
|
||||
okLabel={value === undefined ? presentation.string.Create : presentation.string.Save}
|
||||
|
@ -30,7 +30,10 @@
|
||||
let shown: boolean = false
|
||||
|
||||
function _onchange (ev: Event) {
|
||||
onChange((ev.target as HTMLInputElement).valueAsNumber)
|
||||
const value = (ev.target as HTMLInputElement).valueAsNumber
|
||||
if (Number.isFinite(value)) {
|
||||
onChange(value)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -40,7 +43,7 @@
|
||||
on:click={(ev) => {
|
||||
if (!shown && !readonly) {
|
||||
showPopup(EditBoxPopup, { value, format: 'number' }, eventToHTMLElement(ev), (res) => {
|
||||
if (res !== undefined) {
|
||||
if (Number.isFinite(res)) {
|
||||
value = res
|
||||
onChange(value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user