Skip to content

Commit b31e3f8

Browse files
committed
Core Adjustments
1 parent 1b1d6d8 commit b31e3f8

File tree

79 files changed

+2067
-468
lines changed

Some content is hidden

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

79 files changed

+2067
-468
lines changed

docs/examples/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Examples
3-
weight: 16
3+
weight: 17
44
---

docs/misc/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Misc.
3-
weight: 17
3+
weight: 18
44
---

docs/tools/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: Tools
3+
weight: 16
4+
---

docs/tools/introduction.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Introduction
3+
weight: 1
4+
---
5+
6+
7+
The Table offers additional configuration to show/hide the Tools/Toolbar sections.
8+
9+
## Tools
10+
Contains:
11+
- Filter Pills
12+
- Sorting Pills
13+
- The Toolbar
14+
15+
## Toolbar
16+
Contains:
17+
- Actions (if set to Toolbar)
18+
- Column Select dropdown
19+
- Configurable Areas for Toolbar
20+
- Filters Button/Dropdown/Popover
21+
- Pagination dropdown
22+
- Reorder Button
23+
- Search Input

docs/tools/styling.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Styling
3+
weight: 4
4+
---
5+
6+
## Component Available Methods
7+
8+
### setToolsAttributes
9+
Allows setting of attributes for the parent element in the tools blade
10+
11+
By default, this replaces the default classes on the tools blade, if you would like to keep them, set the default-colors/default-styling flags to true as appropriate
12+
13+
```php
14+
public function configure(): void
15+
{
16+
$this->setToolsAttributes(['class' => ' bg-green-500', 'default-colors' => false, 'default-styling' => true]);
17+
}
18+
```
19+
20+
### setToolBarAttributes
21+
Allows setting of attributes for the parent element in the toolbar blade.
22+
23+
By default, this replaces the default classes on the toolbar blade, if you would like to keep them, set the default-colors/default-styling flags to true as appropriate
24+
25+
```php
26+
public function configure(): void
27+
{
28+
$this->setToolBarAttributes(['class' => ' bg-red-500', 'default-colors' => false, 'default-styling' => true]);
29+
}
30+
```

docs/tools/toolbar.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: ToolBar
3+
weight: 3
4+
---
5+
6+
## Component Available Methods
7+
8+
### setToolBarEnabled
9+
The Default Behaviour, ToolBar is Enabled. But will only be rendered if there are available/enabled elements
10+
```php
11+
public function configure(): void
12+
{
13+
$this->setToolBarEnabled();
14+
}
15+
```
16+
17+
### setToolBarDisabled
18+
Disables the Toolbar, which contains the Reorder, Filters, Search, Column Select, Pagination buttons/options. Does not impact the Filter/Sort pills (if enabled)
19+
```php
20+
public function configure(): void
21+
{
22+
$this->setToolBarDisabled();
23+
}
24+
```
25+
26+
27+
### Customising the Order:
28+
29+
You can add/remove items or change the order within the Toolbar Sections:
30+
31+
| Item | Purpose |
32+
| --- | --- |
33+
| 'bulk-actions' | The Bulk Actions dropdown |
34+
| 'column-select' | The Column Select dropdown |
35+
| 'filters' | The Filters Button |
36+
| 'pagination-dropdown' | The Pagination dropdown |
37+
| 'reorder' | The Reorder Button |
38+
| 'search' | The Search Input |
39+
40+
Note that these sections are prepended/appended with the relevant configurableArea
41+
42+
#### Customising The Left Elements
43+
By default, the following is returned.
44+
```php
45+
public function toolbarItemsLeft()
46+
{
47+
return ['reorder','search','filters'];
48+
}
49+
```
50+
51+
#### Customising The Right Elements
52+
By default, the following is returned:
53+
```php
54+
public function toolbarItemsRight()
55+
{
56+
return ['bulk-actions','column-select','pagination-dropdown'];
57+
}
58+
```

docs/tools/tools.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Tools
3+
weight: 2
4+
---
5+
6+
## Component Available Methods
7+
8+
### setToolsEnabled
9+
The Default Behaviour, Tools Are Enabled. But will only be rendered if there are available/enabled elements. If the Toolbar is enabled, this takes into account any Toolbar elements that are present.
10+
```php
11+
public function configure(): void
12+
{
13+
$this->setToolsEnabled();
14+
}
15+
```
16+
17+
### setToolsDisabled
18+
Disables the Tools section, this includes the Toolbar, and Sort/Filter pills
19+
```php
20+
public function configure(): void
21+
{
22+
$this->setToolsDisabled();
23+
}
24+
```

resources/views/components/tools/toolbar/items/search/input.blade.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
@aware(['isTailwind', 'isTailwind4', 'isBootstrap', 'searchViewAttributes'])
2+
@props(['searchOptions' => '', 'searchPlaceholder' => null, 'searchFieldAttributes' => [], 'hasSearch' => false, 'icon' => []])
23
<input
3-
wire:model{{ $searchViewAttributes['searchOptions'] }}="search"
4-
placeholder="{{ $searchViewAttributes['searchPlaceholder'] }}"
4+
wire:model{{ $searchOptions }}="search"
5+
placeholder="{{ $searchPlaceholder }}"
56
type="text"
67
{{
7-
$attributes->merge($searchViewAttributes['searchFieldAttributes'])
8+
$attributes->merge($searchFieldAttributes)
89
->class(($isTailwind || $isTailwind4) ?
910
[
10-
'h-min rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 rounded-none rounded-l-md focus:ring-0 focus:border-gray-300' => $searchViewAttributes['hasSearch'] && (($searchViewAttributes['searchFieldAttributes']['default'] ?? true) || ($searchViewAttributes['searchFieldAttributes']['default-styling'] ?? true)),
11-
'h-min rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 rounded-md focus:ring focus:ring-opacity-50' => !$searchViewAttributes['hasSearch'] && (($searchViewAttributes['searchFieldAttributes']['default'] ?? true) || ($searchViewAttributes['searchFieldAttributes']['default-styling'] ?? true)),
12-
'border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-600 focus:border-gray-300' =>$searchViewAttributes['hasSearch'] && (($searchViewAttributes['searchFieldAttributes']['default'] ?? true) || ($searchViewAttributes['searchFieldAttributes']['default-colors'] ?? true)),
13-
'border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-600 focus:border-indigo-300 focus:ring-indigo-200' =>!$searchViewAttributes['hasSearch'] && (($searchViewAttributes['searchFieldAttributes']['default'] ?? true) || ($searchViewAttributes['searchFieldAttributes']['default-colors'] ?? true)),
14-
'block w-full' => !$searchViewAttributes['icon']['hasSearchIcon'],
15-
'pl-8 pr-4' => $searchViewAttributes['icon']['hasSearchIcon'],
11+
'h-min rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 rounded-none rounded-l-md focus:ring-0 focus:border-gray-300' => $hasSearch && (($searchFieldAttributes['default'] ?? true) || ($searchFieldAttributes['default-styling'] ?? true)),
12+
'h-min rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 rounded-md focus:ring focus:ring-opacity-50' => !$hasSearch && (($searchFieldAttributes['default'] ?? true) || ($searchFieldAttributes['default-styling'] ?? true)),
13+
'border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-600 focus:border-gray-300' =>$hasSearch && (($searchFieldAttributes['default'] ?? true) || ($searchFieldAttributes['default-colors'] ?? true)),
14+
'border-gray-300 dark:bg-gray-700 dark:text-white dark:border-gray-600 focus:border-indigo-300 focus:ring-indigo-200' =>!$hasSearch && (($searchFieldAttributes['default'] ?? true) || ($searchFieldAttributes['default-colors'] ?? true)),
15+
'block w-full' => !$icon['hasSearchIcon'],
16+
'pl-8 pr-4' => $icon['hasSearchIcon'],
1617
] :
1718
[
18-
'form-control' => $searchViewAttributes['searchFieldAttributes']['default'] ?? true,
19-
'block w-full' => !$searchViewAttributes['icon']['hasSearchIcon'],
20-
'pl-8 pr-4' => $searchViewAttributes['icon']['hasSearchIcon'],
19+
'form-control' => $searchFieldAttributes['default'] ?? true,
20+
'block w-full' => !$icon['hasSearchIcon'],
21+
'pl-8 pr-4' => $icon['hasSearchIcon'],
2122
],
2223
)
2324
->except(['default','default-styling','default-colors'])

resources/views/components/tools/toolbar/toolbar.blade.php

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,10 @@
1515
'w-full mb-2 md:mb-0 md:w-2/4 md:flex space-y-4 md:space-y-0 md:space-x-2' => ($isTailwind),
1616
])
1717
>
18-
@if ($this->hasConfigurableAreaFor('toolbar-left-start'))
19-
<div x-cloak x-show="!currentlyReorderingStatus" @class([
20-
'mb-3 mb-md-0 input-group' => $isBootstrap,
21-
'flex rounded-md shadow-sm' => $isTailwind,
22-
])>
23-
@include($this->getConfigurableAreaFor('toolbar-left-start'), $this->getParametersForConfigurableArea('toolbar-left-start'))
24-
</div>
25-
@endif
18+
@foreach($this->toolBarItems['left'] as $index => $tbLeftItem)
19+
@include($tbLeftItem['view'], $tbLeftItem['attributes'])
20+
@endforeach
2621

27-
@if ($this->showReorderButton())
28-
<x-livewire-tables::tools.toolbar.items.reorder-buttons />
29-
@endif
30-
31-
@if ($this->showSearchField())
32-
<x-livewire-tables::tools.toolbar.items.search :searchViewAttributes="$this->getSearchViewAttributes()" />
33-
@endif
34-
35-
@if ($this->showFiltersButton())
36-
<x-livewire-tables::tools.toolbar.items.filter-button />
37-
@endif
38-
39-
@if($this->showActionsInToolbarLeft())
40-
<x-livewire-tables::actions />
41-
@endif
42-
43-
@if ($this->hasConfigurableAreaFor('toolbar-left-end'))
44-
<div x-cloak x-show="!currentlyReorderingStatus" @class([
45-
'mb-3 mb-md-0 input-group' => $isBootstrap,
46-
'flex rounded-md shadow-sm' => $isTailwind,
47-
])>
48-
@include($this->getConfigurableAreaFor('toolbar-left-end'), $this->getParametersForConfigurableArea('toolbar-left-end'))
49-
</div>
50-
@endif
5122
</div>
5223

5324
<div x-cloak x-show="!currentlyReorderingStatus"
@@ -56,26 +27,12 @@
5627
'md:flex md:items-center space-y-4 md:space-y-0 md:space-x-2 h-full content-center items-center justify-center' => ($isTailwind),
5728
])
5829
>
59-
@includeWhen($this->hasConfigurableAreaFor('toolbar-right-start'), $this->getConfigurableAreaFor('toolbar-right-start'), $this->getParametersForConfigurableArea('toolbar-right-start'))
60-
61-
62-
@if($this->showActionsInToolbarRight())
63-
<x-livewire-tables::actions />
64-
@endif
65-
66-
@if ($this->showBulkActionsDropdownAlpine() && $this->shouldAlwaysHideBulkActionsDropdownOption != true)
67-
<x-livewire-tables::tools.toolbar.items.bulk-actions />
68-
@endif
6930

70-
@if ($this->columnSelectIsEnabled())
71-
<x-livewire-tables::tools.toolbar.items.column-select />
72-
@endif
31+
@foreach($this->toolBarItems['right'] as $index => $tbRightItem)
32+
@include($tbRightItem['view'], $tbRightItem['attributes'])
33+
@endforeach
7334

74-
@if ($this->showPaginationDropdown())
75-
<x-livewire-tables::tools.toolbar.items.pagination-dropdown />
76-
@endif
7735

78-
@includeWhen($this->hasConfigurableAreaFor('toolbar-right-end'), $this->getConfigurableAreaFor('toolbar-right-end'), $this->getParametersForConfigurableArea('toolbar-right-end'))
7936
</div>
8037
</div>
8138

resources/views/components/tools/tools.blade.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<x-livewire-tables::tools.sorting-pills />
1515
@endif
1616

17-
@if($this->showFilterPillsSection())
17+
@if(method_exists($this, 'showFilterPillsSection') ? $this->showFilterPillsSection() : false)
1818
<x-livewire-tables::tools.filter-pills />
1919
@endif
2020

@@ -28,12 +28,7 @@
2828
<x-livewire-tables::tools.toolbar />
2929
@endif
3030

31-
@if (
32-
$this->filtersAreEnabled() &&
33-
$this->filtersVisibilityIsEnabled() &&
34-
$this->hasVisibleFilters() &&
35-
$this->isFilterLayoutSlideDown()
36-
)
31+
@if ($this->shouldShowToolsFilterSection())
3732
<x-livewire-tables::tools.toolbar.items.filter-slidedown />
3833
@endif
3934

0 commit comments

Comments
 (0)