Passed
Push — master ( 39f3dd...5f0b05 )
by Jean-Christophe
07:53
created

Slider::setMin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Ajax\semantic\components;
4
5
use Ajax\JsUtils;
6
use Ajax\service\JString;
7
8
/**
9
 * Ajax\semantic\components$Slider
10
 * This class is part of phpMv-ui
11
 * @author jcheron <[email protected]>
12
 * @version 1.0.0
13
 * @since 2.3.0
14
 * @see https://fomantic-ui.com/modules/slider.html
15
 */
16
class Slider extends SimpleSemExtComponent {
17
18
	public function __construct(JsUtils $js=NULL) {
19
		parent::__construct($js);
20
		$this->uiName='slider';
21
	}
22
23
	public function close(){
24
		return $this->addBehavior('close');
25
	}
26
27
	public function setInterpretLabel($labels){
28
		$var="window.document._slider_labels['".JString::cleanIdentifier($this->attachTo)."']";
29
		$this->addCode('window.document._slider_labels=window.document._slider_labels||[];'.$var.'='.\json_encode($labels).';');
30
		$this->params['interpretLabel']='%function(value) {return '.$var.'[value];}%';
31
	}
32
	
33
	public function setMin($min){
34
		$this->params['min']=$min;
35
	}
36
	
37
	public function setMax($max){
38
		$this->params['max']=$max;
39
	}
40
	
41
	public function setStart($start){
42
		$this->params['start']=$start;
43
	}
44
	
45
	public function setEnd($end){
46
		$this->params['end']=$end;
47
	}
48
	
49
	public function setStep($step){
50
		$this->params['step']=$step;
51
	}
52
53
	public function setSmooth($smooth) {
54
		$this->params['smooth']=$smooth;
55
	}
56
	
57
	public function setOnChange($jsCode) {
58
		$this->addComponentEvent('onChange', $jsCode);
59
	}
60
	
61
	public function setOnMove($jsCode) {
62
		$this->addComponentEvent('onMove', $jsCode);
63
	}
64
65
}
66