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
|
<Card
|
||||||
label={tracker.string.TimeSpendReportAdd}
|
label={tracker.string.TimeSpendReportAdd}
|
||||||
canSave={data.value !== 0}
|
canSave={Number.isFinite(data.value) && data.value !== 0}
|
||||||
okAction={create}
|
okAction={create}
|
||||||
on:close
|
on:close
|
||||||
okLabel={value === undefined ? presentation.string.Create : presentation.string.Save}
|
okLabel={value === undefined ? presentation.string.Create : presentation.string.Save}
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
let shown: boolean = false
|
let shown: boolean = false
|
||||||
|
|
||||||
function _onchange (ev: Event) {
|
function _onchange (ev: Event) {
|
||||||
onChange((ev.target as HTMLInputElement).valueAsNumber)
|
const value = (ev.target as HTMLInputElement).valueAsNumber
|
||||||
|
if (Number.isFinite(value)) {
|
||||||
|
onChange(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -40,7 +43,7 @@
|
|||||||
on:click={(ev) => {
|
on:click={(ev) => {
|
||||||
if (!shown && !readonly) {
|
if (!shown && !readonly) {
|
||||||
showPopup(EditBoxPopup, { value, format: 'number' }, eventToHTMLElement(ev), (res) => {
|
showPopup(EditBoxPopup, { value, format: 'number' }, eventToHTMLElement(ev), (res) => {
|
||||||
if (res !== undefined) {
|
if (Number.isFinite(res)) {
|
||||||
value = res
|
value = res
|
||||||
onChange(value)
|
onChange(value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user