false ]; /** * @var array */ protected static $propsRule = [ 'min' => 'float', 'max' => 'float', 'step' => 'float', 'disabled' => 'boolean', 'range' => 'boolean', 'showInput' => 'boolean', 'showStops' => 'boolean', 'showTip' => 'string', 'inputSize' => 'string', ]; /** * @param $value * @return $this */ public function value($value) { $this->value = $value; return $this; } public function getValidateHandler() { if ($this->props['range'] == true) return Validate::arr(); else return Validate::num(); } /** * @return array */ public function build() { $value = $this->value; if ($this->props['range'] == true) { $value = is_array($value) ? $value : [0, (int)$value]; } else { $value = (int)(is_array($value) ? (isset($value[0]) ? $value[0] : 0) : $value); } return [ 'type' => $this->name, 'field' => $this->field, 'title' => $this->title, 'value' => $value, 'props' => (object)$this->props, 'validate' => $this->validate, 'col' => $this->col ]; } }