jqh 5 жил өмнө
parent
commit
3d81b72cb2

+ 22 - 0
resources/assets/dcat-admin/main.css

@@ -1419,6 +1419,11 @@ input.form-control {
     margin: 6px 12px;
     display: block;
 }
+
+.select2-container--default .select2-search--inline .select2-search__field {
+    padding-left: 5px!important;
+}
+
 .input-group-sm .select2-selection--multiple .default-text {
     margin: 6px;
 }
@@ -2311,6 +2316,23 @@ div.layui-layer-btn{
     display:inline!important;
 }
 
+.quick-create .select2-selection--single {
+    padding: 3px 12px !important;
+    height: 30px !important;
+    width: 150px !important;
+}
+
+.quick-create .select2-selection--multiple {
+    padding-left: 5px !important;
+    height: 30px !important;
+    width: 200px !important;
+    min-height: 30px !important;
+}
+
+.quick-form-field {
+    margin: 5px 0;
+}
+
 .grid-column-header a {
     color: #8aa5b9 !important;
     font-size: 13px;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
resources/assets/dcat-admin/main.min.css


+ 1 - 1
resources/views/grid/quick-create/tags.blade.php

@@ -1,5 +1,5 @@
 <div class="input-group input-group-sm quick-form-field">
-    <select class="form-control {{$class}}" style="width: 100%;" name="{{$name}}[]" multiple="multiple" data-placeholder="{{ $placeholder }}" {!! $attributes !!} >
+    <select class="form-control {{$class}}" style="width: 100%;" name="{{$name}}[]" multiple="multiple" data-placeholder="{{ $label }}" {!! $attributes !!} >
         @foreach($options as $key => $option)
             <option value="{{ $keyAsValue ? $key : $option}}" {{ in_array($option, $value) ? 'selected' : '' }}>{{$option}}</option>
         @endforeach

+ 2 - 3
src/Grid.php

@@ -146,7 +146,7 @@ class Grid
     /**
      * @var string
      */
-    protected $tableId;
+    protected $tableId = 'grid-table';
 
     /**
      * Options for grid.
@@ -196,7 +196,6 @@ class Grid
         $this->columns = new Collection();
         $this->rows = new Collection();
         $this->builder = $builder;
-        $this->tableId = 'grid-'.Str::random(8);
 
         $this->model()->setGrid($this);
 
@@ -812,7 +811,7 @@ HTML;
     protected function variables()
     {
         $this->variables['grid'] = $this;
-        $this->variables['tableId'] = $this->tableId;
+        $this->variables['tableId'] = $this->tableId();
 
         return $this->variables;
     }

+ 1 - 2
src/Grid/Concerns/HasElementNames.php

@@ -39,6 +39,7 @@ trait HasElementNames
     public function setName($name)
     {
         $this->__name = $name;
+        $this->tableId = $this->tableId.'-'.$name;
 
         $model = $this->model();
 
@@ -47,9 +48,7 @@ trait HasElementNames
             ->setSortName("{$name}_{$model->getSortName()}");
 
         $this->filter()->setName($name);
-
         $this->setExporterQueryName($name);
-
         $this->setQuickSearchQueryName($name);
 
         return $this;

+ 11 - 5
src/Grid/Displayers/AbstractDisplayer.php

@@ -5,6 +5,7 @@ namespace Dcat\Admin\Grid\Displayers;
 use Dcat\Admin\Admin;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\Column;
+use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Fluent;
 
@@ -53,13 +54,9 @@ abstract class AbstractDisplayer
         $this->value = $value;
         $this->grid = $grid;
         $this->column = $column;
-        $this->row = $row;
 
+        $this->setRow($row);
         $this->collectAssets();
-
-        if ($this->row instanceof Model) {
-            $this->row = new Fluent($this->row->toArray());
-        }
     }
 
     protected function collectAssets()
@@ -73,6 +70,15 @@ abstract class AbstractDisplayer
         }
     }
 
+    protected function setRow($row)
+    {
+        if ($row instanceof Arrayable) {
+            $row = $row->toArray();
+        }
+
+        $this->row = new Fluent($row);
+    }
+
     /**
      * @return string
      */

+ 0 - 34
src/Grid/Tools/QuickCreate.php

@@ -153,16 +153,6 @@ class QuickCreate implements Renderable
      */
     public function select($column, $placeholder = '')
     {
-        Admin::style(
-            <<<'CSS'
-.quick-create .select2-selection--single {
-    padding: 3px 12px !important;
-    height: 30px !important;
-    width: 150px !important;
-}
-CSS
-        );
-
         $field = new Select($column, $this->formatPlaceholder($placeholder));
 
         $this->addField($field);
@@ -178,17 +168,6 @@ CSS
      */
     public function tags($column, $placeholder = '')
     {
-        Admin::style(
-            <<<'CSS'
-.quick-create .select2-selection--multiple {
-    padding-left: 5px !important;
-    height: 30px !important;
-    width: 200px !important;
-    min-height: 30px !important;
-}
-CSS
-        );
-
         $field = new Field\Tags($column, $this->formatPlaceholder($placeholder));
 
         $this->addField($field);
@@ -204,17 +183,6 @@ CSS
      */
     public function multipleSelect($column, $placeholder = '')
     {
-        Admin::style(
-            <<<CSS
-.quick-create .select2-selection--multiple {
-    padding-left: 5px !important;
-    height: 30px !important;
-    width: 200px !important;
-    min-height: 30px !important;
-}
-CSS
-        );
-
         $field = new MultipleSelect($column, $this->formatPlaceholder($placeholder));
 
         $this->addField($field);
@@ -399,8 +367,6 @@ JS;
 
         $this->script();
 
-        Admin::style('.quick-form-field{margin: 5px 0}');
-
         $vars = [
             'columnCount'  => $columnCount,
             'fields'       => $this->fields,

+ 1 - 1
src/Models/Menu.php

@@ -89,7 +89,7 @@ class Menu extends Model
     protected function fetchAll(): array
     {
         $connection = config('admin.database.connection') ?: config('database.default');
-        $orderColumn = DB::connection($connection)->getQueryGrammar()->wrap($this->orderColumn);
+        $orderColumn = DB::connection($connection)->getQueryGrammar()->wrap($this->getOrderColumn());
 
         $byOrder = 'ROOT ASC, '.$orderColumn;
 

+ 0 - 10
src/Repositories/Proxy.php

@@ -144,14 +144,4 @@ class Proxy implements \Dcat\Admin\Contracts\Repository
     {
         return $this->repository->$method(...$arguments);
     }
-
-    public function __get($name)
-    {
-        return $this->repository->$name;
-    }
-
-    public function __set($name, $value)
-    {
-        $this->repository->$name = $value;
-    }
 }

+ 1 - 35
src/Repositories/Repository.php

@@ -10,14 +10,7 @@ use Illuminate\Support\Traits\Macroable;
 
 abstract class Repository implements \Dcat\Admin\Contracts\Repository
 {
-    use Macroable {
-        __call as __macroCall;
-    }
-
-    /**
-     * @var array
-     */
-    protected $attributes = [];
+    use Macroable;
 
     /**
      * @var string
@@ -260,31 +253,4 @@ abstract class Repository implements \Dcat\Admin\Contracts\Repository
 
         return array_merge($resolves[$repository], $any);
     }
-
-    /**
-     * @param string $method
-     * @param array  $arguments
-     *
-     * @return $this
-     */
-    public function __call($method, $arguments)
-    {
-        if (static::hasMacro($method)) {
-            return static::__macroCall($method, $arguments);
-        }
-
-        $this->attributes[$method] = $arguments;
-
-        return $this;
-    }
-
-    public function __get($name)
-    {
-        return $this->attributes[$name] ?? null;
-    }
-
-    public function __set($name, $value)
-    {
-        $this->attributes[$name] = $value;
-    }
 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно