Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d50607

Browse files
committed
Merge branch '4.0'
* 4.0: Bump v4.34.0 🚀 Add formatted column factory. To complimentyajra/laravel-datatables#2193 Bump v4.34.0 🚀 [4.0] Add support for search panes extension. (yajra#137)
2 parents1a8d3ed +d8091a6 commit7d50607

File tree

8 files changed

+449
-3
lines changed

8 files changed

+449
-3
lines changed

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
##CHANGELOG
1010

11+
###v4.35.0 - 11-03-2020
12+
13+
- Add formatted column factory.[#147]
14+
15+
###v4.34.0 - 10-31-2020
16+
17+
- Add support for search panes extension.[#137]
18+
1119
###v4.33.0 - 10-30-2020
1220

1321
- Make LaravelDataTables javascript namespace configurable.[#145], credits to@om3rcitak
@@ -699,6 +707,8 @@ To `created_at` with title `Created At`
699707
[#142]:https://github.com/yajra/laravel-datatables-html/pull/142
700708
[#143]:https://github.com/yajra/laravel-datatables-html/pull/143
701709
[#144]:https://github.com/yajra/laravel-datatables-html/pull/144
710+
[#137]:https://github.com/yajra/laravel-datatables-html/pull/137
711+
[#147]:https://github.com/yajra/laravel-datatables-html/pull/147
702712

703713
[#134]:https://github.com/yajra/laravel-datatables-html/issues/134
704714
[#3]:https://github.com/yajra/laravel-datatables-html/issues/3

‎src/Html/Column.php‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
useIlluminate\Support\Arr;
66
useIlluminate\Support\Str;
77
useIlluminate\Support\Fluent;
8+
useYajra\DataTables\Html\Options\Plugins\SearchPanes;
89

910
/**
1011
* @property string data
@@ -19,6 +20,8 @@
1920
*/
2021
class Columnextends Fluent
2122
{
23+
use SearchPanes;
24+
2225
/**
2326
* @param array $attributes
2427
*/
@@ -101,7 +104,7 @@ public function orderable(bool $flag = true)
101104

102105
return$this;
103106
}
104-
107+
105108
/**
106109
* Set column responsive priority.
107110
*
@@ -147,6 +150,23 @@ public static function make($data, $name = '')
147150
returnnewstatic($attr);
148151
}
149152

153+
/**
154+
* Make a new formatted column instance.
155+
*
156+
* @param string $name
157+
* @return Column
158+
*/
159+
publicstaticfunctionformatted($name)
160+
{
161+
$attr = [
162+
'data' =>$name .'_formatted',
163+
'name' =>$name,
164+
'title' =>self::titleFormat($name),
165+
];
166+
167+
returnnewstatic($attr);
168+
}
169+
150170
/**
151171
* Create a checkbox column.
152172
*

‎src/Html/ColumnDefinition.php‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespaceYajra\DataTables\Html;
4+
5+
useIlluminate\Support\Fluent;
6+
7+
class ColumnDefinitionextends Fluent
8+
{
9+
use HasOptions;
10+
11+
publicfunctiontargets($value)
12+
{
13+
$this->attributes['targets'] = (array)$value;
14+
15+
return$this;
16+
}
17+
}

‎src/Html/ColumnDefinitions.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespaceYajra\DataTables\Html;
4+
5+
useIlluminate\Support\Collection;
6+
7+
class ColumnDefinitionsextends Collection
8+
{
9+
10+
}

‎src/Html/HasOptions.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ trait HasOptions
2727
useOptions\Plugins\RowReorder;
2828
useOptions\Plugins\Scroller;
2929
useOptions\Plugins\Select;
30+
useOptions\Plugins\SearchPanes;
3031

3132
/**
3233
* Set deferLoading option value.

‎src/Html/Options/HasColumns.php‎

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
useIlluminate\Support\Collection;
66
useIlluminate\Support\Str;
77
useYajra\DataTables\Html\Column;
8+
useIlluminate\Contracts\Support\Arrayable;
89

910
/**
1011
* DataTables - Columns option builder.
@@ -16,17 +17,47 @@ trait HasColumns
1617
/**
1718
* Set columnDefs option value.
1819
*
19-
* @paramarray $value
20+
* @parammixed $value
2021
* @return $this
2122
* @see https://datatables.net/reference/option/columnDefs
2223
*/
23-
publicfunctioncolumnDefs(array$value)
24+
publicfunctioncolumnDefs($value)
2425
{
26+
if (is_callable($value)) {
27+
$value =app()->call($value);
28+
}
29+
30+
if ($valueinstanceof Arrayable) {
31+
$value =$value->toArray();
32+
}
33+
2534
$this->attributes['columnDefs'] =$value;
2635

2736
return$this;
2837
}
2938

39+
/**
40+
* Add a columnDef option.
41+
*
42+
* @param mixed $value
43+
* @return $this
44+
* @see https://datatables.net/reference/option/columnDefs
45+
*/
46+
publicfunctionaddColumnDef($value)
47+
{
48+
if (is_callable($value)) {
49+
$value =app()->call($value);
50+
}
51+
52+
if ($valueinstanceof Arrayable) {
53+
$value =$value->toArray();
54+
}
55+
56+
$this->attributes['columnDefs'][] =$value;
57+
58+
return$this;
59+
}
60+
3061
/**
3162
* Set columns option value.
3263
*
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespaceYajra\DataTables\Html\Options\Plugins;
4+
5+
useYajra\DataTables\Html\SearchPane;
6+
useIlluminate\Contracts\Support\Arrayable;
7+
8+
/**
9+
* DataTables - Search panes plugin option builder.
10+
*
11+
* @see https://datatables.net/extensions/searchpanes
12+
* @see https://datatables.net/reference/option/searchPanes
13+
*/
14+
trait SearchPanes
15+
{
16+
/**
17+
* Set searchPane option value.
18+
*
19+
* @param bool|array $value
20+
* @return $this
21+
* @see https://datatables.net/reference/option/searchPanes
22+
*/
23+
publicfunctionsearchPanes($value =true)
24+
{
25+
if (is_callable($value)) {
26+
$value =app()->call($value);
27+
}
28+
29+
if ($valueinstanceof Arrayable) {
30+
$value =$value->toArray();
31+
}
32+
33+
if (is_bool($value)) {
34+
$value = SearchPane::make()->show($value)->toArray();
35+
}
36+
37+
$this->attributes['searchPanes'] =$value;
38+
39+
return$this;
40+
}
41+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp