Skip to content

Commit fd13aa9

Browse files
authored
Add before-wrapper and after-wrapper configurable areas (rappasoft#1977)
1 parent 905b43c commit fd13aa9

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

docs/datatable/configurable-areas.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ You can use the `setConfigurableAreas` method to set multiple areas that you wan
2626
public function configure(): void
2727
{
2828
$this->setConfigurableAreas([
29+
'before-wrapper' => 'path.to.my.view',
2930
'before-tools' => 'path.to.my.view',
3031
'toolbar-left-start' => 'path.to.my.view',
3132
'toolbar-left-end' => 'path.to.my.view',
@@ -35,6 +36,7 @@ public function configure(): void
3536
'after-toolbar' => 'path.to.my.view',
3637
'before-pagination' => 'path.to.my.view',
3738
'after-pagination' => 'path.to.my.view',
39+
'after-wrapper' => 'path.to.my.view',
3840
]);
3941
}
4042
```

resources/views/datatable.blade.php

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,24 @@
77
@php($isBootstrap5 = $this->isBootstrap5)
88

99
<div {{ $this->getTopLevelAttributes() }}>
10+
11+
@includeWhen(
12+
$this->hasConfigurableAreaFor('before-wrapper'),
13+
$this->getConfigurableAreaFor('before-wrapper'),
14+
$this->getParametersForConfigurableArea('before-wrapper')
15+
)
16+
1017
<x-livewire-tables::wrapper :component="$this" :tableName="$tableName" :$primaryKey :$isTailwind :$isBootstrap :$isBootstrap4 :$isBootstrap5>
1118
@if($this->hasActions && !$this->showActionsInToolbar)
1219
<x-livewire-tables::includes.actions/>
1320
@endif
1421

1522

16-
@if ($this->hasConfigurableAreaFor('before-tools'))
17-
@include($this->getConfigurableAreaFor('before-tools'), $this->getParametersForConfigurableArea('before-tools'))
18-
@endif
23+
@includeWhen(
24+
$this->hasConfigurableAreaFor('before-tools'),
25+
$this->getConfigurableAreaFor('before-tools'),
26+
$this->getParametersForConfigurableArea('before-tools')
27+
)
1928

2029
@if($this->shouldShowTools)
2130
<x-livewire-tables::tools>
@@ -26,11 +35,21 @@
2635
<x-livewire-tables::tools.filter-pills />
2736
@endif
2837

29-
@includeWhen($this->hasConfigurableAreaFor('before-toolbar'), $this->getConfigurableAreaFor('before-toolbar'), $this->getParametersForConfigurableArea('before-toolbar'))
38+
@includeWhen(
39+
$this->hasConfigurableAreaFor('before-toolbar'),
40+
$this->getConfigurableAreaFor('before-toolbar'),
41+
$this->getParametersForConfigurableArea('before-toolbar')
42+
)
43+
3044
@if($this->shouldShowToolBar)
3145
<x-livewire-tables::tools.toolbar />
3246
@endif
33-
@includeWhen($this->hasConfigurableAreaFor('after-toolbar'), $this->getConfigurableAreaFor('after-toolbar'), $this->getParametersForConfigurableArea('after-toolbar'))
47+
48+
@includeWhen(
49+
$this->hasConfigurableAreaFor('after-toolbar'),
50+
$this->getConfigurableAreaFor('after-toolbar'),
51+
$this->getParametersForConfigurableArea('after-toolbar')
52+
)
3453

3554
</x-livewire-tables::tools>
3655
@endif
@@ -110,4 +129,11 @@
110129

111130
@includeIf($customView)
112131
</x-livewire-tables::wrapper>
132+
133+
@includeWhen(
134+
$this->hasConfigurableAreaFor('after-wrapper'),
135+
$this->getConfigurableAreaFor('after-wrapper'),
136+
$this->getParametersForConfigurableArea('after-wrapper')
137+
)
138+
113139
</div>

0 commit comments

Comments
 (0)