diff --git a/.github/workflows/discord-releases.yml b/.github/workflows/discord-releases.yml index fb008bc21..17e5ac816 100644 --- a/.github/workflows/discord-releases.yml +++ b/.github/workflows/discord-releases.yml @@ -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" diff --git a/.github/workflows/run-phpstan-pull.yml b/.github/workflows/run-phpstan-pull.yml index 9f8b7a5d7..9a288188b 100644 --- a/.github/workflows/run-phpstan-pull.yml +++ b/.github/workflows/run-phpstan-pull.yml @@ -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' diff --git a/.github/workflows/run-phpstan.yml b/.github/workflows/run-phpstan.yml index 742eb28a7..87180f167 100644 --- a/.github/workflows/run-phpstan.yml +++ b/.github/workflows/run-phpstan.yml @@ -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' diff --git a/.github/workflows/run-tests-pcov-pull.yml b/.github/workflows/run-tests-pcov-pull.yml index 87b9b9bd1..4457fb22a 100644 --- a/.github/workflows/run-tests-pcov-pull.yml +++ b/.github/workflows/run-tests-pcov-pull.yml @@ -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' @@ -93,7 +95,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - token: ${{ secrets.CODECOV_TOKEN }} + token: $CODECOV_TOKEN files: ./coverage.xml verbose: true diff --git a/.github/workflows/run-tests-pull.yml b/.github/workflows/run-tests-pull.yml index 856d27bb9..0de41ddb2 100644 --- a/.github/workflows/run-tests-pull.yml +++ b/.github/workflows/run-tests-pull.yml @@ -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' @@ -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' diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 55591c8f1..ff452e572 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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' @@ -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' diff --git a/CHANGELOG.md b/CHANGELOG.md index c645875cd..ea686d326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/search/available-methods.md b/docs/search/available-methods.md index 1d8397a5f..422757c37 100644 --- a/docs/search/available-methods.md +++ b/docs/search/available-methods.md @@ -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', + ]); +} + +``` \ No newline at end of file diff --git a/resources/views/components/includes/actions.blade.php b/resources/views/components/includes/actions.blade.php index db8925279..035c8397a 100644 --- a/resources/views/components/includes/actions.blade.php +++ b/resources/views/components/includes/actions.blade.php @@ -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 - \ No newline at end of file + diff --git a/resources/views/components/includes/loading.blade.php b/resources/views/components/includes/loading.blade.php index b8c988e88..ef88b43e8 100644 --- a/resources/views/components/includes/loading.blade.php +++ b/resources/views/components/includes/loading.blade.php @@ -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 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']) }}>
{!! $this->getLoadingPlaceholderContent() !!}
@endif - diff --git a/resources/views/components/table.blade.php b/resources/views/components/table.blade.php index 297548694..331c0b25f 100644 --- a/resources/views/components/table.blade.php +++ b/resources/views/components/table.blade.php @@ -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']) }} - + > merge($customAttributes['thead']) @@ -43,11 +43,11 @@ {{ $slot }} - @if (isset($tfoot)) + @isset($tfoot) {{ $tfoot }} - @endif + @endisset @elseif ($isBootstrap) @@ -84,11 +84,11 @@ {{ $slot }} - @if (isset($tfoot)) + @isset($tfoot) {{ $tfoot }} - @endif + @endisset @endif diff --git a/resources/views/components/table/collapsed-columns.blade.php b/resources/views/components/table/collapsed-columns.blade.php index 44bb45d9f..b15e9cf20 100644 --- a/resources/views/components/table/collapsed-columns.blade.php +++ b/resources/views/components/table/collapsed-columns.blade.php @@ -50,18 +50,19 @@ colspan="{{ $colspan }}" >
+ @php /** @var \Rappasoft\LaravelLivewireTables\Views\Column $column */ @endphp @foreach($columns as $colIndex => $column) @continue($column->isHidden()) @continue($this->columnSelectIsEnabled() && ! $this->columnSelectIsEnabledForColumn($column))

$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(), diff --git a/resources/views/components/table/td.blade.php b/resources/views/components/table/td.blade.php index 0ba2f050d..8320d2d9f 100644 --- a/resources/views/components/table/td.blade.php +++ b/resources/views/components/table/td.blade.php @@ -2,12 +2,13 @@ @props(['column', 'colIndex']) @php + /** @var \Rappasoft\LaravelLivewireTables\Views\Column $column */ $customAttributes = $this->getTdAttributes($column, $row, $colIndex, $rowIndex) @endphp 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 diff --git a/resources/views/components/table/td/plain.blade.php b/resources/views/components/table/td/plain.blade.php index d2e9ffb6f..824bcf2af 100644 --- a/resources/views/components/table/td/plain.blade.php +++ b/resources/views/components/table/td/plain.blade.php @@ -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) merge($customAttributes) diff --git a/resources/views/components/table/th.blade.php b/resources/views/components/table/th.blade.php index 3afee536c..ee837bf28 100644 --- a/resources/views/components/table/th.blade.php +++ b/resources/views/components/table/th.blade.php @@ -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); @@ -41,7 +42,7 @@ }} > except(['default', 'default-colors', 'default-styling']) }}>{{ $column->getTitle() }} - merge($customSortIconAttributes) ->except(['default', 'default-colors', 'default-styling', 'wire:key']) diff --git a/resources/views/components/tools.blade.php b/resources/views/components/tools.blade.php index bdb31a745..d40efaed3 100644 --- a/resources/views/components/tools.blade.php +++ b/resources/views/components/tools.blade.php @@ -1,11 +1,11 @@ @aware(['component','isTailwind','isBootstrap']) @php($toolsAttributes = $this->getToolsAttributesBag()) -

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 }} diff --git a/resources/views/components/tools/filter-label.blade.php b/resources/views/components/tools/filter-label.blade.php index 6fc9022dc..eb81b92d3 100644 --- a/resources/views/components/tools/filter-label.blade.php +++ b/resources/views/components/tools/filter-label.blade.php @@ -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()) @@ -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() }} - @endif diff --git a/resources/views/components/tools/filter-pills.blade.php b/resources/views/components/tools/filter-pills.blade.php index ba84a9b74..400de52b9 100644 --- a/resources/views/components/tools/filter-pills.blade.php +++ b/resources/views/components/tools/filter-pills.blade.php @@ -14,6 +14,7 @@ @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()) @@ -31,4 +32,3 @@
@endif - diff --git a/resources/views/components/tools/filter-pills/buttons/reset-all.blade.php b/resources/views/components/tools/filter-pills/buttons/reset-all.blade.php index 78a42dc21..508c3e201 100644 --- a/resources/views/components/tools/filter-pills/buttons/reset-all.blade.php +++ b/resources/views/components/tools/filter-pills/buttons/reset-all.blade.php @@ -3,11 +3,11 @@ - - - +