1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables\Html\Editor; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Fluent; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @see https://editor.datatables.net/reference/type/form-options |
9
|
|
|
*/ |
10
|
|
|
class FormOptions extends Fluent |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param array $attributes |
14
|
|
|
* @return \Yajra\DataTables\Html\Editor\FormOptions |
15
|
|
|
*/ |
16
|
|
|
public static function make($attributes = []) |
17
|
|
|
{ |
18
|
|
|
return new static($attributes); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param int $value |
23
|
|
|
* @return $this |
24
|
|
|
*/ |
25
|
|
|
public function focus($value = 0) |
26
|
|
|
{ |
27
|
|
|
$this->attributes['focus'] = $value; |
28
|
|
|
|
29
|
|
|
return $this; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param bool $value |
34
|
|
|
* @return $this |
35
|
|
|
*/ |
36
|
|
|
public function message($value = false) |
37
|
|
|
{ |
38
|
|
|
$this->attributes['message'] = $value; |
39
|
|
|
|
40
|
|
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $value |
45
|
|
|
* @return $this |
46
|
|
|
*/ |
47
|
|
|
public function onBackground($value = 'blur') |
48
|
|
|
{ |
49
|
|
|
$this->attributes['onBackground'] = $value; |
50
|
|
|
|
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string $value |
56
|
|
|
* @return $this |
57
|
|
|
*/ |
58
|
|
|
public function onBlur($value = 'close') |
59
|
|
|
{ |
60
|
|
|
$this->attributes['onBlur'] = $value; |
61
|
|
|
|
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $value |
67
|
|
|
* @return $this |
68
|
|
|
*/ |
69
|
|
|
public function onComplete($value = 'close') |
70
|
|
|
{ |
71
|
|
|
$this->attributes['onComplete'] = $value; |
72
|
|
|
|
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param string $value |
78
|
|
|
* @return $this |
79
|
|
|
*/ |
80
|
|
|
public function onEsc($value = 'close') |
81
|
|
|
{ |
82
|
|
|
$this->attributes['onEsc'] = $value; |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param string $value |
89
|
|
|
* @return $this |
90
|
|
|
*/ |
91
|
|
|
public function onFieldError($value = 'focus') |
92
|
|
|
{ |
93
|
|
|
$this->attributes['onFieldError'] = $value; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string $value |
100
|
|
|
* @return $this |
101
|
|
|
*/ |
102
|
|
|
public function onReturn($value = 'submit') |
103
|
|
|
{ |
104
|
|
|
$this->attributes['onReturn'] = $value; |
105
|
|
|
|
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $value |
111
|
|
|
* @return $this |
112
|
|
|
*/ |
113
|
|
|
public function submit($value = 'changed') |
114
|
|
|
{ |
115
|
|
|
$this->attributes['submit'] = $value; |
116
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param bool $value |
122
|
|
|
* @return $this |
123
|
|
|
*/ |
124
|
|
|
public function title($value = false) |
125
|
|
|
{ |
126
|
|
|
$this->attributes['title'] = $value; |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param bool $value |
133
|
|
|
* @return $this |
134
|
|
|
*/ |
135
|
|
|
public function drawType($value = false) |
136
|
|
|
{ |
137
|
|
|
$this->attributes['drawType'] = $value; |
138
|
|
|
|
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param string $value |
144
|
|
|
* @return $this |
145
|
|
|
*/ |
146
|
|
|
public function scope($value = 'row') |
147
|
|
|
{ |
148
|
|
|
$this->attributes['scope'] = $value; |
149
|
|
|
|
150
|
|
|
return $this; |
151
|
|
|
} |
152
|
|
|
} |
153
|
|
|
|