Skip to content

Commit

Permalink
Spacing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rappasoft committed Sep 18, 2023
1 parent b68ab26 commit e609f13
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 89 deletions.
2 changes: 1 addition & 1 deletion resources/views/components/table/td/plain.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
->class(['hidden sm:table-cell' => $column && $column->shouldCollapseOnMobile()])
->class(['hidden md:table-cell' => $column && $column->shouldCollapseOnTablet()])
->except('default')
}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
}} @if($hideUntilReorder) x-show="reorderDisplayColumn" @endif >
{{ $slot }}
</td>
@elseif ($component->isBootstrap())
Expand Down
6 changes: 4 additions & 2 deletions resources/views/components/table/th.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
->class(['hidden sm:table-cell' => $column->shouldCollapseOnMobile()])
->class(['hidden md:table-cell' => $column->shouldCollapseOnTablet()])
->except('default')
}}>
}}
>
@unless ($component->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback()))
{{ $column->getTitle() }}
@else
Expand Down Expand Up @@ -50,7 +51,8 @@
->class(['d-none d-sm-table-cell' => $column->shouldCollapseOnMobile()])
->class(['d-none d-md-table-cell' => $column->shouldCollapseOnTablet()])
->except('default')
}}>
}}
>
@unless ($component->sortingIsEnabled() && ($column->isSortable() || $column->getSortCallback()))
{{ $column->getTitle() }}
@else
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/table/th/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@php($theme = $component->getTheme())

@if ($component->bulkActionsAreEnabled() && $component->hasBulkActions())
<x-livewire-tables::table.th.plain wire:key="{{ $tableName }}-thead-bulk-actions" :displayMinimisedOnReorder="true" >
<x-livewire-tables::table.th.plain wire:key="{{ $tableName }}-thead-bulk-actions" :displayMinimisedOnReorder="true">
<div
x-data="{newSelectCount: 0, indeterminateCheckbox: false, bulkActionHeaderChecked: false}"
x-init="$watch('selectedItems', value => indeterminateCheckbox = (value.length > 0 && value.length < paginationTotalItemCount))"
Expand Down
2 changes: 2 additions & 0 deletions resources/views/components/table/tr/bulk-actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class="ml-1 text-blue-600 underline text-gray-700 text-sm leading-5 font-medium
</button>
</div>
</template>

<template x-if="selectedItems.length !== paginationTotalItemCount">
<div wire:key="{{ $tableName }}-some-selected">
<span>
Expand Down Expand Up @@ -98,6 +99,7 @@ class="btn btn-primary btn-sm"
</button>
</div>
</template>

<template x-if="selectedItems.length !== paginationTotalItemCount">
<div wire:key="{{ $tableName }}-some-selected">
<span>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/table/tr/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
wire:key="{{ $tableName .'-footer' }}"
>
{{-- TODO: Remove --}}
<x-livewire-tables::table.td.plain x-cloak x-show="currentlyReorderingStatus" wire:key="{{ $tableName . '-footer-hidden-test' }}" />
<x-livewire-tables::table.td.plain x-cloak x-show="currentlyReorderingStatus" wire:key="{{ $tableName . '-footer-hidden-test' }}" />

@if ($this->collapsingColumnsAreEnabled() && $this->hasCollapsedColumns())
<x-livewire-tables::table.td.row-contents :displayMinimisedOnReorder="true" rowIndex="-1" :hidden="true" wire:key="{{ $tableName.'-footer-collapse' }}" />
@endif

{{-- TODO: Remove --}}
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-footer-hidden-tes2t' }}" />
<x-livewire-tables::table.td.plain wire:key="{{ $tableName . '-footer-hidden-tes2t' }}" />

@foreach($this->getColumns() as $colIndex => $column)
@continue($column->isHidden())
Expand Down
23 changes: 10 additions & 13 deletions resources/views/components/table/tr/plain.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@

@if ($component->isTailwind())
<tr {{ $attributes
->merge($customAttributes)
->class(['bg-white dark:bg-gray-700 dark:text-white' => $customAttributes['default'] ?? true])
->class(['laravel-livewire-tables-reorderingMinimised'])
->except('default')
}}


->merge($customAttributes)
->class(['bg-white dark:bg-gray-700 dark:text-white' => $customAttributes['default'] ?? true])
->class(['laravel-livewire-tables-reorderingMinimised'])
->except('default')
}}
>
{{ $slot }}
</tr>
@elseif ($component->isBootstrap())
<tr {{ $attributes
->merge($customAttributes)
->class(['' => $customAttributes['default'] ?? true])
->class(['laravel-livewire-tables-reorderingMinimised'])
->except('default')
}}

->merge($customAttributes)
->class(['' => $customAttributes['default'] ?? true])
->class(['laravel-livewire-tables-reorderingMinimised'])
->except('default')
}}
>
{{ $slot }}
</tr>
Expand Down
14 changes: 7 additions & 7 deletions resources/views/components/tools/filters/date-range.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$endDate = isset($dateArray[2]) ? $dateArray[2] : date('Y-m-d');
$dateString = $startDate . ' to ' . $endDate;
}
}
}
Expand Down Expand Up @@ -43,18 +43,18 @@
<x-livewire-tables::tools.filter-label :filter="$filter" :filterLayout="$filterLayout" :tableName="$tableName" />
@endif

<div
<div
@class([
'w-full rounded-md shadow-sm text-right' => $isTailwind,
'd-inline-block w-100 mb-3 mb-md-0 input-group' => $isBootstrap,
])
>
<input
type="text"
x-ref="dateRangeInput"
<input
type="text"
x-ref="dateRangeInput"
x-on:click="init"
value="{{ $dateString }}"
wire:key="{{ $tableName }}-filter-dateRange-{{ $filterKey }}"
value="{{ $dateString }}"
wire:key="{{ $tableName }}-filter-dateRange-{{ $filterKey }}"
id="{{ $tableName }}-filter-dateRange-{{ $filterKey }}"
@class([
'w-full inline transition duration-150 ease-in-out border-gray-300 rounded-md shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-800 dark:text-white dark:border-gray-600' => $isTailwind,
Expand Down
127 changes: 64 additions & 63 deletions resources/views/datatable.blade.php
Original file line number Diff line number Diff line change
@@ -1,80 +1,81 @@
@php($tableName = $this->getTableName())
<div>
<x-livewire-tables::wrapper :component="$this" :tableName="$tableName">
@if ($this->hasConfigurableAreaFor('before-tools'))
@include($this->getConfigurableAreaFor('before-tools'), $this->getParametersForConfigurableArea('before-tools'))
@endif

<x-livewire-tables::tools>
<x-livewire-tables::tools.sorting-pills />
<x-livewire-tables::tools.filter-pills />
<x-livewire-tables::tools.toolbar />
</x-livewire-tables::tools>

<x-livewire-tables::table>
<x-slot name="thead">
<x-livewire-tables::table.th.reorder x-cloak x-show="currentlyReorderingStatus" />
<x-livewire-tables::table.th.bulk-actions :displayMinimisedOnReorder="true" />
<x-livewire-tables::table.th.row-contents />

@foreach($columns as $index => $column)
@continue($column->isHidden())
@continue($this->columnSelectIsEnabled() && ! $this->columnSelectIsEnabledForColumn($column))

@if($column->isReorderColumn())
<x-livewire-tables::table.th wire:key="{{ $tableName.'-table-head-'.$index }}" :displayMinimisedOnReorder="true" :column="$column" :index="$index" />
@else
<x-livewire-tables::table.th wire:key="{{ $tableName.'-table-head-'.$index }}" :column="$column" :index="$index" />
@endif
@endforeach
</x-slot>

@if($this->secondaryHeaderIsEnabled() && $this->hasColumnsWithSecondaryHeader())
<x-livewire-tables::table.tr.secondary-header :rows="$rows" />
<div>
<x-livewire-tables::wrapper :component="$this" :tableName="$tableName">
@if ($this->hasConfigurableAreaFor('before-tools'))
@include($this->getConfigurableAreaFor('before-tools'), $this->getParametersForConfigurableArea('before-tools'))
@endif

<x-livewire-tables::table.tr.bulk-actions :rows="$rows" :displayMinimisedOnReorder="true" />
<x-livewire-tables::tools>
<x-livewire-tables::tools.sorting-pills />
<x-livewire-tables::tools.filter-pills />
<x-livewire-tables::tools.toolbar />
</x-livewire-tables::tools>

@forelse ($rows as $rowIndex => $row)
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $row->{$this->getPrimaryKey()} }}" :row="$row" :rowIndex="$rowIndex">
<x-livewire-tables::table.td.reorder x-cloak x-show="currentlyReorderingStatus" wire:key="{{ $tableName }}-row-reorder-{{ $row->{$this->getPrimaryKey()} }}" :rowID="$tableName.'-'.$row->{$this->getPrimaryKey()}" :rowIndex="$rowIndex" />
<x-livewire-tables::table.td.bulk-actions wire:key="{{ $tableName }}-row-bulk-act-{{ $row->{$this->getPrimaryKey()} }}" :row="$row" :rowIndex="$rowIndex"/>
<x-livewire-tables::table.td.row-contents wire:key="{{ $tableName }}-row-collapsed-{{ $row->{$this->getPrimaryKey()} }}" :rowIndex="$rowIndex" />
<x-livewire-tables::table>
<x-slot name="thead">
<x-livewire-tables::table.th.reorder x-cloak x-show="currentlyReorderingStatus" />
<x-livewire-tables::table.th.bulk-actions :displayMinimisedOnReorder="true" />
<x-livewire-tables::table.th.row-contents />

@foreach($columns as $colIndex => $column)
@foreach($columns as $index => $column)
@continue($column->isHidden())
@continue($this->columnSelectIsEnabled() && ! $this->columnSelectIsEnabledForColumn($column))

@if($column->isReorderColumn())
<x-livewire-tables::table.td :displayMinimisedOnReorder="true" wire:key="{{ $tableName . '-' . $row->{$this->getPrimaryKey()} . '-datatable-reorder-' . $column->getSlug() }}" :column="$column" :colIndex="$colIndex">
{{ $column->renderContents($row) }}
</x-livewire-tables::table.td>
<x-livewire-tables::table.th wire:key="{{ $tableName.'-table-head-'.$index }}" :displayMinimisedOnReorder="true" :column="$column" :index="$index" />
@else
<x-livewire-tables::table.td wire:key="{{ $tableName . '-' . $row->{$this->getPrimaryKey()} . '-datatable-td-' . $column->getSlug() }}" :column="$column" :colIndex="$colIndex">
{{ $column->renderContents($row) }}
</x-livewire-tables::table.td>
<x-livewire-tables::table.th wire:key="{{ $tableName.'-table-head-'.$index }}" :column="$column" :index="$index" />
@endif
@endforeach
</x-livewire-tables::table.tr>
</x-slot>

<x-livewire-tables::table.row-contents :row="$row" :rowIndex="$rowIndex" />
@empty
<x-livewire-tables::table.empty />
@endforelse
@if($this->secondaryHeaderIsEnabled() && $this->hasColumnsWithSecondaryHeader())
<x-livewire-tables::table.tr.secondary-header :rows="$rows" />
@endif

@if ($this->footerIsEnabled() && $this->hasColumnsWithFooter())
<x-slot name="tfoot">
@if ($this->useHeaderAsFooterIsEnabled())
<x-livewire-tables::table.tr.secondary-header :rows="$rows" />
@else
<x-livewire-tables::table.tr.footer :rows="$rows" />
@endif
</x-slot>
@endif
</x-livewire-tables::table>
<x-livewire-tables::table.tr.bulk-actions :rows="$rows" :displayMinimisedOnReorder="true" />

@forelse ($rows as $rowIndex => $row)
<x-livewire-tables::table.tr wire:key="{{ $tableName }}-row-wrap-{{ $row->{$this->getPrimaryKey()} }}" :row="$row" :rowIndex="$rowIndex">
<x-livewire-tables::table.td.reorder x-cloak x-show="currentlyReorderingStatus" wire:key="{{ $tableName }}-row-reorder-{{ $row->{$this->getPrimaryKey()} }}" :rowID="$tableName.'-'.$row->{$this->getPrimaryKey()}" :rowIndex="$rowIndex" />
<x-livewire-tables::table.td.bulk-actions wire:key="{{ $tableName }}-row-bulk-act-{{ $row->{$this->getPrimaryKey()} }}" :row="$row" :rowIndex="$rowIndex"/>
<x-livewire-tables::table.td.row-contents wire:key="{{ $tableName }}-row-collapsed-{{ $row->{$this->getPrimaryKey()} }}" :rowIndex="$rowIndex" />

@foreach($columns as $colIndex => $column)
@continue($column->isHidden())
@continue($this->columnSelectIsEnabled() && ! $this->columnSelectIsEnabledForColumn($column))

@if($column->isReorderColumn())
<x-livewire-tables::table.td :displayMinimisedOnReorder="true" wire:key="{{ $tableName . '-' . $row->{$this->getPrimaryKey()} . '-datatable-reorder-' . $column->getSlug() }}" :column="$column" :colIndex="$colIndex">
{{ $column->renderContents($row) }}
</x-livewire-tables::table.td>
@else
<x-livewire-tables::table.td wire:key="{{ $tableName . '-' . $row->{$this->getPrimaryKey()} . '-datatable-td-' . $column->getSlug() }}" :column="$column" :colIndex="$colIndex">
{{ $column->renderContents($row) }}
</x-livewire-tables::table.td>
@endif
@endforeach
</x-livewire-tables::table.tr>

<x-livewire-tables::table.row-contents :row="$row" :rowIndex="$rowIndex" />
@empty
<x-livewire-tables::table.empty />
@endforelse

@if ($this->footerIsEnabled() && $this->hasColumnsWithFooter())
<x-slot name="tfoot">
@if ($this->useHeaderAsFooterIsEnabled())
<x-livewire-tables::table.tr.secondary-header :rows="$rows" />
@else
<x-livewire-tables::table.tr.footer :rows="$rows" />
@endif
</x-slot>
@endif
</x-livewire-tables::table>

<x-livewire-tables::pagination :rows="$rows" />
<x-livewire-tables::pagination :rows="$rows" />

@includeIf($customView)
</x-livewire-tables::wrapper>
</div>
@includeIf($customView)
</x-livewire-tables::wrapper>
</div>

0 comments on commit e609f13

Please sign in to comment.