mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 00:43:20 +01:00
Et2Number: Fix number scroll giving NaN
This commit is contained in:
parent
2430f65304
commit
f405da9800
@ -161,7 +161,11 @@ export class Et2Number extends Et2Textbox
|
|||||||
{
|
{
|
||||||
let val = this.__value;
|
let val = this.__value;
|
||||||
|
|
||||||
if("" + val !== "")
|
if(val === "")
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if("" + val !== "")
|
||||||
{
|
{
|
||||||
// remove decimal separator from user prefs
|
// remove decimal separator from user prefs
|
||||||
const format = this.egw().preference('number_format');
|
const format = this.egw().preference('number_format');
|
||||||
@ -185,8 +189,16 @@ export class Et2Number extends Et2Textbox
|
|||||||
private handleScroll(e)
|
private handleScroll(e)
|
||||||
{
|
{
|
||||||
const old_value = this.value;
|
const old_value = this.value;
|
||||||
const min = parseFloat(this.min ?? Number.MIN_SAFE_INTEGER);
|
let min = parseFloat(this.min ?? Number.MIN_SAFE_INTEGER);
|
||||||
const max = parseFloat(this.max ?? Number.MAX_SAFE_INTEGER);
|
if(Number.isNaN(min))
|
||||||
|
{
|
||||||
|
min = Number.MIN_SAFE_INTEGER;
|
||||||
|
}
|
||||||
|
let max = parseFloat(this.max ?? Number.MAX_SAFE_INTEGER);
|
||||||
|
if(Number.isNaN(max))
|
||||||
|
{
|
||||||
|
max = Number.MAX_SAFE_INTEGER;
|
||||||
|
}
|
||||||
this.value = "" + Math.min(Math.max(this.valueAsNumber + e.detail * (parseFloat(this.step) || 1), min), max);
|
this.value = "" + Math.min(Math.max(this.valueAsNumber + e.detail * (parseFloat(this.step) || 1), min), max);
|
||||||
this.dispatchEvent(new CustomEvent("sl-change", {bubbles: true}));
|
this.dispatchEvent(new CustomEvent("sl-change", {bubbles: true}));
|
||||||
this.requestUpdate("value", old_value);
|
this.requestUpdate("value", old_value);
|
||||||
|
Loading…
Reference in New Issue
Block a user