-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy & Improve Collapsed Columns Behaviour (#2159)
* Tidy & Improve Collapsed Columns Behaviour * Fix styling * Add relevant tests * Fix styling --------- Co-authored-by: lrljoe <[email protected]>
- Loading branch information
Showing
18 changed files
with
587 additions
and
548 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
131 changes: 48 additions & 83 deletions
131
resources/views/components/table/td/collapsed-columns.blade.php
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 |
---|---|---|
@@ -1,87 +1,52 @@ | ||
@aware([ 'tableName','isTailwind','isBootstrap']) | ||
@props(['rowIndex', 'hidden' => false]) | ||
|
||
@if ($this->collapsingColumnsAreEnabled() && $this->hasCollapsedColumns()) | ||
@if ($isTailwind) | ||
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}" | ||
{{ | ||
$attributes | ||
->merge() | ||
->class([ | ||
'p-3 table-cell text-center', | ||
'sm:hidden' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet(), | ||
'md:hidden' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile(), | ||
'lg:hidden' => !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile()), | ||
]) | ||
}} | ||
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''" | ||
> | ||
@if (! $hidden) | ||
<button | ||
x-cloak x-show="!currentlyReorderingStatus" | ||
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open" | ||
> | ||
<x-heroicon-o-plus-circle x-cloak x-show="!open" | ||
{{ | ||
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes) | ||
->class([ | ||
'h-6 w-6' => $this->getCollapsingColumnButtonExpandAttributes['default-styling'] ?? true, | ||
'text-green-600' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true, | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
<x-heroicon-o-minus-circle x-cloak x-show="open" | ||
{{ | ||
$attributes->merge($this->getCollapsingColumnButtonCollapseAttributes) | ||
->class([ | ||
'h-6 w-6' => $this->getCollapsingColumnButtonCollapseAttributes['default-styling'] ?? true, | ||
'text-yellow-600' => $this->getCollapsingColumnButtonCollapseAttributes['default-colors'] ?? true, | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
</button> | ||
@endif | ||
</td> | ||
@elseif ($isBootstrap) | ||
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}" | ||
{{ | ||
$attributes | ||
->class([ | ||
'd-sm-none' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet(), | ||
'd-md-none' => !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile(), | ||
'd-lg-none' => !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile()), | ||
]) | ||
}} | ||
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''" | ||
> | ||
@if (! $hidden) | ||
<button | ||
x-cloak x-show="!currentlyReorderingStatus" | ||
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}});open = !open" | ||
class="border-0 bg-transparent p-0" | ||
> | ||
<x-heroicon-o-plus-circle x-cloak x-show="!open" | ||
{{ | ||
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes) | ||
->class([ | ||
'laravel-livewire-tables-btn-lg text-success' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true, | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
<x-heroicon-o-minus-circle x-cloak x-show="open" | ||
{{ | ||
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes) | ||
->class([ | ||
'laravel-livewire-tables-btn-lg text-warning' => $this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true, | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
</button> | ||
@endif | ||
</td> | ||
@endif | ||
@if ($this->collapsingColumnsAreEnabled && $this->hasCollapsedColumns) | ||
<td x-data="{open:false}" wire:key="{{ $tableName }}-collapsingIcon-{{ $rowIndex }}-{{ md5(now()) }}" | ||
{{ | ||
$attributes | ||
->merge() | ||
->class([ | ||
'p-3 table-cell text-center' => $isTailwind, | ||
'sm:hidden' => $isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet(), | ||
'md:hidden' => $isTailwind && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile(), | ||
'lg:hidden' => $isTailwind && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile()), | ||
'd-sm-none' => $isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet(), | ||
'd-md-none' => $isBootstrap && !$this->shouldCollapseAlways() && !$this->shouldCollapseOnTablet() && $this->shouldCollapseOnMobile(), | ||
'd-lg-none' => $isBootstrap && !$this->shouldCollapseAlways() && ($this->shouldCollapseOnTablet() || $this->shouldCollapseOnMobile()), | ||
]) | ||
}} | ||
:class="currentlyReorderingStatus ? 'laravel-livewire-tables-reorderingMinimised' : ''" | ||
> | ||
@if (! $hidden) | ||
<button | ||
x-cloak x-show="!currentlyReorderingStatus" | ||
x-on:click.prevent="$dispatch('toggle-row-content', {'tableName': '{{ $tableName }}', 'row': {{ $rowIndex }}}); open = !open" | ||
@class([ | ||
'border-0 bg-transparent p-0' => $isBootstrap | ||
]) | ||
> | ||
<x-heroicon-o-plus-circle x-cloak x-show="!open" {{ | ||
$attributes->merge($this->getCollapsingColumnButtonExpandAttributes) | ||
->class([ | ||
'h-6 w-6' => $isTailwind && ($this->getCollapsingColumnButtonExpandAttributes['default-styling'] ?? true), | ||
'text-green-600' => $isTailwind && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true), | ||
'laravel-livewire-tables-btn-lg text-success' => $isBootstrap && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true) | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
<x-heroicon-o-minus-circle x-cloak x-show="open" {{ | ||
$attributes->merge($this->getCollapsingColumnButtonCollapseAttributes) | ||
->class([ | ||
'h-6 w-6' => $isTailwind && ($this->getCollapsingColumnButtonCollapseAttributes['default-styling'] ?? true), | ||
'text-yellow-600' => $isTailwind && ($this->getCollapsingColumnButtonCollapseAttributes['default-colors'] ?? true), | ||
'laravel-livewire-tables-btn-lg text-warning' => $isBootstrap && ($this->getCollapsingColumnButtonExpandAttributes['default-colors'] ?? true), | ||
]) | ||
->except(['default','default-styling','default-colors']) | ||
}} | ||
/> | ||
</button> | ||
@endif | ||
</td> | ||
@endif |
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
Oops, something went wrong.