Skip to content

Commit

Permalink
Merge pull request #2093 from rappasoft/development
Browse files Browse the repository at this point in the history
 v3.5.6
  • Loading branch information
lrljoe authored Nov 28, 2024
2 parents 59eaa7b + e6e7f29 commit 72db36d
Show file tree
Hide file tree
Showing 56 changed files with 792 additions and 502 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/discord-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
uses: actions/checkout@v4
- name: Package Releases
uses: SethCohen/github-releases-to-discord@latest
env:
WEBHOOK_DISCORD_RELEASE_URL: ${{ secrets.WEBHOOK_DISCORD_RELEASE_URL }}
with:
webhook_url: ${{ secrets.WEBHOOK_DISCORD_RELEASE_URL }}
webhook_url: $WEBHOOK_DISCORD_RELEASE_URL
color: "2105893"
username: "GitHub Release-Bot"
avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-phpstan-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ jobs:
restore-keys: phpstan-${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ jobs:
restore-keys: phpstan-${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/run-tests-pcov-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ jobs:
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand All @@ -93,7 +95,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: $CODECOV_TOKEN
files: ./coverage.xml
verbose: true

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/run-tests-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ jobs:
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -147,8 +149,10 @@ jobs:
restore-keys: ${{ matrix.os }}-P${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ jobs:
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -149,8 +151,10 @@ jobs:
restore-keys: ${{ matrix.os }}-PHP${{ matrix.php }}-L${{ matrix.laravel }}-composer-

- name: Add token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer config github-oauth.github.com $GITHUB_TOKEN
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to `laravel-livewire-tables` will be documented in this file

## [v3.5.6] - 2024-11-28
### New Features
- Add Icon to Search Input by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2092

### Tweaks
- Search - Rationalisation of blades into files by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2094
- Columns() Setup Improvements by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2089
- Typehinting in blade components by @edwinvdpol in https://github.com/rappasoft/laravel-livewire-tables/pull/2081

### Testing
- Tweak Workflows to use an env key by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/2090

## [v3.5.5] - 2024-11-22
### Bug Fixes
- Fix date range filter default value by @edwinvdpol in https://github.com/rappasoft/laravel-livewire-tables/pull/2082
Expand Down
36 changes: 36 additions & 0 deletions docs/search/available-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,39 @@ public function configure(): void
$this->setTrimSearchStringDisabled();
}
```

## Search Icon

To help customise, a "Search Input Icon" has been added, allowing for the addition of an icon to the search input field.

At present, the Search Icon is only available as a "left aligned" icon.

This is presently only available for Tailwind implementations

### setSearchIcon

This adds an Icon to the Search Input Field, which expects an icon path (e.g. heroicon-m-magnifying-glass)

```php
public function configure(): void
{
$this->setSearchIcon('heroicon-m-magnifying-glass');
}
```

### setSearchIconAttributes

This allows you to specify attributes for the Search Icon for the Input Field.

Note that classes will be injected prior to styles, due to the behaviour of icons.

```php
public function configure(): void
{
$this->setSearchIconAttributes([
'class' => 'h-4 w-4',
'style' => 'color: #000000',
]);
}

```
12 changes: 6 additions & 6 deletions resources/views/components/includes/actions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
->class(['' => $this->isTailwind && $this->getActionWrapperAttributes['default-colors'] ?? true])
->class(['d-flex flex-cols py-2 space-x-2' => $this->isBootstrap && $this->getActionWrapperAttributes['default-styling'] ?? true])
->class(['' => $this->isBootstrap && $this->getActionWrapperAttributes['default-colors'] ?? true])
->class(['justify-start' => $this->getActionsPosition == 'left'])
->class(['justify-center' => $this->getActionsPosition == 'center'])
->class(['justify-end' => $this->getActionsPosition == 'right'])
->class(['pl-2' => $this->showActionsInToolbar && $this->getActionsPosition == 'left'])
->class(['pr-2' => $this->showActionsInToolbar && $this->getActionsPosition == 'right'])
->class(['justify-start' => $this->getActionsPosition === 'left'])
->class(['justify-center' => $this->getActionsPosition === 'center'])
->class(['justify-end' => $this->getActionsPosition === 'right'])
->class(['pl-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'left'])
->class(['pr-2' => $this->showActionsInToolbar && $this->getActionsPosition === 'right'])
->except(['default','default-styling','default-colors'])
}} >
@foreach($this->getActions as $action)
{{ $action->render() }}
@endforeach
</div>
</div>
9 changes: 4 additions & 5 deletions resources/views/components/includes/loading.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
@props(['colCount' => 1])

@php
$loaderRow = $this->getLoadingPlaceHolderRowAttributes();
$loaderCell = $this->getLoadingPlaceHolderCellAttributes();
$loaderIcon = $this->getLoadingPlaceHolderIconAttributes();
$loaderRow = $this->getLoadingPlaceHolderRowAttributes();
$loaderCell = $this->getLoadingPlaceHolderCellAttributes();
$loaderIcon = $this->getLoadingPlaceHolderIconAttributes();
@endphp

<tr wire:key="{{ $tableName }}-loader" wire:loading.class.remove="hidden d-none" {{
Expand All @@ -27,11 +27,10 @@
$attributes->merge($loaderIcon)
->class(['lds-hourglass' => $this->isTailwind && ($loaderIcon['default'] ?? true)])
->class(['lds-hourglass' => $this->isBootstrap && ($loaderIcon['default'] ?? true)])
->except(['default','default-styling','default-colors']);
->except(['default','default-styling','default-colors'])
}}></div>
<div>{!! $this->getLoadingPlaceholderContent() !!}</div>
</div>
@endif
</td>
</tr>

10 changes: 5 additions & 5 deletions resources/views/components/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{ $attributes->merge($customAttributes['table'])
->class(['min-w-full divide-y divide-gray-200 dark:divide-none' => $customAttributes['table']['default'] ?? true])
->except(['default','default-styling','default-colors']) }}

>
<thead wire:key="{{ $tableName }}-thead"
{{ $attributes->merge($customAttributes['thead'])
Expand All @@ -43,11 +43,11 @@
{{ $slot }}
</tbody>

@if (isset($tfoot))
@isset($tfoot)
<tfoot wire:key="{{ $tableName }}-tfoot">
{{ $tfoot }}
</tfoot>
@endif
@endisset
</table>
</div>
@elseif ($isBootstrap)
Expand Down Expand Up @@ -84,11 +84,11 @@
{{ $slot }}
</tbody>

@if (isset($tfoot))
@isset($tfoot)
<tfoot wire:key="{{ $tableName }}-tfoot">
{{ $tfoot }}
</tfoot>
@endif
@endisset
</table>
</div>
@endif
5 changes: 3 additions & 2 deletions resources/views/components/table/collapsed-columns.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@
colspan="{{ $colspan }}"
>
<div>
@php /** @var \Rappasoft\LaravelLivewireTables\Views\Column $column */ @endphp
@foreach($columns as $colIndex => $column)
@continue($column->isHidden())
@continue($this->columnSelectIsEnabled() && ! $this->columnSelectIsEnabledForColumn($column))

<p wire:key="{{ $tableName }}-row-{{ $row->{$primaryKey} }}-collapsed-contents-{{ $colIndex }}"

@class([
'block mb-2' => $isTailwind && $column->shouldCollapseAlways(),
'block mb-2 sm:hidden' => $isTailwind && !$column->shouldCollapseAlways() && !$column->shouldCollapseOnTablet() && !$column->shouldCollapseOnMobile(),
'block mb-2 md:hidden' => $isTailwind && !$column->shouldCollapseAlways() && !$column->shouldCollapseOnTablet() && $column->shouldCollapseOnMobile(),
'block mb-2 lg:hidden' => $isTailwind && !$column->shouldCollapseAlways() && ($column->shouldCollapseOnTablet() || $column->shouldCollapseOnMobile()),
'd-block mb-2' => $isBootstrap && $column->shouldCollapseAlways(),
'd-block mb-2 d-sm-none' => $isBootstrap && !$column->shouldCollapseAlways() && !$column->shouldCollapseOnTablet() && !$column->shouldCollapseOnMobile(),
'd-block mb-2 d-md-none' => $isBootstrap && !$column->shouldCollapseAlways() && !$column->shouldCollapseOnTablet() && $column->shouldCollapseOnMobile(),
Expand Down
3 changes: 2 additions & 1 deletion resources/views/components/table/td.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
@props(['column', 'colIndex'])

@php
/** @var \Rappasoft\LaravelLivewireTables\Views\Column $column */
$customAttributes = $this->getTdAttributes($column, $row, $colIndex, $rowIndex)
@endphp

<td wire:key="{{ $tableName . '-table-td-'.$row->{$primaryKey}.'-'.$column->getSlug() }}"
@if ($column->isClickable())
@if($this->getTableRowUrlTarget($row) === "navigate") wire:navigate href="{{ $this->getTableRowUrl($row) }}"
@if($this->getTableRowUrlTarget($row) === 'navigate') wire:navigate href="{{ $this->getTableRowUrl($row) }}"
@else onclick="window.open('{{ $this->getTableRowUrl($row) }}', '{{ $this->getTableRowUrlTarget($row) ?? '_self' }}')"
@endif
@endif
Expand Down
2 changes: 2 additions & 0 deletions resources/views/components/table/td/plain.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@aware(['component', 'rowIndex', 'rowID','isTailwind','isBootstrap'])
@props(['column' => null, 'customAttributes' => [], 'displayMinimisedOnReorder' => false, 'hideUntilReorder' => false])

@php /** @var \Rappasoft\LaravelLivewireTables\Views\Column|null $column */ @endphp

@if ($isTailwind)
<td x-cloak {{ $attributes
->merge($customAttributes)
Expand Down
3 changes: 2 additions & 1 deletion resources/views/components/table/th.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@props(['column', 'index'])

@php
/** @var \Rappasoft\LaravelLivewireTables\Views\Column $column */
$attributes = $attributes->merge(['wire:key' => $tableName . '-header-col-'.$column->getSlug()]);
$allThAttributes = $this->getAllThAttributes($column);
Expand Down Expand Up @@ -41,7 +42,7 @@
}}
>
<span {{ $customLabelAttributes->except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }}</span>
<x-livewire-tables::table.th.sort-icons :$direction
<x-livewire-tables::table.th.sort-icons :$direction
{{
$attributes->merge($customSortIconAttributes)
->except(['default', 'default-colors', 'default-styling', 'wire:key'])
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/tools.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@aware(['component','isTailwind','isBootstrap'])
@php($toolsAttributes = $this->getToolsAttributesBag())

<div {{
<div {{
$toolsAttributes->merge()
->class(['flex-col' => $isTailwind && ($toolsAttributes['default-styling'] ?? true)])
->class(['d-flex flex-column' => $isBootstrap && ($toolsAttributes['default-styling'] ?? true)])
->except(['default','default-styling','default-colors'])
->except(['default','default-styling','default-colors'])
}}
>
{{ $slot }}
Expand Down
8 changes: 4 additions & 4 deletions resources/views/components/tools/filter-label.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
@props(['filter', 'filterLayout' => 'popover', 'tableName' => 'table', 'isTailwind' => false, 'isBootstrap' => false, 'isBootstrap4' => false, 'isBootstrap5' => false, 'for' => null])

@php
/** @var \Rappasoft\LaravelLivewireTables\Views\Filter $filter */
$filterLabelAttributes = $filter->getFilterLabelAttributes();
$customLabelAttributes = $filter->getLabelAttributes();
@endphp

@if($filter->hasCustomFilterLabel() && !$filter->hasCustomPosition())
@include($filter->getCustomFilterLabel(),['filter' => $filter, 'filterLayout' => $filterLayout, 'tableName' => $tableName, 'isTailwind' => $isTailwind, 'isBootstrap' => $isBootstrap, 'isBootstrap4' => $isBootstrap4, 'isBootstrap5' => $isBootstrap5, 'customLabelAttributes' => $customLabelAttributes])
@elseif(!$filter->hasCustomPosition())
Expand All @@ -14,13 +15,12 @@
{{
$attributes->merge($customLabelAttributes)->merge($filterLabelAttributes)
->class(['block text-sm font-medium leading-5 text-gray-700 dark:text-white' => $isTailwind && ($filterLabelAttributes['default'] ?? true)])
->class(['d-block' => $isBootstrap && $filterLayout == 'slide-down' && ($filterLabelAttributes['default'] ?? true)])
->class(['mb-2' => $isBootstrap && $filterLayout == 'popover' && ($filterLabelAttributes['default'] ?? true)])
->class(['d-block' => $isBootstrap && $filterLayout === 'slide-down' && ($filterLabelAttributes['default'] ?? true)])
->class(['mb-2' => $isBootstrap && $filterLayout === 'popover' && ($filterLabelAttributes['default'] ?? true)])
->except(['default', 'default-colors', 'default-styling'])
}}

>
{{ $filter->getName() }}
</label>

@endif
2 changes: 1 addition & 1 deletion resources/views/components/tools/filter-pills.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</small>

@foreach($this->getAppliedFiltersWithValues() as $filterSelectName => $value)
@php /** @var \Rappasoft\LaravelLivewireTables\Views\Filter $filter */ @endphp
@php($filter = $this->getFilterByKey($filterSelectName))
@continue(is_null($filter) || $filter->isHiddenFromPills())
@php( $filterPillTitle = $filter->getFilterPillTitle())
Expand All @@ -31,4 +32,3 @@
</div>
</div>
@endif

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<button
wire:click.prevent="setFilterDefaults"
@class([
"focus:outline-none active:outline-none"
'focus:outline-none active:outline-none'
])>
<span @class([
"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
"bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900"
'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium',
'bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900'
])>
{{ __($this->getLocalisationPath.'Clear') }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
wire:click="resetFilter('{{ $filterKey }}')"
type="button"
@class([
"flex-shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:outline-none",
"text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:bg-indigo-500 focus:text-white",
'flex-shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:outline-none',
'text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:bg-indigo-500 focus:text-white',
])
>
<span class="sr-only">{{ __($this->getLocalisationPath.'Remove filter option') }}</span>
Expand Down
Loading

0 comments on commit 72db36d

Please sign in to comment.