Skip to content

Commit 73de220

Browse files
committed
Add Extra Logic
1 parent 761f8ae commit 73de220

File tree

14 files changed

+129
-53
lines changed

14 files changed

+129
-53
lines changed

resources/views/components/tfoot/tr/footer-titles.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@aware(['tableName','isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'showBulkActionsSections', 'showCollapsingColumnSections','selectedVisibleColumns'])
1+
@aware(['tableName','isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'showBulkActionsSections', 'showCollapsingColumnSections','selectedVisibleColumns', 'currentRows'])
22

33
<x-livewire-tables::table.tr.plain :rowIndex="-1" data-id="tfoot"
4-
:customAttributes="$this->getFooterTrAttributes($this->getRows)"
4+
:customAttributes="$this->getFooterTrAttributes($currentRows)"
55
wire:key="{{ $tableName .'-footer' }}"
66
>
77
@if($currentlyReorderingStatus)

resources/views/components/tfoot/tr/footer.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@aware([ 'tableName', 'selectedVisibleColumns','showBulkActionsSections','hasCollapsingColumns', 'filterGenericData'])
1+
@aware([ 'tableName', 'selectedVisibleColumns','showBulkActionsSections','hasCollapsingColumns', 'filterGenericData', 'currentRows'])
22

33
<x-livewire-tables::table.tr.plain :rowIndex="-1" data-id="tfoot"
4-
:customAttributes="$this->getFooterTrAttributes($this->getRows)"
4+
:customAttributes="$this->getFooterTrAttributes($currentRows)"
55
wire:key="{{ $tableName .'-footer' }}"
66
>
77
@if ($showBulkActionsSections)
@@ -15,15 +15,15 @@
1515

1616
@tableloop($selectedVisibleColumns as $colIndex => $column)
1717

18-
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-footer-datatable-td-' . $column->getSlug() }}" :$column :$colIndex :customAttributes="$this->getFooterTdAttributes($column, $this->getRows, $colIndex)">
18+
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-footer-datatable-td-' . $column->getSlug() }}" :$column :$colIndex :customAttributes="$this->getFooterTdAttributes($column, $currentRows, $colIndex)">
1919

2020
@if($column->hasFooter() && $column->hasFooterCallback())
2121
@if($column->footerCallbackIsFilter())
2222
{{ $column->getFooterFilter($column->getFooterCallback(), $filterGenericData) }}
2323
@elseif($column->footerCallbackIsString())
2424
{{ $column->getFooterFilter($this->getFilterByKey($column->getFooterCallback()), $filterGenericData) }}
2525
@else
26-
{{ $column->getNewFooterContents($this->getRows) }}
26+
{{ $column->getNewFooterContents($currentRows) }}
2727
@endif
2828
@endif
2929

resources/views/components/thead/tr/header-titles.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@aware(['tableName','isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'showBulkActionsSections', 'showCollapsingColumnSections','selectedVisibleColumns'])
1+
@aware(['tableName','isTailwind', 'isTailwind4', 'isBootstrap', 'currentlyReorderingStatus', 'showBulkActionsSections', 'showCollapsingColumnSections','selectedVisibleColumns', 'currentRows'])
22

33
<x-livewire-tables::table.tr.plain :rowIndex="-1" data-id="thead"
4-
:customAttributes="$this->getHeaderTrAttributes($this->getRows)"
4+
:customAttributes="$this->getHeaderTrAttributes($currentRows)"
55
wire:key="{{ $tableName .'-header' }}"
66
>
77
@if($currentlyReorderingStatus)

resources/views/components/thead/tr/secondary-header.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@aware([ 'tableName','showBulkActionsSections', 'selectedVisibleColumns', 'hasCollapsingColumns', 'filterGenericData'])
1+
@aware([ 'tableName','showBulkActionsSections', 'selectedVisibleColumns', 'hasCollapsingColumns', 'filterGenericData', 'currentRows'])
22

33
<x-livewire-tables::table.tr.plain :rowIndex="-1"
4-
:customAttributes="$this->getSecondaryHeaderTrAttributes($this->getRows)"
4+
:customAttributes="$this->getSecondaryHeaderTrAttributes($currentRows)"
55
wire:key="{{ $tableName .'-secondary-header' }}" data-id="temp"
66
>
77
@if ($showBulkActionsSections)
@@ -13,14 +13,14 @@
1313
@endif
1414

1515
@tableloop($selectedVisibleColumns as $colIndex => $column)
16-
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-secondary-header-datatable-td-' . $column->getSlug() }}" :$column :$colIndex :customAttributes="$this->getSecondaryHeaderTdAttributes($column, $this->getRows, $colIndex)">
16+
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-secondary-header-datatable-td-' . $column->getSlug() }}" :$column :$colIndex :customAttributes="$this->getSecondaryHeaderTdAttributes($column, $currentRows, $colIndex)">
1717
@if($column->hasSecondaryHeader() && $column->hasSecondaryHeaderCallback())
1818
@if( $column->secondaryHeaderCallbackIsFilter())
1919
{{ $column->getSecondaryHeaderFilter($column->getSecondaryHeaderCallback(), $filterGenericData) }}
2020
@elseif($column->secondaryHeaderCallbackIsString())
2121
{{ $column->getSecondaryHeaderFilter($this->getFilterByKey($column->getSecondaryHeaderCallback()), $filterGenericData) }}
2222
@else
23-
{{ $column->getNewSecondaryHeaderContents($this->getRows) }}
23+
{{ $column->getNewSecondaryHeaderContents($currentRows) }}
2424
@endif
2525
@endif
2626
</x-livewire-tables::table.td.plain>

resources/views/components/wrapper.blade.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
<div wire:key="{{ $tableName }}-wrapper" >
33
<div {{ $attributes
44
->merge($this->getComponentWrapperAttributes())
5-
->merge($this->hasRefresh() ? [
6-
'wire:poll'.$this->getRefreshOptions() => '',
7-
] : [])
8-
->merge($this->isFilterLayoutSlideDown() ? [
9-
'wire:ignore.self' => '',
10-
] : [])
115
}}>
126

137
<div>

src/Traits/Core/Search/HandlesSearchStatus.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,24 @@ public function getSearchStatus(): bool
1414
return $this->searchStatus;
1515
}
1616

17-
#[Computed]
17+
18+
19+
/**
20+
* Undocumented function
21+
* #[Computed]
22+
* @return boolean
23+
*/
1824
public function showSearchField(): bool
1925
{
2026
return $this->searchIsEnabled() && $this->searchVisibilityIsEnabled();
2127
}
2228

23-
#[Computed]
29+
30+
/**
31+
* Undocumented function
32+
* #[Computed]
33+
* @return boolean
34+
*/
2435
public function searchIsEnabled(): bool
2536
{
2637
return $this->getSearchStatus() === true;

src/Traits/Core/Search/HandlesSearchVisibility.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ public function getSearchVisibilityStatus(): bool
1313
return $this->searchVisibilityStatus;
1414
}
1515

16-
#[Computed]
16+
17+
/**
18+
* Undocumented function
19+
* #[Computed]
20+
* @return boolean
21+
*/
1722
public function searchVisibilityIsEnabled(): bool
1823
{
1924
return $this->getSearchVisibilityStatus() === true;

src/Traits/Core/Search/Styling/HasSearchIcon.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,53 @@ trait HasSearchIcon
1212

1313
protected array $searchIconAttributes = ['class' => 'h-4 w-4', 'style' => 'color: #000000'];
1414

15-
#[Computed]
15+
16+
/**
17+
* Undocumented function
18+
* #[Computed]
19+
* @return boolean
20+
*/
1621
public function hasSearchIcon(): bool
1722
{
1823
return $this->searchIconSet;
1924
}
2025

21-
#[Computed]
26+
/**
27+
* Undocumented function
28+
* #[Computed]
29+
* @return string
30+
*/
2231
public function getSearchIcon(): string
2332
{
2433
return $this->hasSearchIcon() ? $this->searchIcon : 'heroicon-m-magnifying-glass';
2534
}
2635

27-
#[Computed]
36+
/**
37+
* Undocumented function
38+
* #[Computed]
39+
* @return string
40+
*/
2841
public function getSearchIconClasses(): string
2942
{
3043
return $this->getSearchIconAttributes()['class'];
3144

3245
}
3346

34-
#[Computed]
47+
/**
48+
* Undocumented function
49+
* #[Computed]
50+
* @return array
51+
*/
3552
public function getSearchIconAttributes(): array
3653
{
3754
return $this->searchIconAttributes;
3855
}
3956

40-
#[Computed]
57+
/**
58+
* Undocumented function
59+
* #[Computed]
60+
* @return array
61+
*/
4162
public function getSearchIconOtherAttributes(): array
4263
{
4364
return collect($this->getSearchIconAttributes())->except('class')->toArray();

src/Traits/Filters/Helpers/FilterStatusHelpers.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ public function getFiltersStatus(): bool
1111
return $this->filtersStatus;
1212
}
1313

14-
#[Computed]
14+
/**
15+
* Undocumented function
16+
* #[Computed]
17+
* @return boolean
18+
*/
1519
public function filtersAreEnabled(): bool
1620
{
1721
return $this->getFiltersStatus() === true;

src/Traits/Helpers/TableAttributeHelpers.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
trait TableAttributeHelpers
1111
{
12-
#[Computed]
1312
public function getCoreTableAttributes(): array
1413
{
1514
return [
@@ -20,31 +19,41 @@ public function getCoreTableAttributes(): array
2019
];
2120
}
2221

23-
#[Computed]
2422
public function getComponentWrapperAttributes(): array
2523
{
26-
return count($this->componentWrapperAttributes) ? $this->componentWrapperAttributes : ['id' => 'datatable-'.$this->getId()];
24+
$coreAttribs = [
25+
'id' => 'datatable-'.$this->getId(),
26+
];
27+
28+
if ($this->hasRefresh())
29+
{
30+
$coreAttribs['wire:poll'.$this->getRefreshOptions()] = '';
31+
}
32+
if($this->isFilterLayoutSlideDown())
33+
{
34+
$coreAttribs['wire:ignore.self'] = '';
35+
}
36+
37+
return([
38+
...$coreAttribs,
39+
...$this->componentWrapperAttributes]);
2740
}
2841

29-
#[Computed]
3042
public function getTableWrapperAttributes(): array
3143
{
3244
return array_merge(['wire:key' => $this->getTableName().'-twrap'], (count($this->tableWrapperAttributes) ? $this->tableWrapperAttributes : ['default' => true]));
3345
}
3446

35-
#[Computed]
3647
public function getTableAttributes(): array
3748
{
3849
return array_merge(['wire:key' => $this->getTableName().'-table', 'id' => 'table-'.$this->getTableName()], (count($this->tableAttributes) ? $this->tableAttributes : ['default' => true]));
3950
}
4051

41-
#[Computed]
4252
public function getTheadAttributes(): array
4353
{
4454
return array_merge(['wire:key' => $this->getTableName().'-thead'], (count($this->theadAttributes) ? $this->theadAttributes : ['default' => true]));
4555
}
4656

47-
#[Computed]
4857
public function getTbodyAttributes(): array
4958
{
5059
return array_merge(['wire:key' => $this->getTableName().'-tbody', 'id' => $this->getTableName().'-tbody'], (count($this->tbodyAttributes) ? $this->tbodyAttributes : ['default' => true]));
@@ -53,7 +62,6 @@ public function getTbodyAttributes(): array
5362
/**
5463
* Used in resources/views/components/table/th.blade.php
5564
*/
56-
#[Computed]
5765
public function getThAttributes(Column $column): array
5866
{
5967

@@ -67,7 +75,6 @@ public function getThAttributes(Column $column): array
6775
/**
6876
* Used in resources/views/components/table/th.blade.php
6977
*/
70-
#[Computed]
7178
public function getThSortButtonAttributes(Column $column): array
7279
{
7380
if (isset($this->thSortButtonAttributesCallback)) {
@@ -80,7 +87,6 @@ public function getThSortButtonAttributes(Column $column): array
8087
/**
8188
* Used in resources/views/components/table/th.blade.php
8289
*/
83-
#[Computed]
8490
public function getThSortIconAttributes(Column $column): array
8591
{
8692
if (isset($this->thSortIconAttributesCallback)) {
@@ -93,7 +99,6 @@ public function getThSortIconAttributes(Column $column): array
9399
/**
94100
* Used in resources/views/components/table/th.blade.php
95101
*/
96-
#[Computed]
97102
public function getAllThAttributes(Column $column): array
98103
{
99104
return [
@@ -104,19 +109,16 @@ public function getAllThAttributes(Column $column): array
104109
];
105110
}
106111

107-
#[Computed]
108112
public function hasTrAttributes(): bool
109113
{
110114
return isset($this->trAttributesCallback);
111115
}
112116

113-
#[Computed]
114117
public function getTrAttributes(Model $row, int $index): array
115118
{
116119
return isset($this->trAttributesCallback) ? call_user_func($this->trAttributesCallback, $row, $index) : ['default' => true];
117120
}
118121

119-
#[Computed]
120122
public function getTdAttributes(Column $column, Model $row, int $colIndex, int $rowIndex): array
121123
{
122124
return isset($this->tdAttributesCallback) ? call_user_func($this->tdAttributesCallback, $column, $row, $colIndex, $rowIndex) : ['default' => true];

0 commit comments

Comments
 (0)