Skip to content

Commit 6449522

Browse files
authored
Merge pull request #111 from Gustavinho/release/2.3.0-pr
Release/2.3.0 pr
2 parents 2584aff + 68b0528 commit 6449522

27 files changed

+268
-71
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"bladeFormatter.format.indentSize": 2,
3+
"bladeFormatter.format.wrapAttributes": "force"
4+
}

doc/list-view.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This view creates a dynamic list view with filters, pagination, search input, an
1010
- [Defining initial data](#defining-initial-data)
1111
- [Defining data for each list item](#defining-data-for-each-list-item)
1212
- [Customizing the list item component](#customizing-the-list-item-component)
13+
- [Sorting Data](#sorting-data)
1314
- [More features](#more-features)
1415
- [Searching data](./table-view.md#searching-data)
1516
- [Pagination](./table-view.md#pagination)
@@ -96,6 +97,21 @@ Don't forget to include the actions for each list item, there is a component out
9697
</div>
9798
```
9899

100+
## Sorting Data
101+
You can provide your list view with a sorting drop down by overriding the sortablyBy function on your list view. You may assign the $sortBy property to choose the column that the list view is sorted by when the page first loads.
102+
103+
```php
104+
public $sortBy = 'name';
105+
106+
public function sortableBy()
107+
{
108+
return [
109+
'Name' => 'name',
110+
'Email' => 'email'
111+
];
112+
}
113+
```
114+
99115
## More features
100116
This list view is based on a table view, so you could use some of the table view features as:
101117

resources/views/components/actions/actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div>
44
@if (count($actions))
55
{{-- Mobile actions dropdown --}}
6-
<div class="lg:hidden">
6+
<div class="lg:hidden text-right relative">
77
<x-lv-drop-down>
88
<x-slot name="trigger">
99
<x-lv-icon-button icon="more-horizontal" size="sm" />

resources/views/components/actions/drop-down.blade.php

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{-- components.buttons.select
2+
3+
Renders a button like a select dropdown. Most likely used in conjunction with the components.drop-down
4+
You can customize all the html and css classes but YOU MUST KEEP THE BLADE AND LIVEWIRE DIRECTIVES,
5+
it is using the variant helper to get the styles for each variant
6+
it could be primary, primary-light
7+
8+
You can customize the variants classes in config/laravel-views.php
9+
10+
props
11+
- icon --}}
12+
@props(['icon' => 'chevron-down'])
13+
<button
14+
class="border border-transparent hover:border-gray-300 focus:border-gray-300 focus:outline-none flex items-center gap-1 text-xs px-3 py-2 rounded hover:shadow-sm font-medium"
15+
>
16+
{{ $slot }}
17+
<i data-feather="{{ $icon }}" class="w-4 h-4"></i>
18+
</button>

resources/views/components/drop-down.blade.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
Renders the a dropdown button with its different variants
44
You can customize all the html and css classes but YOU MUST KEEP THE BLADE AND LIVEWIRE DIRECTIVES,
55
6-
props:
7-
- $title
8-
- $varian
9-
- $slot
6+
- slots:
7+
- trigger
8+
--}}
109

11-
UI components used:
12-
- button --}}
10+
@props(['dropDownWidth' => 64])
1311

1412
<div
15-
class="text-right relative"
13+
class="relative"
1614
x-data="{ open: false }"
1715
>
1816
@isset($trigger)
@@ -29,7 +27,7 @@ class="text-right relative"
2927
@endisset
3028

3129
<div
32-
class="bg-white shadow-lg rounded absolute top-8 right-0 w-64 border text-left z-10"
30+
class="bg-white shadow-lg rounded absolute top-8 right-0 border text-left z-10 w-{{ isset($dropDownWidth) ? $dropDownWidth : 'full' }}"
3331
x-show.transition="open"
3432
@click.away="open = false"
3533
x-cloak

resources/views/table-view/boolean-filter.blade.php renamed to resources/views/components/filters/boolean-filter.blade.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{{-- table-view.boolean.blade
2-
1+
{{-- components.filters.boolean.blade
32
Renders the input radius for the boolean filter
43
You can customize all the html and css classes but YOU MUST KEEP THE BLADE AND LIVEWIERE DIRECTIVES
54
--}}

resources/views/table-view/date-filter.blade.php renamed to resources/views/components/filters/date-filter.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{-- table-view.date.blade
1+
{{-- components.filters.date.blade
22
33
Renders the datepicker for the date filter
44
To customize it you should shange the UI component used, YOU SHOULD NOT CUSTOMIZE ANYHING HERE

resources/views/table-view/select-filter.blade.php renamed to resources/views/components/filters/select-filter.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{-- table-view.select.blade
1+
{{-- components.filters.select.blade
22
33
Renders the dropdown for the select filter
44
To customize it you should shange the UI component used, YOU SHOULD NOT CUSTOMIZE ANYHING HERE

resources/views/components/form/input-group.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{-- table-view.select.blade
1+
{{-- components.form.input-group.blade
22
33
Renders a input group component
44
You can customize all the html and css classes but YOU MUST KEEP THE BLADE AND LIVEWIERE DIRECTIVES

0 commit comments

Comments
 (0)