Skip to content

Commit

Permalink
Merge pull request #1787 from rappasoft/development
Browse files Browse the repository at this point in the history
v3.3.2
  • Loading branch information
lrljoe authored Jul 20, 2024
2 parents 6fb0016 + fe76d9c commit e74d834
Show file tree
Hide file tree
Showing 17 changed files with 734 additions and 284 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to `laravel-livewire-tables` will be documented in this file

## [v3.3.2] - 2024-07-20
### New Features
- Add a new ViewComponentColumn that runs the construction for a View Component by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1786
- Set Custom Classes for Collapsing Column - Collapse/Expand buttons by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1785

### Bug Fixes
- Fix DateTimeFilter by @RenoLooijmans in https://github.com/rappasoft/laravel-livewire-tables/pull/1784
- Fix AggregateColumn SnakeCase issue by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1777

## [v3.3.1] - 2024-07-16
### Bug Fixes
- Fix NumberRangeFilter initial state when loaded by querystring by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1774
Expand Down
32 changes: 32 additions & 0 deletions docs/column-types/view_component_column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: View Component Columns
weight: 14
---

View Component columns let you specify a component name and attributes and provide attributes to the View Component. This will render the View Component in it's entirety.

```php

ViewComponentColumn::make('E-mail', 'email')
->component('email')
->attributes(fn ($value, $row, Column $column) => [
'id' => $row->id,
'email' => $value,
]),
```

Please also see the following for other available methods:
<ul>
<li>
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/available-methods">Available Methods</a>
</li>
<li>
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/column-selection">Column Selection</a>
</li>
<li>
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/secondary-header">Secondary Header</a>
</li>
<li>
<a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/footer">Footer</a>
</li>
</ul>
2 changes: 1 addition & 1 deletion docs/column-types/wire_link_column.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Wire Link Column (beta)
weight: 14
weight: 15
---

WireLink columns provide a way to display Wired Links in your table without having to use `format()` or partial views, with or without a Confirmation Message
Expand Down
280 changes: 2 additions & 278 deletions docs/datatable/available-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,283 +20,7 @@ public function configure(): void

## Attributes

### setComponentWrapperAttributes

Set a list of attributes to override on the main wrapper of the component

```php
public function configure(): void
{
$this->setComponentWrapperAttributes([
'id' => 'my-id',
'class' => 'this that',
]);
}
```

### setTableWrapperAttributes

Set a list of attributes to override on the div that wraps the table

```php
public function configure(): void
{
$this->setTableWrapperAttributes([
'id' => 'my-id',
'class' => 'this that',
]);
}
```

By default, this replaces the default classes on the table wrapper, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setTableWrapperAttributes([
'default' => true,
'class' => 'added these classes',
]);
}
```

### setTableAttributes

Set a list of attributes to override on the table element

```php
public function configure(): void
{
$this->setTableAttributes([
'id' => 'my-id',
'class' => 'this that',
]);
}
```

By default, this replaces the default classes on the table, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setTableAttributes([
'default' => true,
'class' => 'added these classes',
]);
}
```

### setTheadAttributes

Set a list of attributes to override on the thead element

```php
public function configure(): void
{
$this->setTheadAttributes([
'id' => 'my-id',
'class' => 'this that',
]);
}
```

By default, this replaces the default classes on the thead, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setTheadAttributes([
'default' => true,
'class' => 'added these classes',
]);
}
```

### setTbodyAttributes

Set a list of attributes to override on the tbody element

```php
public function configure(): void
{
$this->setTbodyAttributes([
'id' => 'my-id',
'class' => 'this that',
]);
}
```

By default, this replaces the default classes on the tbody, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setTbodyAttributes([
'default' => true,
'class' => 'added these classes',
]);
}
```

### setThAttributes

Set a list of attributes to override on the th elements

```php
public function configure(): void
{
// Takes a callback that gives you the current column.
$this->setThAttributes(function(Column $column) {
if ($column->isField('name')) {
return [
'class' => 'bg-green-500',
];
}

return [];
});
}
```

By default, this replaces the default classes on the th, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setThAttributes(function(Column $column) {
if ($column->isField('name')) {
return [
'default' => true,
'class' => 'bg-green-500',
];
}

return ['default' => true];
});
}
```

### setThSortButtonAttributes

Set a list of attributes to override on the th sort button elements

```php
public function configure(): void
{
// Takes a callback that gives you the current column.
$this->setThSortButtonAttributes(function(Column $column) {
if ($column->isField('name')) {
return [
'class' => 'bg-green-500',
];
}

return [];
});
}
```

### setTrAttributes

Set a list of attributes to override on the tr elements

```php
public function configure(): void
{
// Takes a callback that gives you the current row and its index
$this->setTrAttributes(function($row, $index) {
if ($index % 2 === 0) {
return [
'class' => 'bg-gray-200',
];
}

return [];
});
}
```

By default, this replaces the default classes on the tr, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setTrAttributes(function($row, $index) {
if ($index % 2 === 0) {
return [
'default' => true,
'class' => 'bg-gray-200',
];
}

return ['default' => true];
});
}
```

### setTdAttributes

Set a list of attributes to override on the td elements

```php
public function configure(): void
{
// Takes a callback that gives you the current column, row, column index, and row index
$this->setTdAttributes(function(Column $column, $row, $columnIndex, $rowIndex) {
if ($column->isField('total') && $row->total < 1000) {
return [
'class' => 'bg-red-500 text-white',
];
}

return [];
});
}
```

By default, this replaces the default classes on the td, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
// Takes a callback that gives you the current column, row, column index, and row index
$this->setTdAttributes(function(Column $column, $row, $columnIndex, $rowIndex) {
if ($column->isField('total') && $row->total < 1000) {
return [
'default' => true,
'class' => 'bg-red-500 text-white',
];
}

return ['default' => true];
});
}

```
### setSearchFieldAttributes

Set a list of attributes to override on the search field

```php
public function configure(): void
{
$this->setSearchFieldAttributes([
'class' => 'this that',
]);
}
```

By default, this replaces the default classes on the search field, if you would like to keep them, set the default flag to true.

```php
public function configure(): void
{
$this->setSearchFieldAttributes([
'default' => true,
'class' => 'added these classes',
]);
}
```
Documentation for Data Table Styling/Attributes is now: <a href="https://rappasoft.com/docs/laravel-livewire-tables/v3/columns/styling" aria-label="Documentation for Data Table Styling" >Here</a>

## Offline

Expand Down Expand Up @@ -461,4 +185,4 @@ public function configure(): void
{
$this->setEmptyMessage('No results found');
}
```
```
Loading

0 comments on commit e74d834

Please sign in to comment.