Skip to content

Commit 3688fb4

Browse files
Adjust PowerGrid facade
1 parent 665d62e commit 3688fb4

File tree

4 files changed

+45
-42
lines changed

4 files changed

+45
-42
lines changed

docs/release-notes-and-upgrade/upgrade-guide.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;// [!code ++]
2222
```js
2323
import './../../vendor/power-components/livewire-powergrid/dist/powergrid.css' // [!code --]
2424

25-
import './../../vendor/power-components/livewire-powergrid/dist/bootstrap5.css' // [!code ++]
26-
// or
27-
import './../../vendor/power-components/livewire-powergrid/dist/tailwind.css' // [!code ++]
25+
import './../../vendor/power-components/livewire-powergrid/dist/tailwind.css' // [!code ++] // bootstrap5.css
2826

2927
```
3028

docs/table-component/component-configuration.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ Example:
250250
// app/Livewire/DishTable.php
251251

252252
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
253-
use PowerComponents\LivewirePowerGrid\Responsive;// [!code ++]
253+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
254254

255255
class DishTable extends PowerGridComponent
256256
{
257257
public function setUp(): array
258258
{
259259
return [
260-
Responsive::make()// [!code ++:2]
260+
PowerGrid::responsive()// [!code ++:2]
261261
->fixedColumns('id', 'name', Responsive::ACTIONS_COLUMN_NAME),
262262
];
263263
}
@@ -300,14 +300,14 @@ Example:
300300
// app/Livewire/DishTable.php
301301

302302
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
303-
use PowerComponents\LivewirePowerGrid\Detail; // [!code ++]
303+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
304304

305305
class DishTable extends PowerGridComponent
306306
{
307307
public function setUp(): array
308308
{
309309
return [
310-
Detail::make()// [!code ++:4]
310+
PowerGrid::detail()// [!code ++:4]
311311
->view('components.detail')
312312
->showCollapseIcon()
313313
->params(['name' => 'Luan', 'custom_data' => 'foobar']),
@@ -330,14 +330,14 @@ By default, PowerGrid will keep the open state of other details when you toggle
330330
// app/Livewire/DishTable.php
331331

332332
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
333-
use PowerComponents\LivewirePowerGrid\Detail; // [!code ++]
333+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
334334

335335
class DishTable extends PowerGridComponent
336336
{
337337
public function setUp(): array
338338
{
339339
return [
340-
Detail::make()// [!code ++:5]
340+
PowerGrid::detail()// [!code ++:5]
341341
->view('components.detail')
342342
->params(['name' => 'Luan', 'custom_parameter' => 'foobar'])
343343
->showCollapseIcon()
@@ -365,14 +365,14 @@ In the next example, only 25 lines will be loaded initially. Additional items wi
365365
// app/Livewire/DishTable.php
366366

367367
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
368-
use PowerComponents\LivewirePowerGrid\Lazy;// [!code ++]
368+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
369369

370370
class DishTable extends PowerGridComponent
371371
{
372372
public function setUp(): array
373373
{
374374
return [
375-
Lazy::make()// [!code ++:2]
375+
PowerGrid::lazy()// [!code ++:2]
376376
->rowsPerChildren(25),
377377
];
378378
}
@@ -399,15 +399,15 @@ When calling `toggleDetail` on the child component, `toggleDetailFromChild` will
399399
// app/Livewire/DishTable.php
400400

401401
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
402-
use PowerComponents\LivewirePowerGrid\Lazy;// [!code ++]
402+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
403403
use Livewire\Attributes\On;// [!code ++]
404404

405405
class DishTable extends PowerGridComponent
406406
{
407407
public function setUp(): array
408408
{
409409
return [
410-
Lazy::make()// [!code ++:3]
410+
PowerGrid::lazy()// [!code ++:3]
411411
->rowsPerChildren(25)
412412
->dispatchAfterToggleDetail('toggleDetailFromChild'),
413413
];
@@ -491,15 +491,16 @@ The next example demonstrates how to use Cache in your Component, prefixing the
491491
// app/Livewire/DishTable.php
492492

493493
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
494-
use PowerComponents\LivewirePowerGrid\Cache;
494+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
495495

496496
class DishTable extends PowerGridComponent
497497
{
498498
public function setUp(): array
499499
{
500-
Cache::make()// [!code ++:3]
501-
->forever()
502-
->prefix(auth()->id . '_'), //result: 1_powergrid-dish-DishTable
500+
return [
501+
PowerGrid::cache()// [!code ++:3]
502+
->prefix(auth()->id . '_'), //result: 1_powergrid-dish-DishTable
503+
]
503504
}
504505
}
505506
```
@@ -511,9 +512,10 @@ use PowerComponents\LivewirePowerGrid\Cache;
511512

512513
public function setUp(): array
513514
{
514-
Cache::make()// [!code ++:3]
515-
->forever(),
516-
->customTag('my-custom-tag'),
515+
return [
516+
PowerGrid::cache()// [!code ++:3]
517+
->customTag('my-custom-tag'),
518+
]
517519
}
518520
```
519521

@@ -556,7 +558,6 @@ Here you can find all the methods available in the `LivewirePowerGrid\Cache` cla
556558

557559
| Method | Description |
558560
|-------|--------------|
559-
| `forever()` | Creates a cache using the [rememberForever](https://laravel.com/docs/cache#retrieve-store) method. |
560561
| `ttl()` | Maximum time in seconds for which the data can be cached. |
561562
| `customTag()` | Allows you to set a custom cache tag. |
562563
| `prefix()` | Sets a prefix for the cache tag. |

docs/table-features/exporting-data.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ To configure the feature, proceed to chain to `make()` as many [Data Export Conf
3838
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
3939
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
4040
use PowerComponents\LivewirePowerGrid\Exportable; // [!code ++]
41+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
4142
4243
class DishTable extends PowerGridComponent
4344
{
4445
use WithExport;
4546
4647
public function setUp(): array
4748
{
48-
Exportable::make(fileName: 'my-export-file') // [!code ++]
49+
PowerGrid::exportable(fileName: 'my-export-file') // [!code ++]
4950
->type(Exportable::TYPE_XLS, Exportable::TYPE_CSV), // [!code ++]
5051
}
5152
}
@@ -114,14 +115,15 @@ Example:
114115
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
115116
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
116117
use PowerComponents\LivewirePowerGrid\Exportable;
118+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
117119

118120
class DishTable extends PowerGridComponent
119121
{
120122
use WithExport;
121123

122124
public function setUp(): array
123125
{
124-
Exportable::make(fileName: 'my-export-file') // [!code ++:5]
126+
PowerGRid::exportable(fileName: 'my-export-file') // [!code ++:5]
125127
->columnWidth([
126128
2 => 30,
127129
4 => 20,
@@ -146,14 +148,15 @@ Example:
146148
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
147149
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
148150
use PowerComponents\LivewirePowerGrid\Exportable;
151+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
149152

150153
class DishTable extends PowerGridComponent
151154
{
152155
use WithExport;
153156

154157
public function setUp(): array
155158
{
156-
Exportable::make(fileName: 'my-export-file') // [!code ++:2]
159+
PowerGrid::exportable(fileName: 'my-export-file') // [!code ++:2]
157160
->stripe('A6ACCD'),
158161
}
159162
}
@@ -203,13 +206,14 @@ Example:
203206
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
204207
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
205208
use PowerComponents\LivewirePowerGrid\Exportable;
209+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
206210

207211
class DishTable extends PowerGridComponent
208212
{
209213
public function setUp()
210214
{
211215
return [
212-
Exportable::make('export')// [!code ++:6]
216+
PowerGrid::exportable('export')// [!code ++:6]
213217
->striped()
214218
->type(Exportable::TYPE_XLS, Exportable::TYPE_CSV)
215219
->queues(6)
@@ -300,14 +304,14 @@ class DishTable extends PowerGridComponent
300304

301305
### make()
302306

303-
Make new `PowerGrid\Exportable` class.
307+
Make new `\PowerComponents\LivewirePowerGrid\Facades\PowerGrid;` facade.
304308

305309
| Parameters | Description |
306310
|-----------------------|---------------------------------------------------|
307311
| (string) $fileName | Name of the file that will contain exported data |
308312

309313
```php
310-
Exportable::make(fileName: 'my-export-file'),
314+
PowerGrid::exportable(fileName: 'my-export-file'),
311315
```
312316

313317
---
@@ -323,7 +327,7 @@ Set the file types available for data exporting.
323327
Example:
324328

325329
```php
326-
Exportable::make('my-export-file')
330+
PowerGrid::exportable('my-export-file')
327331
->type(types: Exportable::TYPE_XLS, Exportable::TYPE_CSV),
328332
```
329333

@@ -339,7 +343,7 @@ When exporting to CSV, you may configure the `field separator` and `field delimi
339343
| (string) $delimiter | CSV Delimiter |
340344

341345
```php
342-
Exportable::make('my-export-file')
346+
PowerGrid::exportable('my-export-file')
343347
->type(Exportable::TYPE_CSV)
344348
->csvSeparator(separator: '|')
345349
->csvDelimiter(delimiter: "'"),

docs/table-features/pagination.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ On this page, you can find information on customizing pagination settings. You m
1818

1919
PowerGrid includes an easy-to-configure built-in Pagination system.
2020

21-
To enable pagination, you must add a call to the `Footer::make()` class in your Component's `setUp()` method. Then, proceed to chain the `showPerPage()` method to the `Footer` class.
21+
To enable pagination, you must add a call to the `PowerGrid::footer()` class in your Component's `setUp()` method. Then, proceed to chain the `showPerPage()` method to the `Footer` class.
2222

2323
Example:
2424

2525
```php
2626
// app/Livewire/DishTable.php
2727

2828
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
29-
use PowerComponents\LivewirePowerGrid\Footer; // [!code ++]
29+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
3030

3131
class DishTable extends PowerGridComponent
3232
{
3333
public function setUp(): array
3434
{
3535
return [
36-
Footer::make()// [!code ++]
36+
PowerGrid::footer()// [!code ++]
3737
->showPerPage(perPage: 10, perPageValues: [0, 50, 100, 500]), // [!code ++]
3838
];
3939
}
@@ -54,14 +54,14 @@ Example:
5454
// app/Livewire/DishTable.php
5555

5656
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
57-
use PowerComponents\LivewirePowerGrid\Footer;
57+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
5858

5959
class DishTable extends PowerGridComponent
6060
{
6161
public function setUp(): array
6262
{
6363
return [
64-
Footer::make()// [!code ++]
64+
PowerGrid::footer()// [!code ++]
6565
->showPerPage() // [!code --]
6666
->showRecordCount(mode: 'full'), // [!code ++]
6767
];
@@ -89,14 +89,14 @@ Example:
8989
// app/Livewire/DishTable.php
9090

9191
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
92-
use PowerComponents\LivewirePowerGrid\Footer; // [!code ++]
92+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
9393

9494
class DishTable extends PowerGridComponent
9595
{
9696
public function setUp(): array
9797
{
9898
return [
99-
Footer::make()// [!code ++]
99+
PowerGrid::footer()// [!code ++]
100100
->showRecordCount(mode: 'full'), // [!code ++]
101101
];
102102
}
@@ -117,14 +117,14 @@ The `DishTable` component uses the `dishPage` parameter from the URL, while the
117117
// app/Livewire/DishTable.php
118118

119119
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
120-
use PowerComponents\LivewirePowerGrid\Footer; // [!code ++]
120+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
121121

122122
class DishTable extends PowerGridComponent
123123
{
124124
public function setUp(): array
125125
{
126126
return [
127-
Footer::make()// [!code ++:2]
127+
PowerGrid::footer()// [!code ++:2]
128128
->pageName('dishPage'),
129129
];
130130
}
@@ -135,14 +135,14 @@ class DishTable extends PowerGridComponent
135135
// app/Livewire/UserTable.php
136136

137137
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
138-
use PowerComponents\LivewirePowerGrid\Footer; // [!code ++]
138+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
139139

140140
class UserTable extends PowerGridComponent
141141
{
142142
public function setUp(): array
143143
{
144144
return [
145-
Footer::make()// [!code ++:2]
145+
PowerGrid::footer()// [!code ++:2]
146146
->pageName('userPage'),
147147
];
148148
}
@@ -172,14 +172,14 @@ Your custom component will have access to the `$perPage` and `$perPageValues` pr
172172
// app/Livewire/DishTable.php
173173

174174
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
175-
use PowerComponents\LivewirePowerGrid\Footer; // [!code ++]
175+
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid; // [!code ++]
176176

177177
class DishTable extends PowerGridComponent
178178
{
179179
public function setUp(): array
180180
{
181181
return [
182-
Footer::make()// [!code ++]
182+
PowerGrid::footer()// [!code ++]
183183
->showPerPage(25)// [!code ++]
184184
->showRecordCount()// [!code ++]
185185
->pagination(viewPath: 'components.pagination'),// [!code ++]

0 commit comments

Comments
 (0)