jqh 5 年之前
父節點
當前提交
9193b36d19

+ 3 - 2
resources/assets/dcat/sass/theme/_colors.scss

@@ -90,8 +90,9 @@ $font-color: #414750;
 
 // body背景颜色
 //$body-bg: #f9fafc;
-//$body-bg: lighten($dark40, 1.2%);
-$body-bg: darken(#f4f7fa, 1.2%);
+$body-bg: lighten($dark40, 1.3%);
+//$body-bg: darken(#f4f7fa, 1.2%);
+//$body-bg: #edf1f3;
 
 // 灰背景色
 $gray-bg: #f1f1f1;

+ 1 - 1
resources/assets/dcat/sass/variables/_variables.scss

@@ -28,4 +28,4 @@ $btn-group-btn-shadow: 0 2px 0 0 rgba(0,0,0,.08);
 // 菜单阴影
 $menu-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.05);
 
-$card-border-radius: .4rem;
+$card-border-radius: .25rem;

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

@@ -1,6 +1,6 @@
 <thead>
 <tr class="{{ $elementClass }} quick-create" style="cursor: pointer">
-    <td colspan="{{ $columnCount }}" style="background: #ededed">
+    <td colspan="{{ $columnCount }}" style="background: {{ Admin::color()->darken('#ededed', 4) }}">
         <span class="create cursor-pointer" style="display: block;">
              <i class="feather icon-plus"></i>&nbsp;{{ __('admin.quick_create') }}
         </span>

+ 0 - 28
src/Grid/Displayers/Expand.php

@@ -21,34 +21,6 @@ class Expand extends AbstractDisplayer
         $this->button = $button;
     }
 
-    protected function generateElementId()
-    {
-        $key = Str::random(8);
-
-        return 'grid-modal-'.$this->grid->getName().$key;
-    }
-
-    protected function addRenderableScript(string $modalId, string $url)
-    {
-        $script = <<<JS
-(function () {
-    var modal = $('#{$modalId}');
-    
-    modal.on('show.bs.modal', function (e) {
-        modal.find('.modal-body').html('<div style="min-height:150px"></div>');
-    
-        modal.find('.modal-body').loading();
-        
-        $.ajax('{$url}').then(function (data) {
-            modal.find('.modal-body').html(data);
-        });
-    })
-})();
-JS;
-
-        Admin::script($script);
-    }
-
     protected function setUpRemoteRenderable(RemoteRenderable $renderable)
     {
         $renderable::collectAssets();

+ 9 - 9
src/Support/RemoteRenderable.php

@@ -11,19 +11,19 @@ abstract class RemoteRenderable implements Renderable
 
     protected static $css = [];
 
-    protected $variables = [];
+    protected $parameters = [];
 
-    public function __construct($key = null)
+    public function __construct(array $parameters = null)
     {
-        $this->with($key);
+        $this->with($parameters);
     }
 
     public function with($key, $value = null)
     {
         if (is_array($key)) {
-            $this->variables = array_merge($this->variables, $key);
+            $this->parameters = array_merge($this->parameters, $key);
         } elseif ($key !== null) {
-            $this->variables[$key] = $value;
+            $this->parameters[$key] = $value;
         }
 
         return $this;
@@ -31,16 +31,16 @@ abstract class RemoteRenderable implements Renderable
 
     public function getUrl()
     {
-        $data = array_merge($this->variables(), [
+        $data = array_merge($this->parameters(), [
             'renderable' => str_replace('\\', '_', static::class),
         ]);
 
         return route(admin_api_route('render'), $data);
     }
 
-    public function variables()
+    public function parameters()
     {
-        return $this->variables;
+        return $this->parameters;
     }
 
     public static function collectAssets()
@@ -61,6 +61,6 @@ abstract class RemoteRenderable implements Renderable
 
     public function __get($name)
     {
-        return $this->variables[$name] ?? null;
+        return $this->parameters[$name] ?? null;
     }
 }

+ 8 - 2
src/Traits/InteractsWithApi.php

@@ -45,13 +45,18 @@ trait InteractsWithApi
     ];
 
     /**
-     * 获取请求附带参数.
+     * @var array
+     */
+    protected $parameters = [];
+
+    /**
+     * 返回请求附带参数.
      *
      * @return array
      */
     public function parameters(): array
     {
-        return [];
+        return $this->parameters;
     }
 
     /**
@@ -270,6 +275,7 @@ JS;
         $this->method = $self->getRequestMethod();
         $this->uriKey = $self->getUriKey();
         $this->requestSelectors = $self->getRequestSelectors();
+        $this->parameters = array_merge($this->parameters, $self->parameters());
 
         $scripts = $self->getRequestScripts();