Browse Source

增加“QuickSearch::width”方法

jqh 5 years ago
parent
commit
95b87b8111

+ 1 - 1
resources/assets/dcat-admin/main.css

@@ -2126,7 +2126,7 @@ div.layui-layer-btn{
 }
 
 .material .box-header,.material .card-header {
-    padding: 11px;
+    padding: 12px;
 }
 .material .box-header .btn, .material .card-header .btn {
     /*text-transform: uppercase;*/

File diff suppressed because it is too large
+ 0 - 0
resources/assets/dcat-admin/main.min.css


+ 2 - 2
resources/views/grid/quick-search.blade.php

@@ -1,5 +1,5 @@
 <form action="{!! $action !!}" class="input-no-border" pjax-container style="display:inline-block;margin:0 5px 13px 0;">
-    <div class="input-group quick-search" style="width:24.75rem;">
+    <div class="input-group quick-search" style="width:{{$width}}rem;">
 
         <input type="text"
                placeholder="{{ $placeholder }}"
@@ -8,7 +8,7 @@
                style="margin-left:-1px;padding:0 1.5rem 0 3.48rem;height:36px;line-height:36px;"
                value="{{ $value }}"
         >
-        <a onclick="$(this).submit()" style="overflow:hidden;position:absolute;top:8px;margin-left:-23.85rem;cursor:pointer;z-index:100">
+        <a onclick="$(this).submit()" style="overflow:hidden;position:absolute;top:8px;margin-left:-{{$width - 0.9}}rem;cursor:pointer;z-index:100">
             <svg xmlns="http://www.w3.org/2000/svg"
                  width="20"
                  height="20"

+ 17 - 0
src/Grid/Tools/QuickSearch.php

@@ -22,6 +22,11 @@ class QuickSearch extends AbstractTool
      */
     protected $queryName = '__search__';
 
+    /**
+     * @var int rem
+     */
+    protected $width = 24.25;
+
     /**
      * @param string|null $name
      * @return $this
@@ -41,6 +46,17 @@ class QuickSearch extends AbstractTool
         return $this->queryName;
     }
 
+    /**
+     * @param int $width
+     * @return $this
+     */
+    public function width(int $width)
+    {
+        $this->width = $width;
+
+        return $this;
+    }
+
     /**
      * Set placeholder.
      *
@@ -76,6 +92,7 @@ class QuickSearch extends AbstractTool
             'key' => $this->queryName,
             'value' => request($this->queryName),
             'placeholder' => $this->placeholder ?: trans('admin.search'),
+            'width' => $this->width,
         ];
 
         return view($this->view, $vars);

Some files were not shown because too many files changed in this diff