-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1249 from lee-to/table-modifiers
feat: Table modifiers
- Loading branch information
Showing
6 changed files
with
210 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MoonShine\Traits\Resource; | ||
|
||
use Closure; | ||
use Illuminate\Support\Collection; | ||
use Illuminate\View\ComponentAttributeBag; | ||
use MoonShine\ActionButtons\ActionButtons; | ||
use MoonShine\Components\TableBuilder; | ||
use MoonShine\Fields\Fields; | ||
|
||
trait ResourceWithTableModifiers | ||
{ | ||
|
||
public function trAttributes(): Closure | ||
{ | ||
return fn (mixed $data, int $row, ComponentAttributeBag $attr): ComponentAttributeBag => $attr; | ||
} | ||
|
||
public function tdAttributes(): Closure | ||
{ | ||
return fn (mixed $data, int $row, int $cell, ComponentAttributeBag $attr): ComponentAttributeBag => $attr; | ||
} | ||
|
||
/** | ||
* @return ?Closure(Fields $fields, TableBuilder $ctx): string | ||
*/ | ||
public function thead(): ?Closure | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return ?Closure(Collection $rows, TableBuilder $ctx): string | ||
*/ | ||
public function tbody(): ?Closure | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return ?Closure(ActionButtons $bulkButtons, TableBuilder $ctx): string | ||
*/ | ||
public function tfoot(): ?Closure | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return ?Closure(Collection $rows, TableBuilder $ctx): string | ||
*/ | ||
public function tbodyBefore(): ?Closure | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return ?Closure(Collection $rows, TableBuilder $ctx): string | ||
*/ | ||
public function tbodyAfter(): ?Closure | ||
{ | ||
return null; | ||
} | ||
|
||
} |