|
1 | | -@aware([ 'tableName','isTailwind','isBootstrap']) |
2 | 1 | @props(['column', 'index']) |
3 | 2 |
|
4 | 3 | @php |
5 | | - $attributes = $attributes->merge(['wire:key' => $tableName . '-header-col-'.$column->getSlug()]); |
6 | 4 | $allThAttributes = $this->getAllThAttributes($column); |
7 | | -
|
8 | 5 | $customThAttributes = $allThAttributes['customAttributes']; |
9 | 6 | $customSortButtonAttributes = $allThAttributes['sortButtonAttributes']; |
10 | | - $customSortIconAttributes = $allThAttributes['sortIconAttributes']; |
11 | 7 | $customLabelAttributes = $allThAttributes['labelAttributes']; |
12 | | -
|
13 | | - //$customThAttributes = $this->getThAttributes($column); |
14 | | - //$customSortButtonAttributes = $this->getThSortButtonAttributes($column); |
15 | | - //$customSortIconAttributes = $this->getThSortIconAttributes($column); |
16 | | -
|
17 | | - $direction = $column->hasField() ? $this->getSort($column->getColumnSelectName()) : $this->getSort($column->getSlug()) ?? null ; |
| 8 | + $customIconAttributes = $this->getThSortIconAttributes($column); |
| 9 | + $direction = $column->hasField() ? $this->getSort($column->getColumnSelectName()) : $this->getSort($column->getSlug()) ?? null; |
18 | 10 | @endphp |
19 | 11 |
|
20 | | -@if ($isTailwind) |
21 | | - <th scope="col" {{ |
22 | | - $attributes->merge($customThAttributes) |
23 | | - ->class(['text-gray-500 dark:bg-gray-800 dark:text-gray-400' => (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true))]) |
24 | | - ->class(['px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true))]) |
25 | | - ->class(['hidden' => $column->shouldCollapseAlways()]) |
26 | | - ->class(['hidden md:table-cell' => $column->shouldCollapseOnMobile()]) |
27 | | - ->class(['hidden lg:table-cell' => $column->shouldCollapseOnTablet()]) |
28 | | - ->except(['default', 'default-colors', 'default-styling']) |
29 | | - }} |
30 | | - > |
31 | | - @if($column->getColumnLabelStatus()) |
32 | | - @unless ($this->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback())) |
33 | | - <span {{ $customLabelAttributes->except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}</span> |
34 | | - @else |
35 | | - <button wire:click="sortBy('{{ $column->getColumnSortKey() }}')" |
36 | | - {{ |
| 12 | +<th {{ |
| 13 | + $attributes->merge($customThAttributes) |
| 14 | + ->class([ |
| 15 | + 'text-gray-500 dark:bg-gray-800 dark:text-gray-400' => $this->isTailwind && (($customThAttributes['default-colors'] ?? true) || ($customThAttributes['default'] ?? true)), |
| 16 | + 'px-6 py-3 text-left text-xs font-medium whitespace-nowrap uppercase tracking-wider' => $this->isTailwind && (($customThAttributes['default-styling'] ?? true) || ($customThAttributes['default'] ?? true)), |
| 17 | + 'hidden' => $this->isTailwind && $column->shouldCollapseAlways(), |
| 18 | + 'hidden md:table-cell' => $this->isTailwind && $column->shouldCollapseOnMobile(), |
| 19 | + 'hidden lg:table-cell' => $this->isTailwind && $column->shouldCollapseOnTablet(), |
| 20 | + '' => $this->isBootstrap && ($customThAttributes['default'] ?? true), |
| 21 | + 'd-none' => $this->isBootstrap && $column->shouldCollapseAlways(), |
| 22 | + 'd-none d-md-table-cell' => $this->isBootstrap && $column->shouldCollapseOnMobile(), |
| 23 | + 'd-none d-lg-table-cell' => $this->isBootstrap && $column->shouldCollapseOnTablet(), |
| 24 | + ]) |
| 25 | + ->except(['default', 'default-colors', 'default-styling']) |
| 26 | +}}> |
| 27 | + @if($column->getColumnLabelStatus()) |
| 28 | + @unless ($this->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback())) |
| 29 | + <x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" /> |
| 30 | + @else |
| 31 | + @if ($this->isTailwind) |
| 32 | + |
| 33 | + <button wire:click="sortBy('{{ $column->getColumnSortKey() }}')" {{ |
37 | 34 | $attributes->merge($customSortButtonAttributes) |
38 | | - ->class(['text-gray-500 dark:text-gray-400' => (($customSortButtonAttributes['default-colors'] ?? true) || ($customSortButtonAttributes['default'] ?? true))]) |
39 | | - ->class(['flex items-center space-x-1 text-left text-xs leading-4 font-medium uppercase tracking-wider group focus:outline-none' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true))]) |
40 | | - ->except(['default', 'default-colors', 'default-styling', 'wire:key']) |
41 | | - }} |
42 | | - > |
43 | | - <span {{ $customLabelAttributes->except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}</span> |
44 | | - <x-livewire-tables::table.th.sort-icons :$direction |
45 | | - {{ |
46 | | - $attributes->merge($customSortIconAttributes) |
| 35 | + ->class([ |
| 36 | + 'text-gray-500 dark:text-gray-400' => (($customSortButtonAttributes['default-colors'] ?? true) || ($customSortButtonAttributes['default'] ?? true)), |
| 37 | + 'flex items-center space-x-1 text-left text-xs leading-4 font-medium uppercase tracking-wider group focus:outline-none' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true)), |
| 38 | + ]) |
47 | 39 | ->except(['default', 'default-colors', 'default-styling', 'wire:key']) |
48 | | - }} |
49 | | - /> |
50 | | - |
| 40 | + }}> |
| 41 | + <x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" /> |
| 42 | + <x-livewire-tables::table.th.sort-icons :$direction :$customIconAttributes /> |
51 | 43 | </button> |
52 | | - @endunless |
53 | | - @endif |
54 | | - </th> |
55 | | -@elseif ($isBootstrap) |
56 | | - <th scope="col" {{ |
57 | | - $attributes->merge($customThAttributes) |
58 | | - ->class(['' => $customThAttributes['default'] ?? true]) |
59 | | - ->class(['d-none' => $column->shouldCollapseAlways()]) |
60 | | - ->class(['d-none d-md-table-cell' => $column->shouldCollapseOnMobile()]) |
61 | | - ->class(['d-none d-lg-table-cell' => $column->shouldCollapseOnTablet()]) |
62 | | - ->except(['default','default-styling','default-colors']) |
63 | | - }} |
64 | | - > |
65 | | - @if($column->getColumnLabelStatus()) |
66 | | - @unless ($this->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback())) |
67 | | - <span {{ $customLabelAttributes->except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}</span> |
68 | | - @else |
69 | | - <div |
70 | | - class="d-flex align-items-center laravel-livewire-tables-cursor" |
71 | | - wire:click="sortBy('{{ $column->getColumnSortKey() }}')" |
72 | | - {{ |
| 44 | + @elseif ($this->isBootstrap) |
| 45 | + <div wire:click="sortBy('{{ $column->getColumnSortKey() }}')" {{ |
73 | 46 | $attributes->merge($customSortButtonAttributes) |
74 | | - ->class(['' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true))]) |
| 47 | + ->class(['d-flex align-items-center laravel-livewire-tables-cursor' => (($customSortButtonAttributes['default-styling'] ?? true) || ($customSortButtonAttributes['default'] ?? true))]) |
75 | 48 | ->except(['default', 'default-colors', 'default-styling', 'wire:key']) |
76 | | - }} |
77 | | - > |
78 | | - <span {{ $customLabelAttributes->except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}</span> |
| 49 | + }}> |
| 50 | + <x-livewire-tables::table.th.label :$customLabelAttributes :columnTitle="$column->getTitle()" /> |
| 51 | + <x-livewire-tables::table.th.sort-icons :$direction :$customIconAttributes /> |
79 | 52 |
|
80 | | - <x-livewire-tables::table.th.sort-icons :$direction {{ |
81 | | - $attributes->merge($customSortButtonAttributes) |
82 | | - ->class(['' => (($customSortButtonAttributes['default-colors'] ?? true) || ($customSortButtonAttributes['default'] ?? true))]) |
83 | | - ->except(['default', 'default-colors', 'default-styling', 'wire:key']) |
84 | | - }} |
85 | | - /> |
86 | 53 | </div> |
87 | | - @endunless |
88 | | - @endif |
89 | | - </th> |
90 | | -@endif |
| 54 | + @endif |
| 55 | + |
| 56 | + @endunless |
| 57 | + @endif |
| 58 | +</th> |
0 commit comments