|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace JeroenNoten\LaravelAdminLte\Components; |
|
4
|
|
|
|
|
5
|
|
|
class InputSlider extends InputGroupComponent |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* The bootstrap-slider plugin configuration parameters. Array with |
|
9
|
|
|
* key => value pairs, where the key should be an existing configuration |
|
10
|
|
|
* property of the plugin. |
|
11
|
|
|
* |
|
12
|
|
|
* @var array |
|
13
|
|
|
*/ |
|
14
|
|
|
public $config; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* The slider color. One of the available html colors. |
|
18
|
|
|
* |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
public $color; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Create a new component instance. |
|
25
|
|
|
* Note this component requires the 'bootstrap-slider' plugin. |
|
26
|
|
|
* |
|
27
|
|
|
* @return void |
|
28
|
|
|
*/ |
|
29
|
2 |
|
public function __construct( |
|
30
|
|
|
$name, $label = null, $size = null, $labelClass = null, |
|
31
|
|
|
$topClass = null, $inputGroupClass = null, $disableFeedback = null, |
|
32
|
|
|
$config = [], $color = null |
|
33
|
|
|
) { |
|
34
|
2 |
|
parent::__construct( |
|
35
|
2 |
|
$name, $label, $size, $labelClass, $topClass, |
|
36
|
|
|
$inputGroupClass, $disableFeedback |
|
37
|
|
|
); |
|
38
|
|
|
|
|
39
|
2 |
|
$this->config = is_array($config) ? $config : []; |
|
40
|
2 |
|
$this->color = $color; |
|
41
|
|
|
|
|
42
|
|
|
// Set a default plugin 'id' option. |
|
43
|
|
|
|
|
44
|
2 |
|
$this->config['id'] = $this->config['id'] ?? "{$name}-slider"; |
|
45
|
2 |
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Make the class attribute for the "input-group" element. Note we overwrite |
|
49
|
|
|
* the method of the parent class. |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $invalid |
|
52
|
|
|
* @return string |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function makeInputGroupClass($invalid = null) |
|
55
|
|
|
{ |
|
56
|
1 |
|
$classes = ['input-group']; |
|
57
|
|
|
|
|
58
|
1 |
|
if (isset($this->size) && in_array($this->size, ['sm', 'lg'])) { |
|
59
|
1 |
|
$classes[] = "input-group-{$this->size}"; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
if (! empty($invalid) && ! isset($this->disableFeedback)) { |
|
63
|
1 |
|
$classes[] = 'adminlte-invalid-islgroup'; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
1 |
|
if (isset($this->inputGroupClass)) { |
|
67
|
1 |
|
$classes[] = $this->inputGroupClass; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
1 |
|
return implode(' ', $classes); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Get the view / contents that represent the component. |
|
75
|
|
|
* |
|
76
|
|
|
* @return \Illuminate\View\View|string |
|
77
|
|
|
*/ |
|
78
|
1 |
|
public function render() |
|
79
|
|
|
{ |
|
80
|
1 |
|
return view('adminlte::components.input-slider'); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|