Skip to content

Commit 673cc58

Browse files
lrljoegithub-actions[bot]
authored andcommitted
Fix styling
1 parent 7d6fac7 commit 673cc58

File tree

5 files changed

+96
-101
lines changed

5 files changed

+96
-101
lines changed
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration;
4-
5-
trait ToolsStylingConfiguration
6-
{
7-
public function setToolsAttributes(array $toolsAttributes = []): self
8-
{
9-
$this->setCustomAttributes(propertyName: 'toolsAttributes', customAttributes: $toolsAttributes);
10-
11-
return $this;
12-
}
13-
14-
public function setToolBarAttributes(array $toolBarAttributes = []): self
15-
{
16-
$this->setCustomAttributes(propertyName: 'toolBarAttributes', customAttributes: $toolBarAttributes);
17-
18-
return $this;
19-
}
20-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration;
4+
5+
trait ToolsStylingConfiguration
6+
{
7+
public function setToolsAttributes(array $toolsAttributes = []): self
8+
{
9+
$this->setCustomAttributes(propertyName: 'toolsAttributes', customAttributes: $toolsAttributes);
10+
11+
return $this;
12+
}
13+
14+
public function setToolBarAttributes(array $toolBarAttributes = []): self
15+
{
16+
$this->setCustomAttributes(propertyName: 'toolBarAttributes', customAttributes: $toolBarAttributes);
17+
18+
return $this;
19+
}
20+
}
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Traits\Styling;
4-
5-
use Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration\ToolsStylingConfiguration;
6-
use Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers\ToolsStylingHelpers;
7-
8-
trait HasToolsStyling
9-
{
10-
use ToolsStylingConfiguration,
11-
ToolsStylingHelpers;
12-
13-
protected array $toolsAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => ''];
14-
15-
protected array $toolBarAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => ''];
16-
17-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Traits\Styling;
4+
5+
use Rappasoft\LaravelLivewireTables\Traits\Styling\Configuration\ToolsStylingConfiguration;
6+
use Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers\ToolsStylingHelpers;
7+
8+
trait HasToolsStyling
9+
{
10+
use ToolsStylingConfiguration,
11+
ToolsStylingHelpers;
12+
13+
protected array $toolsAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => ''];
14+
15+
protected array $toolBarAttributes = ['default-styling' => true, 'default-colors' => true, 'class' => ''];
16+
}
Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers;
4-
5-
use Livewire\Attributes\Computed;
6-
use Illuminate\View\ComponentAttributeBag;
7-
8-
trait ToolsStylingHelpers
9-
{
10-
11-
protected function getToolsAttributes(): array
12-
{
13-
return $this->getCustomAttributes(propertyName: 'toolsAttributes', default: false, classicMode: false);
14-
}
15-
16-
#[Computed]
17-
public function getToolsAttributesBag(): ComponentAttributeBag
18-
{
19-
return $this->getCustomAttributesBagFromArray($this->getToolsAttributes());
20-
}
21-
22-
protected function getToolBarAttributes(): array
23-
{
24-
return $this->getCustomAttributes(propertyName: 'toolBarAttributes', default: false, classicMode: false);
25-
}
26-
27-
#[Computed]
28-
public function getToolBarAttributesBag(): ComponentAttributeBag
29-
{
30-
return $this->getCustomAttributesBagFromArray($this->getToolBarAttributes());
31-
32-
}
33-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Traits\Styling\Helpers;
4+
5+
use Illuminate\View\ComponentAttributeBag;
6+
use Livewire\Attributes\Computed;
7+
8+
trait ToolsStylingHelpers
9+
{
10+
protected function getToolsAttributes(): array
11+
{
12+
return $this->getCustomAttributes(propertyName: 'toolsAttributes', default: false, classicMode: false);
13+
}
14+
15+
#[Computed]
16+
public function getToolsAttributesBag(): ComponentAttributeBag
17+
{
18+
return $this->getCustomAttributesBagFromArray($this->getToolsAttributes());
19+
}
20+
21+
protected function getToolBarAttributes(): array
22+
{
23+
return $this->getCustomAttributes(propertyName: 'toolBarAttributes', default: false, classicMode: false);
24+
}
25+
26+
#[Computed]
27+
public function getToolBarAttributesBag(): ComponentAttributeBag
28+
{
29+
return $this->getCustomAttributesBagFromArray($this->getToolBarAttributes());
30+
31+
}
32+
}

src/Traits/WithTools.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ trait WithTools
1515
protected bool $toolsStatus = true;
1616

1717
protected bool $toolBarStatus = true;
18-
19-
2018
}
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Helpers;
4-
5-
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
6-
7-
final class ToolsStylingHelpersTest extends TestCase
8-
{
9-
public function test_can_get_tools_attributes_initial_status(): void
10-
{
11-
$this->assertTrue($this->basicTable->hasCustomAttributes('toolsAttributes'));
12-
}
13-
14-
public function test_can_get_tools_attributes_initial_values(): void
15-
{
16-
$this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolsAttributesBag()->getAttributes());
17-
}
18-
19-
public function test_can_get_toolbar_attributes_initial_status(): void
20-
{
21-
$this->assertTrue($this->basicTable->hasCustomAttributes('toolBarAttributes'));
22-
}
23-
24-
public function test_can_get_toolbar_attributes_initial_values(): void
25-
{
26-
$this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolBarAttributesBag()->getAttributes());
27-
}
28-
29-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Helpers;
4+
5+
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
6+
7+
final class ToolsStylingHelpersTest extends TestCase
8+
{
9+
public function test_can_get_tools_attributes_initial_status(): void
10+
{
11+
$this->assertTrue($this->basicTable->hasCustomAttributes('toolsAttributes'));
12+
}
13+
14+
public function test_can_get_tools_attributes_initial_values(): void
15+
{
16+
$this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolsAttributesBag()->getAttributes());
17+
}
18+
19+
public function test_can_get_toolbar_attributes_initial_status(): void
20+
{
21+
$this->assertTrue($this->basicTable->hasCustomAttributes('toolBarAttributes'));
22+
}
23+
24+
public function test_can_get_toolbar_attributes_initial_values(): void
25+
{
26+
$this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getToolBarAttributesBag()->getAttributes());
27+
}
28+
}

0 commit comments

Comments
 (0)