5 class Number extends \Rsi\Fred\Controller\Widget{
16 return array_merge(parent::clientConfig(),[
17 self::DECIMALS => $this->decimals,
18 self::ROUND => $this->
round,
19 self::TRIM => $this->trim
24 if($value ===
null)
return null;
25 if($this->decimals !==
null) $value =
round($value,$this->decimals);
30 return \Rsi::nothing($value) ? null : $this->
round($this->local->convertNumber($value,$this->decimals));
34 return $this->local->formatNumber($this->
round($value),$this->decimals,
$trim ? $this->trim :
null);
38 return is_scalar($value) && preg_match(
'/^-?\\d+(\\.\\d+)?$/',$value);
42 return $this->
config(self::DECIMALS) ?: ($this->
round ? max(0,(
int)ceil(-log10($this->
round))) :
null);