Skip to content

Commit 139daac

Browse files
authored
Merge pull request #682 from rappasoft/develop
V2
2 parents 2465eae + 1658b19 commit 139daac

File tree

338 files changed

+15698
-7012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+15698
-7012
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,13 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
os: [ubuntu-latest, windows-latest]
12-
php: [8.1, 8.0, 7.4]
13-
laravel: [8.*, 9.*]
14-
stability: [prefer-lowest, prefer-stable]
11+
os: [ubuntu-latest]
12+
php: [8.0, 8.1]
13+
laravel: [9.*]
14+
stability: [prefer-stable]
1515
include:
1616
- laravel: 9.*
17-
testbench: 7.*
18-
- laravel: 8.*
19-
testbench: 6.*
20-
exclude:
21-
- laravel: 9.*
22-
php: 7.4
23-
- laravel: 8.*
24-
php: 8.1
25-
stability: prefer-lowest
17+
testbench: 7.0
2618

2719
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2820

@@ -48,4 +40,4 @@ jobs:
4840
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4941
5042
- name: Execute tests
51-
run: vendor/bin/phpunit
43+
run: vendor/bin/phpunit

CHANGELOG.md

Lines changed: 199 additions & 249 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ You can install the package via composer:
2121
composer require rappasoft/laravel-livewire-tables
2222
```
2323

24+
You must also have [Alpine.js](https://alpinejs.dev) version 3 or greater installed and available to the component.
25+
2426
## Documentation and Usage Instructions
2527

2628
See the [documentation](https://rappasoft.com/docs/laravel-livewire-tables) for detailed installation and usage instructions.
@@ -61,19 +63,7 @@ class UsersTable extends DataTableComponent
6163
}
6264
```
6365

64-
### [See advanced example](https://rappasoft.com/docs/laravel-livewire-tables/v1/usage/advanced-example-table)
65-
66-
## To-do/Roadmap
67-
68-
- [x] Bootstrap 4 Template
69-
- [x] Bootstrap 5 Template
70-
- [x] Sorting By Relationships
71-
- [x] User Column Selection
72-
- [x] Drag & Drop (beta)
73-
- [x] Column Search
74-
- [x] Greater Configurability
75-
- [ ] Collection/Query Support
76-
- [ ] Test Suite (WIP)
66+
### [See advanced example](https://rappasoft.com/docs/laravel-livewire-tables/v2/usage/advanced-example-table)
7767

7868
## Testing
7969

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"ext-sqlite3": "*",
2828
"orchestra/testbench": "^6.13|^7.0",
2929
"phpunit/phpunit": "^9.3",
30-
"spatie/laravel-ray": "^1.9",
31-
"vimeo/psalm": "^4.4"
30+
"spatie/laravel-ray": "^1.9"
3231
},
3332
"autoload": {
3433
"psr-4": {

database/migrations/create_test_tables.php.stub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class CreateTestTables extends Migration
2727

2828
Schema::create('pets', function (Blueprint $table) {
2929
$table->id();
30+
$table->integer('sort')->default(0);
3031
$table->string('name')->index();
3132
$table->string('age')->nullable();
3233
$table->date('last_visit')->nullable();

docs/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: v1
2+
title: v2
33
slogan: A dynamic table component for Laravel Livewire.
44
githubUrl: https://github.com/rappasoft/laravel-livewire-tables
5-
branch: v1
5+
branch: master
66
---

docs/bulk-actions/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Bulk Actions
3-
weight: 6
3+
weight: 8
44
---
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
title: Available Methods
3+
weight: 4
4+
---
5+
6+
These are the available configuration methods for bulk actions.
7+
8+
---
9+
10+
## setBulkActions
11+
12+
Set the bulk actions array.
13+
14+
```php
15+
public function configure(): void
16+
{
17+
$this->setBulkActions([
18+
'exportSelected' => 'Export',
19+
]);
20+
}
21+
```
22+
23+
---
24+
25+
## setBulkActionsStatus
26+
27+
**Enabled by default**, enable/disable bulk actions for the component.
28+
29+
```php
30+
public function configure(): void
31+
{
32+
$this->setBulkActionsStatus(true);
33+
$this->setBulkActionsStatus(false);
34+
}
35+
```
36+
37+
## setBulkActionsEnabled
38+
39+
Enable bulk actions on the component.
40+
41+
```php
42+
public function configure(): void
43+
{
44+
// Shorthand for $this->setBulkActionsStatus(true)
45+
$this->setBulkActionsEnabled();
46+
}
47+
```
48+
49+
## setBulkActionsDisabled
50+
51+
Disable bulk actions on the component.
52+
53+
```php
54+
public function configure(): void
55+
{
56+
// Shorthand for $this->setBulkActionsStatus(false)
57+
$this->setBulkActionsDisabled();
58+
}
59+
```
60+
61+
---
62+
63+
## setSelectAllStatus
64+
65+
**Disabled by default**, enable/disable pre-selection of all bulk action check boxes.
66+
67+
```php
68+
public function configure(): void
69+
{
70+
$this->setSelectAllStatus(true);
71+
$this->setSelectAllStatus(false);
72+
}
73+
```
74+
75+
## setSelectAllEnabled
76+
77+
Check all bulk action checkboxes.
78+
79+
```php
80+
public function configure(): void
81+
{
82+
// Shorthand for $this->setSelectAllStatus(true)
83+
$this->setSelectAllEnabled();
84+
}
85+
```
86+
87+
## setSelectAllDisabled
88+
89+
Deselect the select-all bulk actions checkbox.
90+
91+
```php
92+
public function configure(): void
93+
{
94+
// Shorthand for $this->setSelectAllStatus(false)
95+
$this->setSelectAllDisabled();
96+
}
97+
```
98+
99+
---
100+
101+
## setHideBulkActionsWhenEmptyStatus
102+
103+
**Disabled by default**, enable/disable hiding of bulk actions dropdown when empty.
104+
105+
```php
106+
public function configure(): void
107+
{
108+
$this->setHideBulkActionsWhenEmptyStatus(true);
109+
$this->setHideBulkActionsWhenEmptyStatus(false);
110+
}
111+
```
112+
113+
## setHideBulkActionsWhenEmptyEnabled
114+
115+
Hide bulk actions dropdown when empty.
116+
117+
```php
118+
public function configure(): void
119+
{
120+
// Shorthand for $this->setHideBulkActionsWhenEmptyStatus(true)
121+
$this->setHideBulkActionsWhenEmptyEnabled();
122+
}
123+
```
124+
125+
## setHideBulkActionsWhenEmptyDisabled
126+
127+
Show bulk actions dropdown when empty.
128+
129+
```php
130+
public function configure(): void
131+
{
132+
// Shorthand for $this->setHideBulkActionsWhenEmptyStatus(false)
133+
$this->setHideBulkActionsWhenEmptyDisabled();
134+
}
135+
```
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
---
2-
title: Creating bulk actions
2+
title: Creating Bulk Actions
33
weight: 2
44
---
55

6-
To create bulk actions, you must specify a `method` and a `button title` in the `$bulkActions` component property.
6+
There are 3 ways to define your bulk actions.
7+
8+
They all do the same thing except provide different levels of flexibility.
9+
10+
The **key** is the Livewire method to call, and the value is the name of the item in the bulk actions dropdown.
11+
12+
## Property
13+
14+
The first way to define your bulk actions is with the `bulkActions` component property:
715

816
```php
917
public array $bulkActions = [
1018
'exportSelected' => 'Export',
1119
];
1220
```
1321

14-
------
22+
## Method
1523

16-
**The following method is only available in v1.16 and above**
17-
18-
As of v1.16 you can define bulk action with a method, so you can perform other actions to determine what your actions are or perform translations on the strings:
24+
You can also use the `bulkActions` method on the component:
1925

2026
```php
2127
public function bulkActions(): array
2228
{
23-
// Figure out what actions the admin gets
24-
...
25-
2629
return [
27-
'activate' => __('Activate'),
28-
'deactivate' => __('Deactivate'),
30+
'exportSelected' => 'Export',
2931
];
3032
}
3133
```
3234

33-
------
35+
## Configuration
3436

35-
The **key** is the Livewire method to call, and the value is the name of the item in the bulk actions dropdown.
36-
37-
You can define your method to do whatever you want:
37+
You can also set them via the component's configure method:
3838

3939
```php
40-
public function exportSelected()
40+
public function configure(): void
4141
{
42-
// Do something with the selected rows.
42+
$this->setBulkActions([
43+
'exportSelected' => 'Export',
44+
]);
4345
}
4446
```
45-
46-
See [Getting the selected rows query](./getting-the-selected-rows-query) or [Getting the selected keys](./getting-the-selected-keys) to understand how to work with the selected data.

docs/bulk-actions/getting-the-selected-keys.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)