Skip to content

Commit a843204

Browse files
committed
Changes
1 parent f280c14 commit a843204

File tree

7 files changed

+20
-53
lines changed

7 files changed

+20
-53
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7-
## [1.10.5] - 2021-07-10
7+
## [1.11.0] - 2021-07-10
8+
9+
### Added
10+
11+
- [Added `addAttributes` method to column headers](https://github.com/rappasoft/laravel-livewire-tables/pull/379)
812

913
### Changed
1014

@@ -421,8 +425,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
421425

422426
- Initial release
423427

424-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.5...development
425-
[1.10.5]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.4...v1.10.5
428+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.11.0...development
429+
[1.11.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.4...v1.11.0
426430
[1.10.4]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.3...v1.10.4
427431
[1.10.3]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.2...v1.10.3
428432
[1.10.2]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.10.1...v1.10.2

resources/views/bootstrap-4/components/table/heading.blade.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,17 @@
44
'sortable' => null,
55
'direction' => null,
66
'text' => null,
7+
'customAttributes' => [],
78
])
89

9-
@php
10-
$headerAttributesList = [];
11-
$headerAttributesList[] = ['class' => $attributes->get('class')];
12-
$headerAttributesList[] = $attributes->get('extraAttributes') ?? [];
13-
14-
$headerAttributes = '';
15-
collect($headerAttributesList)->each(function($item) use(&$headerAttributes) {
16-
if(count($item)) {
17-
$headerAttributes .= collect($item)->map(fn($value, $key) => $key . '="' . $value . '"')->implode(' ');
18-
}
19-
});
20-
21-
@endphp
22-
2310
@unless ($sortingEnabled && $sortable)
24-
<th {!! $headerAttributes !!}>
11+
<th {{ $attributes->merge($customAttributes) }}>
2512
{{ $text ?? $slot }}
2613
</th>
2714
@else
2815
<th
2916
wire:click="sortBy('{{ $column }}', '{{ $text ?? $column }}')"
30-
{!! $headerAttributes !!}
17+
{{ $attributes->merge($customAttributes) }}
3118
style="cursor:pointer;"
3219
>
3320
<div class="d-flex align-items-center">

resources/views/bootstrap-4/includes/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
:direction="$column->column() ? $sorts[$column->column()] ?? null : null"
2828
:text="$column->text() ?? ''"
2929
:class="$column->class() ?? ''"
30-
:extraAttributes="$column->attributes()"
30+
:customAttributes="$column->attributes()"
3131
/>
3232
@endif
3333
@endif

resources/views/bootstrap-5/components/table/heading.blade.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,17 @@
44
'sortable' => null,
55
'direction' => null,
66
'text' => null,
7+
'customAttributes' => [],
78
])
89

9-
@php
10-
$headerAttributesList = [];
11-
$headerAttributesList[] = ['class' => $attributes->get('class')];
12-
$headerAttributesList[] = $attributes->get('extraAttributes') ?? [];
13-
14-
$headerAttributes = '';
15-
collect($headerAttributesList)->each(function($item) use(&$headerAttributes) {
16-
if(count($item)) {
17-
$headerAttributes .= collect($item)->map(fn($value, $key) => $key . '="' . $value . '"')->implode(' ');
18-
}
19-
});
20-
21-
@endphp
22-
2310
@unless ($sortingEnabled && $sortable)
24-
<th {!! $headerAttributes !!}>
11+
<th {{ $attributes->merge($customAttributes) }}>
2512
{{ $text ?? $slot }}
2613
</th>
2714
@else
2815
<th
2916
wire:click="sortBy('{{ $column }}', '{{ $text ?? $column }}')"
30-
{!! $headerAttributes !!}
17+
{{ $attributes->merge($customAttributes) }}
3118
style="cursor:pointer;"
3219
>
3320
<div class="d-flex align-items-center">

resources/views/bootstrap-5/includes/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class="form-check-input"
2828
:direction="$column->column() ? $sorts[$column->column()] ?? null : null"
2929
:text="$column->text() ?? ''"
3030
:class="$column->class() ?? ''"
31-
:extraAttributes="$column->attributes()"
31+
:customAttributes="$column->attributes()"
3232
/>
3333
@endif
3434
@endif

resources/views/tailwind/components/table/heading.blade.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,12 @@
44
'sortable' => null,
55
'direction' => null,
66
'text' => null,
7+
'customAttributes' => [],
78
])
89

9-
@php
10-
$headerAttributesList = [];
11-
$headerAttributesList[] = ['class' => 'px-3 py-2 md:px-6 md:py-3 bg-gray-50 ' . $attributes->get('class')];
12-
$headerAttributesList[] = $attributes->get('extraAttributes') ?? [];
13-
14-
$headerAttributes = '';
15-
collect($headerAttributesList)->each(function($item) use(&$headerAttributes) {
16-
if(count($item)) {
17-
$headerAttributes .= collect($item)->map(fn($value, $key) => $key . '="' . $value . '"')->implode(' ');
18-
}
19-
});
20-
21-
@endphp
22-
23-
<th {!! $headerAttributes !!}>
10+
<th
11+
{{ $attributes->merge(array_merge(['class' => 'px-3 py-2 md:px-6 md:py-3 bg-gray-50'], $customAttributes)) }}
12+
>
2413
@unless ($sortingEnabled && $sortable)
2514
<span class="block text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
2615
{{ $text ?? $slot }}

resources/views/tailwind/includes/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class="rounded-md shadow-sm border-gray-300 block transition duration-150 ease-i
3030
:direction="$column->column() ? $sorts[$column->column()] ?? null : null"
3131
:text="$column->text() ?? ''"
3232
:class="$column->class() ?? ''"
33-
:extraAttributes="$column->attributes()"
33+
:customAttributes="$column->attributes()"
3434
/>
3535
@endif
3636
@endif

0 commit comments

Comments
 (0)