Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.19.0 #496

Merged
merged 21 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### All Submissions:

* [ ] Have you followed the guidelines in our Contributing document?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change?

### New Feature Submissions:

1. [ ] Does your submission pass tests and did you add any new tests needed for your feature?
2. [ ] Did you update all templates (if applicable)?
3. [ ] Did you add the [relevant documentation](https://github.com/rappasoft/laravel-livewire-tables-docs) (if applicable)?
4. Did you test locally to make sure your feature works as intended?

### Changes to Core Features:

* [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
* [ ] Have you written new tests for your core changes, as applicable?
* [ ] Have you successfully ran tests with your changes locally?
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to `laravel-livewire-tables` will be documented in this file

## [Unreleased]

## [1.19.0] - 2021-10-14

### Added

- Thai translation - https://github.com/rappasoft/laravel-livewire-tables/pull/491
- Italian translation - https://github.com/rappasoft/laravel-livewire-tables/pull/493
- Added getTableRowUrlTarget to set row click target based on the row
- Add custom class to table - https://github.com/rappasoft/laravel-livewire-tables/pull/495

### Changed

- Fix removing a multiselect filter - https://github.com/rappasoft/laravel-livewire-tables/pull/494

## [1.18.0] - 2021-10-13

### Added
Expand Down Expand Up @@ -505,7 +518,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file

- Initial release

[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.1.0...development
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.19.0...development
[1.19.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.18.0...v1.19.0
[1.18.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.17.0...v1.18.0
[1.17.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.16.0...v1.17.0
[1.16.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.15.0...v1.16.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A dynamic Laravel Livewire component for data tables.

![Full Table](https://i.imgur.com/2kfibjR.png)

### [Bootstrap 4 Demo](https://tables.laravel-boilerplate.com/bootstrap-4) | [Bootstrap 5 Demo](https://tables.laravel-boilerplate.com/bootstrap-5) | [Tailwind Demo](https://tables.laravel-boilerplate.com/tailwind)
### [Bootstrap 4 Demo](https://tables.laravel-boilerplate.com/bootstrap-4) | [Bootstrap 5 Demo](https://tables.laravel-boilerplate.com/bootstrap-5) | [Tailwind Demo](https://tables.laravel-boilerplate.com/tailwind) | [Demo Repository](https://github.com/rappasoft/laravel-livewire-tables-demo)

## Installation

Expand Down
26 changes: 26 additions & 0 deletions resources/lang/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"All": "Tutti",
"Applied Filters": "Filtri Applicati",
"Applied Sorting": "Ordinamento Applicato",
"Bulk Actions": "Azioni di Gruppo",
"Clear": "Pulisci",
"Columns": "Colonne",
"Done Reordering": "Ordinamento Terminato",
"Filters": "Filtri",
"Remove filter option": "Rimuovi filtro",
"Remove sort option": "Rimuovi ordinamento",
"Search": "Cerca",
"Select All": "Seleziona Tutto",
"Showing": "Visualizzati",
"Unselect All": "Deseleziona tutto",
"You are currently selecting all": "Stai selezionando tutto",
"You are not connected to the internet.": "Non sei connesso a internet",
"You have selected": "Hai selezionato",
"of": "di",
"Reorder": "Riordina",
"results": "risultati",
"rows": "righe",
"rows, do you want to select all": "righe, vuoi selezionarle tutte",
"No items found. Try to broaden your search.": "Nessun risultato trovato. Prova ad ampliare la tua ricerca.",
"to": "a"
}
27 changes: 27 additions & 0 deletions resources/lang/th.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"All": "ทั้งหมด",
"Applied Filters": "กรองข้อมูลตาม",
"Applied Sorting": "เรียงลำดับตาม",
"Bulk Actions": "เลือกการกระทำ",
"Clear": "ล้างทั้งหมด",
"Columns": "เลือกคอลัมน์",
"Done Reordering": "จัดลำดับแล้ว",
"Filters": "ตัวกรอง",
"Remove filter option": "เอาตัวกรองออก",
"Remove sort option": "เอาการเรียงลำดับออก",
"Search": "ค้นหา...",
"Select All": "เลือกทั้งหมด",
"Showing": "แสดง",
"Unselect All": "ไม่เลือกทั้งหมด",
"You are currently selecting all": "ขณะนี้คุณได้เลือกทุกรายการ",
"You are not connected to the internet.": "ขณะนี้คุณไม่ได้เชื่อมต่อกับอินเทอร์เน็ต",
"You have selected": "คุณเลือก",
"of": "จาก",
"Reorder": "จัดลำดับ",
"results": "รายการ",
"row": "รายการ",
"rows": "รายการ",
"rows, do you want to select all": "รายการ, คุณต้องการเลือกทั้งหมด",
"No items found. Try to broaden your search.": "ไม่พบรายการที่ค้นหา",
"to": "-"
}
4 changes: 2 additions & 2 deletions resources/views/bootstrap-4/components/table/row.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['url' => null, 'reordering' => false, 'customAttributes' => []])
@props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []])

@if (!$reordering && $attributes->has('wire:sortable.item'))
@php
Expand All @@ -10,7 +10,7 @@
{{ $attributes->merge($customAttributes) }}

@if ($url)
onclick="window.location='{{ $url }}';"
onclick="window.open('{{ $url }}', '{{ $target }}')"
style="cursor:pointer"
@endif
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@props(['customSecondaryHeader' => false, 'useHeaderAsFooter' => false, 'customFooter' => false])

<div class="{{ $this->responsive ? 'table-responsive' : '' }}">
<table {{ $attributes->except('wire:sortable') }} class="table table-striped">
<table {{ $attributes->except(['wire:sortable', 'class']) }} class="{{ trim($attributes->get('class')) ?: 'table table-striped'}}">
<thead>
<tr>
{{ $head }}
Expand Down
2 changes: 2 additions & 0 deletions resources/views/bootstrap-4/includes/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:customSecondaryHeader="$secondaryHeader"
:useHeaderAsFooter="$useHeaderAsFooter"
:customFooter="$customFooter"
:class="method_exists($this, 'setTableClass') ? ' ' . $this->setTableClass() : '' "
>
<x-slot name="head">
@if ($reordering)
Expand Down Expand Up @@ -96,6 +97,7 @@
wire:sortable.item="{{ $row->{$primaryKey} }}"
:reordering="$reordering"
:url="method_exists($this, 'getTableRowUrl') ? $this->getTableRowUrl($row) : ''"
:target="method_exists($this, 'getTableRowUrlTarget') ? $this->getTableRowUrlTarget($row) : ''"
:class="method_exists($this, 'setTableRowClass') ? ' ' . $this->setTableRowClass($row) : ''"
:id="method_exists($this, 'setTableRowId') ? $this->setTableRowId($row) : ''"
:customAttributes="method_exists($this, 'setTableRowAttributes') ? $this->setTableRowAttributes($row) : []"
Expand Down
4 changes: 2 additions & 2 deletions resources/views/bootstrap-5/components/table/row.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['url' => null, 'reordering' => false, 'customAttributes' => []])
@props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []])

@if (!$reordering && $attributes->has('wire:sortable.item'))
@php
Expand All @@ -10,7 +10,7 @@
{{ $attributes->merge($customAttributes) }}

@if ($url)
onclick="window.location='{{ $url }}';"
onclick="window.open('{{ $url }}', '{{ $target }}')"
style="cursor:pointer"
@endif
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@props(['customSecondaryHeader' => false, 'useHeaderAsFooter' => false, 'customFooter' => false])

<div class="{{ $this->responsive ? 'table-responsive' : '' }}">
<table {{ $attributes->except('wire:sortable') }} class="table table-striped">
<table {{ $attributes->except(['wire:sortable', 'class']) }} class="{{ trim($attributes->get('class')) ?: 'table table-striped'}}">
<thead>
<tr>
{{ $head }}
Expand Down
2 changes: 2 additions & 0 deletions resources/views/bootstrap-5/includes/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:customSecondaryHeader="$secondaryHeader"
:useHeaderAsFooter="$useHeaderAsFooter"
:customFooter="$customFooter"
:class="method_exists($this, 'setTableClass') ? ' ' . $this->setTableClass() : '' "
>
<x-slot name="head">
@if ($reordering)
Expand Down Expand Up @@ -97,6 +98,7 @@ class="form-check-input"
wire:sortable.item="{{ $row->{$primaryKey} }}"
:reordering="$reordering"
:url="method_exists($this, 'getTableRowUrl') ? $this->getTableRowUrl($row) : ''"
:target="method_exists($this, 'getTableRowUrlTarget') ? $this->getTableRowUrlTarget($row) : ''"
:class="method_exists($this, 'setTableRowClass') ? ' ' . $this->setTableRowClass($row) : ''"
:id="method_exists($this, 'setTableRowId') ? $this->setTableRowId($row) : ''"
:customAttributes="method_exists($this, 'setTableRowAttributes') ? $this->setTableRowAttributes($row) : []"
Expand Down
4 changes: 2 additions & 2 deletions resources/views/tailwind/components/table/row.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['url' => null, 'reordering' => false, 'customAttributes' => []])
@props(['url' => null, 'target' => '_self', 'reordering' => false, 'customAttributes' => []])

@if (!$reordering && $attributes->has('wire:sortable.item'))
@php
Expand All @@ -10,7 +10,7 @@
{{ $attributes->merge($customAttributes) }}

@if ($url)
onclick="window.location='{{ $url }}';"
onclick="window.open('{{ $url }}', '{{ $target }}')"
style="cursor:pointer"
@endif
>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tailwind/components/table/table.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@props(['customSecondaryHeader' => false, 'useHeaderAsFooter' => false, 'customFooter' => false])

<div class="align-middle min-w-full overflow-x-auto shadow overflow-hidden rounded-none md:rounded-lg">
<table {{ $attributes->except('wire:sortable') }} class="min-w-full divide-y divide-gray-200 dark:divide-none">
<table {{ $attributes->except(['wire:sortable', 'class']) }} class="{{ trim($attributes->get('class')) ?: 'min-w-full divide-y divide-gray-200 dark:divide-none'}}">
<thead>
<tr>
{{ $head }}
Expand Down
2 changes: 2 additions & 0 deletions resources/views/tailwind/includes/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:customSecondaryHeader="$secondaryHeader"
:useHeaderAsFooter="$useHeaderAsFooter"
:customFooter="$customFooter"
:class="method_exists($this, 'setTableClass') ? ' ' . $this->setTableClass() : '' "
>
<x-slot name="head">
@if ($reordering)
Expand Down Expand Up @@ -99,6 +100,7 @@ class="rounded border-gray-300 text-indigo-600 shadow-sm transition duration-150
wire:sortable.item="{{ $row->{$primaryKey} }}"
:reordering="$reordering"
:url="method_exists($this, 'getTableRowUrl') ? $this->getTableRowUrl($row) : ''"
:target="method_exists($this, 'getTableRowUrlTarget') ? $this->getTableRowUrlTarget($row) : ''"
:class="
($index % 2 === 0 ?
'bg-white dark:bg-gray-700 dark:text-white' . (method_exists($this, 'getTableRowUrl') ? ' hover:bg-gray-100' : '') :
Expand Down
18 changes: 16 additions & 2 deletions src/Traits/WithFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,23 @@ public function getFiltersWithoutSearch(): array
*/
public function removeFilter($filter): void
{
if (isset($this->filters[$filter])) {
$this->filters[$filter] = null;
if (! isset($this->filters[$filter])) {
return;
}

if ($filter === 'search') {
$this->filters['search'] = null;

return;
}

if ($this->filters()[$filter]->isMultiSelect()) {
$this->filters[$filter] = [];

return;
}

$this->filters[$filter] = null;
}

/**
Expand Down