Skip to content

Commit 7b0d75c

Browse files
committed
Add setFilterSlidedownRowAttributes and setFilterSlidedownWrapperAttributes
1 parent a931da9 commit 7b0d75c

File tree

10 files changed

+746
-538
lines changed

10 files changed

+746
-538
lines changed
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
---
2+
title: Available Component Methods
3+
weight: 5
4+
---
5+
6+
These are the available filters configuration methods on the component. These are "table-wide" methods.
7+
8+
---
9+
10+
Filters are **enabled by default** but will only show up if you have at least one defined.
11+
12+
## setFiltersStatus
13+
14+
Enable/disable filters for the whole component.
15+
16+
```php
17+
public function configure(): void
18+
{
19+
$this->setFiltersStatus(true);
20+
$this->setFiltersStatus(false);
21+
}
22+
```
23+
24+
## setFiltersEnabled
25+
26+
Enable filters for the component.
27+
28+
```php
29+
public function configure(): void
30+
{
31+
// Shorthand for $this->setFiltersStatus(true)
32+
$this->setFiltersEnabled();
33+
}
34+
```
35+
36+
## setFiltersDisabled
37+
38+
Disable filters for the component.
39+
40+
```php
41+
public function configure(): void
42+
{
43+
// Shorthand for $this->setFiltersStatus(false)
44+
$this->setFiltersDisabled();
45+
}
46+
```
47+
48+
---
49+
50+
## setFiltersVisibilityStatus
51+
52+
**Enabled by default**, show/hide the filters dropdown.
53+
54+
```php
55+
public function configure(): void
56+
{
57+
$this->setFiltersVisibilityStatus(true);
58+
$this->setFiltersVisibilityStatus(false);
59+
}
60+
```
61+
62+
## setFiltersVisibilityEnabled
63+
64+
Show the filters dropdown for the component.
65+
66+
```php
67+
public function configure(): void
68+
{
69+
// Shorthand for $this->setFiltersVisibilityStatus(true)
70+
$this->setFiltersVisibilityEnabled();
71+
}
72+
```
73+
74+
## setFiltersVisibilityDisabled
75+
76+
Hide the filters dropdown for the component.
77+
78+
```php
79+
public function configure(): void
80+
{
81+
// Shorthand for $this->setFiltersVisibilityStatus(false)
82+
$this->setFiltersVisibilityDisabled();
83+
}
84+
```
85+
86+
---
87+
88+
## setFilterPillsStatus
89+
90+
**Enabled by default**, show/hide the filter pills.
91+
92+
```php
93+
public function configure(): void
94+
{
95+
$this->setFilterPillsStatus(true);
96+
$this->setFilterPillsStatus(false);
97+
}
98+
```
99+
100+
## setFilterPillsEnabled
101+
102+
Show the filter pills for the component.
103+
104+
```php
105+
public function configure(): void
106+
{
107+
// Shorthand for $this->setFilterPillsStatus(true)
108+
$this->setFilterPillsEnabled();
109+
}
110+
```
111+
112+
## setFilterPillsDisabled
113+
114+
Hide the filter pills for the component.
115+
116+
```php
117+
public function configure(): void
118+
{
119+
// Shorthand for $this->setFilterPillsStatus(false)
120+
$this->setFilterPillsDisabled();
121+
}
122+
```
123+
124+
---
125+
126+
## setFilterLayout
127+
128+
Set the filter layout for the component.
129+
130+
```php
131+
public function configure(): void
132+
{
133+
$this->setFilterLayout('slide-down');
134+
}
135+
```
136+
137+
## setFilterLayoutPopover
138+
139+
Set the filter layout to popover.
140+
141+
```php
142+
public function configure(): void
143+
{
144+
$this->setFilterLayoutPopover();
145+
}
146+
```
147+
148+
Set the filter layout to slide down.
149+
150+
## setFilterLayoutSlideDown
151+
152+
```php
153+
public function configure(): void
154+
{
155+
$this->setFilterLayoutSlideDown();
156+
}
157+
```
158+
159+
## setFilterSlideDownDefaultStatusEnabled
160+
161+
Set the filter slide down to visible by default
162+
163+
```php
164+
public function configure(): void
165+
{
166+
// Shorthand for $this->setFilterSlideDownDefaultStatus(true)
167+
$this->setFilterSlideDownDefaultStatusEnabled();
168+
}
169+
```
170+
171+
## setFilterSlideDownDefaultStatusDisabled
172+
173+
Set the filter slide down to collapsed by default
174+
175+
```php
176+
public function configure(): void
177+
{
178+
// Shorthand for $this->setFilterSlideDownDefaultStatus(false)
179+
$this->setFilterSlideDownDefaultStatusDisabled();
180+
}
181+
```
182+
183+
## storeFiltersInSessionEnabled
184+
185+
Optional behaviour - stores filter values in the session (specific to table - based on the table name)
186+
187+
### Exercise Caution
188+
If re-using the same Livewire Table Component multiple times in your site, with the same table name, this may cause clashes in filter values
189+
190+
```php
191+
public function configure(): void
192+
{
193+
$this->storeFiltersInSessionEnabled();
194+
}
195+
```
196+
## storeFiltersInSessionDisabled
197+
198+
Default behaviour - does not store filters in the session
199+
200+
```php
201+
public function configure(): void
202+
{
203+
$this->storeFiltersInSessionDisabled();
204+
}
205+
```
206+
207+
## setFilterPopoverAttributes
208+
209+
Allows for the customisation of the appearance of the Filter Popover Menu.
210+
211+
Note the addition of a "default-width" boolean, allowing you to customise the width more smoothly without impacting other applied classes.
212+
213+
You may also replace default colors by setting "default-colors" to false, or default styling by setting "default-styling" to false, and specifying replacement classes in the "class" property.
214+
215+
You can also replace the default transition behaviours (Tailwind) by specifying replacement attributes in the array.
216+
217+
```php
218+
public function configure(): void
219+
{
220+
$this->setFilterPopoverAttributes(
221+
[
222+
'class' => 'w-96',
223+
'default-width' => false,
224+
'default-colors' => true,
225+
'default-styling' => true,
226+
'x-transition:enter' => 'transition ease-out duration-100',
227+
]
228+
);
229+
}
230+
```
231+
232+
## setFilterSlidedownWrapperAttributes
233+
234+
Allows for the customisation of the appearance of the Filter Slidedown Wrapper.
235+
236+
You may also replace default colors by setting "default-colors" to false, or default styling by setting "default-styling" to false, and specifying replacement classes in the "class" property.
237+
238+
You can also replace the default transition behaviours (Tailwind) by specifying replacement attributes in the array, for example to extend the duration of the transition effect from the default duration-100 to duration-1000:
239+
240+
```php
241+
public function configure(): void
242+
{
243+
$this->setFilterSlidedownWrapperAttributes([
244+
'x-transition:enter' => 'transition ease-out duration-1000',
245+
'class' => 'text-black',
246+
'default-colors' => true,
247+
'default-styling' => true,
248+
]);
249+
}
250+
```
251+
252+
## setFilterSlidedownRowAttributes
253+
254+
Allows for the customisation of the appearance of the Filter Slidedown Row. Note that this uses a callback, which receives the "rowIndex" of the Slidedown Row
255+
256+
You may replace default colors by setting "default-colors" to false, or default styling by setting "default-styling" to false, and specifying replacement classes in the "class" property.
257+
258+
```php
259+
public function configure(): void
260+
{
261+
$this->setFilterSlidedownRowAttributes(fn($rowIndex) => $rowIndex % 2 === 0 ?
262+
[
263+
'class' => 'bg-red-500',
264+
'default-colors' => true,
265+
'default-styling' => true,
266+
] : [
267+
'class' => 'bg-blue-500',
268+
'default-colors' => true,
269+
'default-styling' => true,
270+
]
271+
);
272+
}
273+
```

0 commit comments

Comments
 (0)