Skip to content

Commit 24113be

Browse files
committed
Tweaks & Adjustments
1 parent 7a945b6 commit 24113be

File tree

18 files changed

+581
-238
lines changed

18 files changed

+581
-238
lines changed

docs/filters/filter-pills.md

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function configure(): void
5252
---
5353

5454
### setFilterPillsItemAttributes
55-
Allows for customisation of the appearance of the "Filter Pills Item"
55+
Allows for customisation of the appearance of each "Filter Pills Item"
5656

57-
Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods.
57+
Note that this allows for appending to, or replacing the styles and colors independently, via the below methods.
5858

5959
#### default-colors
6060
Setting to false will disable the default colors for the Filter Pills Item, the default colors are:
@@ -70,7 +70,19 @@ Bootstrap 4: `badge badge-pill badge-info d-inline-flex align-items-center`
7070

7171
Bootstrap 5: `badge rounded-pill bg-info d-inline-flex align-items-center`
7272

73-
Tailwind: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium leading-4 capitalize`
73+
Tailwind: `inline-flex items-center px-2.5 py-0.5 rounded-full leading-4`
74+
75+
#### default-text
76+
Setting to false will disable the default text styling for the Filter Pills Item, the default text styling is:
77+
78+
Bootstrap 4: none
79+
80+
Bootstrap 5: none
81+
82+
Tailwind: `text-xs font-medium capitalize`
83+
84+
Note that colors are handled via default-colours
85+
7486

7587
```php
7688
public function configure(): void
@@ -88,7 +100,7 @@ public function configure(): void
88100
### setFilterPillsResetFilterButtonAttributes
89101
Allows for customisation of the appearance of the "Filter Pills Reset Filter Button"
90102

91-
Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods.
103+
Note that this utilises allows for appending to, or replacing the styles and colors independently, via the below methods.
92104

93105
#### default-colors
94106
Setting to false will disable the default colors for the Filter Pills Reset Filter Button, the default colors are:
@@ -120,7 +132,7 @@ public function configure(): void
120132
### setFilterPillsResetAllButtonAttributes
121133
Allows for customisation of the appearance of the "Filter Pills Reset All Button"
122134

123-
Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods.
135+
Note that this allows for appending to, or replacing the styles and colors independently, via the below methods.
124136

125137
#### default-colors
126138
Setting to false will disable the default colors for the Filter Pills Reset All Button, the default colors are:
@@ -198,7 +210,10 @@ SelectFilter::make('Active')
198210

199211
### setFilterPillBlade
200212

201-
Set a blade file for use in displaying the filter values in the pills area. You can use this in conjunction with setFilterPillValues() to prettify your applied filter values display. You will receive two properties ($filter) containing the filter instance, and ($value) containing the filter value.
213+
Set a blade file for use in displaying the filter values in the pills area. You can use this in conjunction with setFilterPillValues() to prettify your applied filter values display. You will receive two properties:
214+
- $filter which contains the filter instance
215+
- $filterPillData which contains an instance of "Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData"
216+
This provides ready access to configured pills elements
202217

203218
```php
204219
SelectFilter::make('Active')
@@ -208,20 +223,33 @@ SelectFilter::make('Active')
208223
Example blade:
209224
```php
210225
@aware(['tableName','isTailwind','isBootstrap','isBootstrap4','isBootstrap5'])
211-
@props(['filterPillTitle', 'filterPillValue', 'filterSelectName', 'separator'])
212-
<x-livewire-tables::tools.filter-pills.wrapper :$filterSelectName>
213-
{{ $filterPillTitle }}:
214-
215-
@if(is_array($filterPillValue))
216-
@foreach($filterPillValue as $filterPillArrayValue)
217-
{{ $filterPillArrayValue }}{!! !$loop->last ? $separator : '' !!}
218-
@endforeach
219-
@else
220-
{{ $filterPillValue }}
221-
@endif
226+
@props(['filterKey', 'filterPillData'])
227+
<x-livewire-tables::tools.filter-pills.wrapper :$filterKey :$filterPillData >
228+
229+
<span {{ $filterPillData->getFilterPillDisplayData() }}></span>
222230

223231
</x-livewire-tables::tools.filter-pills.wrapper>
232+
```
224233

234+
#### $filterPillData
235+
An example of the returned object is below:
236+
237+
```php
238+
Rappasoft\LaravelLivewireTables\DataTransferObjects\Filters\FilterPillData {
239+
#filterPillTitle: "Name"
240+
#filterSelectName: "name"
241+
#filterPillValue: "A Value Here"
242+
#separator: ", "
243+
+isAnExternalLivewireFilter: false
244+
+hasCustomPillBlade: true
245+
#customPillBlade: "tests.tables.pills.test"
246+
#filterPillsItemAttributes: array:4 [▼
247+
// Any Custom Defined Attributes
248+
]
249+
#separatedValues: null
250+
#renderPillsAsHtml: false
251+
#watchForEvents: false
252+
}
225253
```
226254

227255
### setPillAttributes
@@ -230,7 +258,7 @@ This may be used in conjunction with, or instead of the setFilterPillsItemAttrib
230258

231259
Note that if used, this will **replace** any matching array keys defined in the setFilterPillsItemAttributes method.
232260

233-
Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently
261+
Note that this allows for appending to, or replacing the styles and colors independently
234262

235263
#### default-colors
236264
Setting to false will disable the default colors for this Filter's Pills Item, the default colors are:
@@ -265,4 +293,23 @@ SelectFilter::make('Active')
265293
'default-colors' => false, // Replace the default colors classes
266294
'default-styling' => true // Use the default styling classes
267295
])
296+
```
297+
298+
### setPillResetButtonAttributes
299+
300+
This method allows for customisation of the filter's reset button within the Pills. This will merge/over-ride anything set in the Component setFilterPillsResetFilterButtonAttributes() method.
301+
302+
```php
303+
SelectFilter::make('Active')
304+
->options([
305+
'' => 'All',
306+
'1' => 'Yes',
307+
'0' => 'No',
308+
])
309+
->setFilterPillTitle('User Status')
310+
->setPillResetButtonAttributes([
311+
'class' => 'bg-red-500 text-cyan-500',
312+
'default-colors' => false, // Replace the default colors classes
313+
'default-styling' => true // Use the default styling classes
314+
])
268315
```

0 commit comments

Comments
 (0)