Skip to content

Commit

Permalink
Merge branch 'master' into prepare-phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Oct 20, 2023
2 parents 277d790 + 09f01c5 commit 4070bdb
Show file tree
Hide file tree
Showing 32 changed files with 271 additions and 405 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"dependencies": {
"@alpinejs/focus": "^3.12.3",
"@conedevelopment/qkie": "^1.0.2",
"@tiptap/extension-highlight": "^2.0.3",
"@tiptap/extension-history": "^2.0.3",
"@tiptap/extension-image": "^2.0.3",
Expand Down
1 change: 0 additions & 1 deletion public/build/assets/app-1374d9a4.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/app-4d04387c.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/build/assets/app-584e3628.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import{a as f}from"./app-ef45e7b6.js";export{f as default};
111 changes: 0 additions & 111 deletions public/build/assets/app-99dd4812.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/assets/app-e4ef55d2.css

This file was deleted.

117 changes: 117 additions & 0 deletions public/build/assets/app-ef45e7b6.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/assets/dropdown-1a36afbb.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/dropdown-b8b60ec8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import"./app-ef45e7b6.js";
1 change: 0 additions & 1 deletion public/build/assets/editor-1a36afbb.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/editor-b8b60ec8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import"./app-ef45e7b6.js";
1 change: 0 additions & 1 deletion public/build/assets/media-manager-1a36afbb.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/media-manager-b8b60ec8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import"./app-ef45e7b6.js";
1 change: 0 additions & 1 deletion public/build/assets/repeater-1a36afbb.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/repeater-b8b60ec8.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import"./app-ef45e7b6.js";
16 changes: 8 additions & 8 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{
"resources/js/app.css": {
"file": "assets/app-e4ef55d2.css",
"file": "assets/app-4d04387c.css",
"src": "resources/js/app.css"
},
"resources/js/app.js": {
"css": [
"assets/app-e4ef55d2.css"
"assets/app-4d04387c.css"
],
"file": "assets/app-99dd4812.js",
"file": "assets/app-ef45e7b6.js",
"isEntry": true,
"src": "resources/js/app.js"
},
"resources/js/dropdown.js": {
"file": "assets/dropdown-1a36afbb.js",
"file": "assets/dropdown-b8b60ec8.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/dropdown.js"
},
"resources/js/editor.js": {
"file": "assets/editor-1a36afbb.js",
"file": "assets/editor-b8b60ec8.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/editor.js"
},
"resources/js/media-manager.js": {
"file": "assets/media-manager-1a36afbb.js",
"file": "assets/media-manager-b8b60ec8.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/media-manager.js"
},
"resources/js/repeater.js": {
"file": "assets/repeater-1a36afbb.js",
"file": "assets/repeater-b8b60ec8.js",
"imports": [
"resources/js/app.js"
],
"isEntry": true,
"src": "resources/js/repeater.js"
},
"resources/sass/app.scss": {
"file": "assets/app-1374d9a4.js",
"file": "assets/app-584e3628.js",
"imports": [
"resources/js/app.js"
],
Expand Down
61 changes: 0 additions & 61 deletions resources/js/Cookie.js

This file was deleted.

2 changes: 1 addition & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Alpine from 'alpinejs';
import Axios from 'axios';
import focus from '@alpinejs/focus';
import Cookie from './Cookie';
import Cookie from '@conedevelopment/qkie';
import './notifications';
import './theme';

Expand Down
33 changes: 3 additions & 30 deletions src/Actions/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,16 @@
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Traits\ForwardsCalls;

/**
* @mixin \Illuminate\Support\Collection
*/
class Actions
class Actions extends Collection
{
use ForwardsCalls;

/**
* The actions collection.
*/
protected Collection $actions;

/**
* Create a new actions instance.
*/
public function __construct(array $actions = [])
{
$this->actions = new Collection($actions);
}

/**
* Register the given actions.
*/
public function register(array|Action $actions): static
{
foreach (Arr::wrap($actions) as $action) {
$this->actions->push($action);
$this->push($action);
}

return $this;
Expand All @@ -44,14 +25,6 @@ public function register(array|Action $actions): static
*/
public function mapToTableComponents(Request $request): array
{
return $this->actions->map->toTableComponent($request)->all();
}

/**
* Handle the dynamic method call.
*/
public function __call($method, $parameters): mixed
{
return $this->forwardCallTo($this->actions, $method, $parameters);
return $this->map->toTableComponent($request)->all();
}
}
39 changes: 6 additions & 33 deletions src/Columns/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,16 @@
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Traits\ForwardsCalls;

/**
* @mixin \Illuminate\Support\Collection
*/
class Columns
class Columns extends Collection
{
use ForwardsCalls;

/**
* The columns collection.
*/
protected Collection $columns;

/**
* Create a new table instance.
*/
public function __construct(array $columns = [])
{
$this->columns = new Collection($columns);
}

/**
* Register the given columns.
*/
public function register(array|Column $columns): static
{
foreach (Arr::wrap($columns) as $column) {
$this->columns->push($column);
$this->push($column);
}

return $this;
Expand All @@ -45,38 +26,30 @@ public function register(array|Column $columns): static
*/
public function searchable(): Collection
{
return $this->columns->filter->isSearchable();
return $this->filter->isSearchable();
}

/**
* Filter the sortable columns.
*/
public function sortable(): Collection
{
return $this->columns->filter->isSortable();
return $this->filter->isSortable();
}

/**
* Map the columns to cells for the given model.
*/
public function mapToHeads(Request $request): array
{
return $this->columns->map->toHead($request)->all();
return $this->map->toHead($request)->all();
}

/**
* Map the columns to cells for the given model.
*/
public function mapToCells(Request $request, Model $model): array
{
return $this->columns->map->toCell($request, $model)->all();
}

/**
* Handle the dynamic method call.
*/
public function __call($method, $parameters): mixed
{
return $this->forwardCallTo($this->columns, $method, $parameters);
return $this->map->toCell($request, $model)->all();
}
}
8 changes: 8 additions & 0 deletions src/Columns/Relation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Cone\Root\Columns;

class Relation extends Column
{
//
}
15 changes: 12 additions & 3 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ abstract class Field implements Arrayable, JsonSerializable
*/
protected ?string $apiUri = null;

/**
* Indicates if the field has been hydrated.
*/
protected bool $hydrated = false;

/**
* Create a new field instance.
*/
Expand Down Expand Up @@ -274,9 +279,11 @@ public function suffix(string $value): static
*/
public function resolveValue(Request $request, Model $model): mixed
{
$value = $this->withOldValue && $request->session()->hasOldInput($this->getRequestKey())
? $this->getOldValue($request)
: $this->getValue($model);
if (! $this->hydrated && $this->withOldValue && $request->session()->hasOldInput($this->getRequestKey())) {
$this->resolveHydrate($request, $model, $this->getOldValue($request));
}

$value = $this->getValue($model);

if (is_null($this->valueResolver)) {
return $value;
Expand Down Expand Up @@ -351,6 +358,8 @@ public function resolveHydrate(Request $request, Model $model, mixed $value): vo
}

call_user_func_array($this->hydrateResolver, [$request, $model, $value]);

$this->hydrated = true;
}

/**
Expand Down
Loading

0 comments on commit 4070bdb

Please sign in to comment.