Skip to content

Commit

Permalink
feat: add custom icon for table (#2)
Browse files Browse the repository at this point in the history
* add custom icon for table

* linting
  • Loading branch information
RobbertRitsema committed Jan 13, 2023
1 parent 91686fa commit 9279f2b
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/NotFound/Layout/Elements/LayoutBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function __construct()
public function removePadding(): self
{
$this->properties->removePadding = true;

return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Elements/LayoutButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function setSticky(): self

public function addAlternative(string $internal, string $display_name): self
{
if (!isset($this->properties->alternatives)) {
if (! isset($this->properties->alternatives)) {
$this->properties->alternatives = [];
}
$this->properties->alternatives[$internal] = $display_name;
Expand Down
8 changes: 8 additions & 0 deletions src/NotFound/Layout/Elements/Table/LayoutTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct(bool $sort = true, bool $delete = true, bool $edit =
$this->properties->sort = $sort;
$this->properties->delete = $delete;
$this->properties->edit = $edit;
$this->properties->editIcon = 'edit';
$this->properties->create = $create;
}

Expand All @@ -55,6 +56,13 @@ public function setTotalItems(int $number)
return $this;
}

public function setCustomEditIcon(string $iconName)
{
$this->properties->editIcon = $iconName;

return $this;
}

public function build(): object
{
return (object) ['type' => $this->type, 'properties' => $this->properties];
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Helpers/LayoutInputDropdownHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
protected bool $required = false,
) {
if ($internal === null) {
$internal = $model->getTable() . '_id';
$internal = $model->getTable().'_id';
}

$this->dropdown = new LayoutInputDropdown($internal, $label);
Expand Down
4 changes: 2 additions & 2 deletions src/NotFound/Layout/Inputs/AbstractInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace NotFound\Layout\Inputs;

use NotFound\Layout\Elements\AbstractLayout;
use Illuminate\Support\Facades\Log;
use NotFound\Layout\Elements\AbstractLayout;

abstract class AbstractInput extends AbstractLayout
{
Expand Down Expand Up @@ -44,7 +44,7 @@ public function setPlaceholder(string $placeholder): self

public function setValue(mixed $value): self
{
if (!is_string($value)) {
if (! is_string($value)) {
$this->abortLogSetValueError('AbstractInput', 'string', $value);
}
$this->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Inputs/LayoutInputCheckbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LayoutInputCheckbox extends AbstractInput

public function setValue($value): self
{
if (!is_bool($value)) {
if (! is_bool($value)) {
$this->abortLogSetValueError('InputCheckbox', 'boolean', $value);
}
$this->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Inputs/LayoutInputDropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function setSearchable(): self

public function addItem($value, $readableValue = null): self
{
trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);

return $this->addOption($value, $readableValue);
}
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Inputs/LayoutInputFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LayoutInputFile extends AbstractInput

public function setValue($value): self
{
if (!is_object($value)) {
if (! is_object($value)) {
$this->abortLogSetValueError('LayoutInputImage', 'object', $value);
}
$this->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Inputs/LayoutInputImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LayoutInputImage extends AbstractInput

public function setValue($value): self
{
if (!is_object($value)) {
if (! is_object($value)) {
$this->abortLogSetValueError('LayoutInputImage', 'object', $value);
}
$this->value = $value;
Expand Down
4 changes: 2 additions & 2 deletions src/NotFound/Layout/Inputs/LayoutInputTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LayoutInputTags extends AbstractInput
*/
public function setValue(mixed $value): self
{
if (!is_array($value)) {
if (! is_array($value)) {
$this->abortLogSetValueError('InputTags', 'array', $value);
}
$this->value = $value;
Expand Down Expand Up @@ -50,7 +50,7 @@ public function addOption($value, $readableValue = null): self

public function addItem($value, $readableValue = null): self
{
trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
trigger_error('Method '.__METHOD__.' is deprecated', E_USER_DEPRECATED);

return $this->addOption($value, $readableValue);
}
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/LayoutResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace NotFound\Layout;

use Illuminate\Support\Collection;
use NotFound\Layout\Elements\AbstractLayout;
use NotFound\Layout\Responses\Action;
use Illuminate\Support\Collection;

class LayoutResponse
{
Expand Down
2 changes: 1 addition & 1 deletion src/NotFound/Layout/Validations/IsText.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IsText extends AbstractValidation
{
public function validate($newValue)
{
if ($newValue != null && !is_string($newValue)) {
if ($newValue != null && ! is_string($newValue)) {
abort(200, __('validation.string', ['attribute' => $this->input->internal]));
}

Expand Down

0 comments on commit 9279f2b

Please sign in to comment.