jqh 4 年之前
父節點
當前提交
2268e7d662

+ 6 - 5
resources/assets/adminlte/scss/_main-sidebar.scss

@@ -365,8 +365,8 @@
 
 [class*='sidebar-dark-'] {
   // Sidebar background color
-  background-color: $sidebar-dark-bg;
-  //background-image: linear-gradient(0deg,#7e8ea1,#3c4655);
+  //background-color: $sidebar-dark-bg;
+  background-image: linear-gradient(0deg, #7b8b9f, $sidebar-dark-bg);
 
   //.nav .nav-item .nav-link {
   //
@@ -423,7 +423,7 @@
       // border-left: 3px solid transparent;
       &:active {
         color: $sidebar-dark-active-color;
-        background: $sidebar-dark-active-bg;
+        //background: $sidebar-dark-active-bg;
         font-weight: bold;
       }
       &:hover {
@@ -432,6 +432,7 @@
     }
     i {
       margin-right: .75rem;
+      color: $sidebar-dark-icon-color;
     }
 
     // Hover and active states
@@ -439,7 +440,7 @@
     &:hover > .nav-link,
     & > .nav-link:focus  {
       background-color: $sidebar-dark-hover-bg;
-      //color: $sidebar-dark-hover-color;
+      color: $sidebar-dark-hover-color;
     }
 
     > .nav-link.active {
@@ -454,7 +455,7 @@
 
     // First Level Submenu
     > .nav-treeview {
-      background: $sidebar-dark-submenu-bg;
+      //background: $sidebar-dark-submenu-bg;
     }
   }
 

+ 9 - 7
resources/assets/adminlte/scss/_variables.scss

@@ -124,27 +124,29 @@ $main-footer-bg: transparent !default;
 //$sidebar-dark-submenu-active-bg: $sidebar-dark-active-bg !default;
 //$sidebar-dark-header-color: hsla(0,0%,100%,.7) !default;
 
-// #262d37 #313a46 lighten(#8391a2, 8%)
-$sidebar-dark-bg: #3c4655!default;
+// #262d37 #313a46 lighten(#8391a2, 8%) #242939
+// icon lighten(#4B5575, 3%)   #989EB3
+$sidebar-dark-bg: #3a4452!default;
 $sidebar-dark-hover-bg: transparent !default;
-$sidebar-dark-color: darken(#ddd, 2%)!default;
+$sidebar-dark-color: hsla(0,0%,100%,.85)!default;
+$sidebar-dark-icon-color: hsla(0,0%,100%,.7)!default;
 $sidebar-dark-hover-color: lighten($sidebar-dark-color, 10%) !default;
-$sidebar-dark-active-bg: $sidebar-dark-bg !default;
+$sidebar-dark-active-bg: transparent !default;
 $sidebar-dark-active-color: $white !default;
-$sidebar-dark-submenu-bg: $sidebar-dark-bg !default;
+$sidebar-dark-submenu-bg: transparent !default;
 //$sidebar-dark-submenu-color: lighten(#C2C7D0, 6%) !default;
 $sidebar-dark-submenu-color: $sidebar-dark-color!default;
 $sidebar-dark-submenu-hover-color: $white !default;
 $sidebar-dark-submenu-hover-bg: $sidebar-dark-hover-bg !default;
 $sidebar-dark-submenu-active-color: $white !default;
-$sidebar-dark-submenu-active-bg: $sidebar-dark-bg !default;
+$sidebar-dark-submenu-active-bg: transparent !default;
 $sidebar-dark-header-color: hsla(0,0%,100%,.8) !default;
 // #505b6b #49525f
 
 // Light sidebar
 $sidebar-light-bg: $white !default;
 $sidebar-light-hover-bg: transparent !default;
-$sidebar-light-color: $pure-black !default;
+$sidebar-light-color: lighten($font-color, 5%) !default;
 $sidebar-light-hover-color: $gray-900 !default;
 $sidebar-light-active-color: $white !default;
 $sidebar-light-submenu-bg: transparent !default;

+ 34 - 59
resources/assets/dcat/sass/components/_custom-data-table.scss

@@ -57,7 +57,7 @@ $table-border-radius: .3rem;
   padding: 1.25rem 2.8rem !important;
   border-radius: 5rem;
   border: 0;
-  background: #f0f0f0;
+  background: #eef1f4;
   font-size: .82rem;
 }
 
@@ -169,12 +169,12 @@ $table-border-radius: .3rem;
   font-size: 2.857rem
 }
 
-table.custom-data-table.dataTable, table.data-thumb-view.dataTable {
+table.custom-data-table.dataTable {
   border-spacing: 0 .8rem;
   padding: 0;
 }
 
-table.custom-data-table.dataTable thead th, table.data-thumb-view.dataTable thead th {
+table.custom-data-table.dataTable thead th {
   //padding: .714rem 1.785rem;
   padding: 0.714rem .51rem;
   font-weight: 600;
@@ -182,37 +182,21 @@ table.custom-data-table.dataTable thead th, table.data-thumb-view.dataTable thea
   border-top: 0;
 }
 
-table.custom-data-table.dataTable thead th input:focus, table.data-thumb-view.dataTable thead th input:focus {
+table.custom-data-table.dataTable thead th input:focus {
   outline: 0
 }
 
-table.custom-data-table.dataTable thead th:first-child, table.data-thumb-view.dataTable thead th:first-child {
+table.custom-data-table.dataTable thead th:first-child {
   //padding-left: 0;
   padding-left: .9rem;
 }
 
-table.custom-data-table.dataTable thead .sorting, table.custom-data-table.dataTable thead .sorting_asc, table.custom-data-table.dataTable thead .sorting_desc, table.data-thumb-view.dataTable thead .sorting, table.data-thumb-view.dataTable thead .sorting_asc, table.data-thumb-view.dataTable thead .sorting_desc {
-  padding-right: inherit
-}
-
-table.custom-data-table.dataTable thead .sorting:before, table.custom-data-table.dataTable thead .sorting_asc:before, table.custom-data-table.dataTable thead .sorting_desc:before, table.data-thumb-view.dataTable thead .sorting:before, table.data-thumb-view.dataTable thead .sorting_asc:before, table.data-thumb-view.dataTable thead .sorting_desc:before {
-  font-size: .7rem;
-  left: .857rem;
-  top: .642rem
-}
-
-table.custom-data-table.dataTable thead .sorting:after, table.custom-data-table.dataTable thead .sorting_asc:after, table.custom-data-table.dataTable thead .sorting_desc:after, table.data-thumb-view.dataTable thead .sorting:after, table.data-thumb-view.dataTable thead .sorting_asc:after, table.data-thumb-view.dataTable thead .sorting_desc:after {
-  font-size: .7rem;
-  left: .857rem;
-  top: 1.071rem
-}
-
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input {
   width: 0;
   position: relative
 }
 
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:before, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input:before {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:before {
   border: 2px solid #b4b4b4;
   content: "";
   width: 1.071rem;
@@ -225,7 +209,7 @@ table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:before,
   position: absolute
 }
 
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:after, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input:after {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:after {
   background-color: $primary;
   border: 2px solid $primary;
   font-family: feather;
@@ -243,22 +227,22 @@ table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:after, t
   overflow: hidden
 }
 
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:active:checked:after, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input:active:checked:after {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:active:checked:after {
   transform: translate(3px)
 }
 
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:checked:before, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input:checked:before {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:checked:before {
   border: 2px solid $primary;
   transform: rotate(0deg)
 }
 
-table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:checked:after, table.data-thumb-view.dataTable thead .dt-checkboxes-select-all input:checked:after {
+table.custom-data-table.dataTable thead .dt-checkboxes-select-all input:checked:after {
   transition: all .2s ease;
   opacity: 1;
   transform: translate(0)
 }
 
-table.custom-data-table.dataTable tbody tr, table.data-thumb-view.dataTable tbody tr {
+table.custom-data-table.dataTable tbody tr {
   background-color: #fff;
   //box-shadow: 0 4px 20px 0 rgba(0, 0, 0, .05);
   box-shadow: $shadow;
@@ -267,29 +251,29 @@ table.custom-data-table.dataTable tbody tr, table.data-thumb-view.dataTable tbod
   border-radius:$table-border-radius
 }
 
-table.custom-data-table.dataTable tbody tr:hover, table.data-thumb-view.dataTable tbody tr:hover {
+table.custom-data-table.dataTable tbody tr:hover {
   //transform: translateY(-4px);
   //transition: all .3s ease;
   //transform: none;
   background: lighten($dark30, 1%);
 }
 
-table.custom-data-table.dataTable tbody tr td:first-child, table.data-thumb-view.dataTable tbody tr td:first-child {
+table.custom-data-table.dataTable tbody tr td:first-child {
   padding-left: 1rem;
   border-top-left-radius: $table-border-radius;
   border-bottom-left-radius: $table-border-radius
 }
 
-table.custom-data-table.dataTable tbody tr td:last-child, table.data-thumb-view.dataTable tbody tr td:last-child {
+table.custom-data-table.dataTable tbody tr td:last-child {
   border-top-right-radius:$table-border-radius;
   border-bottom-right-radius:$table-border-radius
 }
 
-table.custom-data-table.dataTable tbody tr.selected td, table.data-thumb-view.dataTable tbody tr.selected td {
+table.custom-data-table.dataTable tbody tr.selected td {
   border-radius: 0
 }
 
-table.custom-data-table.dataTable tbody td, table.data-thumb-view.dataTable tbody td {
+table.custom-data-table.dataTable tbody td {
   //padding: 1.357rem;
   border: none;
   vertical-align: middle;
@@ -298,24 +282,24 @@ table.custom-data-table.dataTable tbody td, table.data-thumb-view.dataTable tbod
   line-height: 1.42857;
 }
 
-table.custom-data-table.dataTable tbody td input:focus, table.data-thumb-view.dataTable tbody td input:focus {
+table.custom-data-table.dataTable tbody td input:focus {
   outline: 0
 }
 
-table.custom-data-table.dataTable tbody td.product-name, table.data-thumb-view.dataTable tbody td.product-name {
+table.custom-data-table.dataTable tbody td.product-name {
   font-weight: 500
 }
 
-table.custom-data-table.dataTable tbody td:focus, table.data-thumb-view.dataTable tbody td:focus {
+table.custom-data-table.dataTable tbody td:focus {
   outline: 0
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input {
   width: 0;
   position: relative
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:before, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input:before {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:before {
   border: 2px solid #b4b4b4;
   position: absolute;
   left: -8px;
@@ -329,7 +313,7 @@ table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:before, tabl
   transition: all .2s ease
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:after, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input:after {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:after {
   background-color: $primary;
   font-family: feather;
   content: "\E83F";
@@ -346,36 +330,27 @@ table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:after, table
   transition: all .2s ease
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:active:checked:after, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input:active:checked:after {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:active:checked:after {
   transform: translate(3px)
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:checked:before, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input:checked:before {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:checked:before {
   transform: rotate(0deg);
   border: 2px solid $primary;
   transition: all .2s ease
 }
 
-table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:checked:after, table.data-thumb-view.dataTable tbody td.dt-checkboxes-cell input:checked:after {
+table.custom-data-table.dataTable tbody td.dt-checkboxes-cell input:checked:after {
   opacity: 1;
   transition: all .2s ease;
   transform: rotate(0deg) translate(0)
 }
 
-table.custom-data-table.dataTable tbody td .progress, table.data-thumb-view.dataTable tbody td .progress {
+table.custom-data-table.dataTable tbody td .progress {
   margin-bottom: 0;
   box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .12), 0 2px 4px 0 rgba(0, 0, 0, .08)
 }
 
-table.data-thumb-view.dataTable tbody tr td {
-  padding-top: .714rem;
-  padding-bottom: .714rem
-}
-
-table.data-thumb-view.dataTable tbody tr td.product-img img {
-  height: 7.857rem
-}
-
 
 @media (max-width: 576px) {
   .add-new-data-sidebar .data-items .data-list-upload .dropzone .dz-message:before {
@@ -383,39 +358,39 @@ table.data-thumb-view.dataTable tbody tr td.product-img img {
   }
 }
 
-.custom-data-table.dataTable tbody tr td.dt-checkboxes-cell input, .custom-data-table.dataTable tbody tr th.dt-checkboxes-cell input, .custom-data-table.dataTable thead tr td.dt-checkboxes-cell input, .custom-data-table.dataTable thead tr th.dt-checkboxes-cell input, .data-thumb-view.dataTable tbody tr td.dt-checkboxes-cell input, .data-thumb-view.dataTable tbody tr th.dt-checkboxes-cell input, .data-thumb-view.dataTable thead tr td.dt-checkboxes-cell input, .data-thumb-view.dataTable thead tr th.dt-checkboxes-cell input, _:-ms-lang(x) tbody tr td.dt-checkboxes-cell input, _:-ms-lang(x) tbody tr th.dt-checkboxes-cell input, _:-ms-lang(x) thead tr td.dt-checkboxes-cell input, _:-ms-lang(x) thead tr th.dt-checkboxes-cell input {
+.custom-data-table.dataTable tbody tr td.dt-checkboxes-cell input, .custom-data-table.dataTable tbody tr th.dt-checkboxes-cell input, .custom-data-table.dataTable thead tr td.dt-checkboxes-cell input, .custom-data-table.dataTable thead tr th.dt-checkboxes-cell input, _:-ms-lang(x) tbody tr td.dt-checkboxes-cell input, _:-ms-lang(x) tbody tr th.dt-checkboxes-cell input, _:-ms-lang(x) thead tr td.dt-checkboxes-cell input, _:-ms-lang(x) thead tr th.dt-checkboxes-cell input {
   width: auto
 }
 
-.custom-data-table.dataTable .table-responsive .top .table-filter .form-control, .data-thumb-view.dataTable .table-responsive .top .table-filter .form-control, _:-ms-lang(x) .table-responsive .top .table-filter .form-control {
+.custom-data-table.dataTable .table-responsive .top .table-filter .form-control _:-ms-lang(x) .table-responsive .top .table-filter .form-control {
   height: 1.4rem !important;
   padding: 0 .5rem !important
 }
 
-.custom-data-table.dataTable .table-responsive .top .table-filter .form-control:after, .data-thumb-view.dataTable .table-responsive .top .table-filter .form-control:after, _:-ms-lang(x) .table-responsive .top .table-filter .form-control:after {
+.custom-data-table.dataTable .table-responsive .top .table-filter .form-control:after _:-ms-lang(x) .table-responsive .top .table-filter .form-control:after {
   display: none
 }
 
 
 @supports (-moz-osx-font-smoothing:auto) {
-  .custom-data-table input, .data-thumb-view input {
+  .custom-data-table input {
     width: auto !important
   }
 }
 
 @media not all and (min-resolution: 0.001dpcm) {
   @supports (-webkit-appearance:none) {
-    table.custom-data-table tbody td.dt-checkboxes-cell input:after, table.data-thumb-view tbody td.dt-checkboxes-cell input:after {
+    table.custom-data-table tbody td.dt-checkboxes-cell input:after {
       left: -.485rem
     }
-    .custom-data-table .dt-checkboxes-cell input, .data-thumb-view .dt-checkboxes-cell input {
+    .custom-data-table .dt-checkboxes-cell input {
       -webkit-appearance: none;
       top: -10px
     }
   }
 }
 
-.custom-data-table .mac-checkbox, .data-thumb-view .mac-checkbox {
+.custom-data-table .mac-checkbox {
   -webkit-appearance: none;
   top: -10px
 }

+ 2 - 1
resources/assets/dcat/sass/components/_menu.scss

@@ -22,7 +22,7 @@
     .logo-lg {
       color: darken($primary-darker, 1%);
       letter-spacing: 0.01rem;
-      font-size: 1.55rem;
+      font-size: 1.45rem;
       -webkit-animation: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1 fadein;
       animation: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) 0s normal forwards 1 fadein;
     }
@@ -90,6 +90,7 @@ body.sidebar-collapse {
     height: 61px;
     //background: $body-darker-color;
     background: #262d37
+    //background: #313a46;
   }
 
   .navbar-header .navbar-brand {

+ 1 - 0
resources/assets/dcat/sass/theme/_dark.scss

@@ -848,6 +848,7 @@ body.dark-mode {
 
   // ------- sidebar
   [class*=sidebar-dark-] {
+    background-image: none;
     background-color: $body-dark-color!important;
 
     .navbar-header {

+ 2 - 2
resources/assets/dcat/sass/theme/_primary.scss

@@ -1,7 +1,7 @@
 // 设置主题颜色
 
-$primary: $indigo;
+//$primary: $indigo;
 //$primary: #4e9876; // green
 //$primary: #5686d4; // blue
 //$primary: #62a8ea; //blue-light
-//$primary: #586cb1;
+$primary: #586cb1;

+ 6 - 13
src/Color.php

@@ -68,14 +68,7 @@ class Color
      *
      * @var array
      */
-    protected static $colors = [
-        'indigo' => [
-            'colors' => [
-                'primary'        => 'indigo',
-                'primary-darker' => 'indigo-darker',
-                'link'           => 'indigo-darker',
-            ],
-        ],
+    protected static $extensions = [
         'blue-light' => [
             'colors' => [
                 'primary'        => '#62a8ea',
@@ -83,7 +76,7 @@ class Color
                 'link'           => '#62a8ea',
             ],
         ],
-        'blue-dark' => [
+        'indigo' => [
             'colors' => [
                 'primary'        => '#586cb1',
                 'primary-darker' => '#4c60a3',
@@ -111,7 +104,7 @@ class Color
      *
      * @var array
      */
-    protected static $default = [
+    protected static $colors = [
         'info'    => 'blue',
         'success' => 'green',
         'danger'  => 'red',
@@ -209,8 +202,8 @@ class Color
         $this->name = ($name ?: config('admin.layout.color')) ?: static::DEFAULT_COLOR;
 
         $this->currentColors = array_merge(
-            static::$default,
-            static::$colors[$this->name]['colors'] ?? []
+            static::$colors,
+            static::$extensions[$this->name]['colors'] ?? []
         );
     }
 
@@ -328,7 +321,7 @@ class Color
      */
     public static function extend(string $name, array $colors)
     {
-        static::$colors[$name] = [
+        static::$extensions[$name] = [
             'colors' => $colors,
         ];
     }

+ 1 - 1
src/Extend/Manager.php

@@ -165,7 +165,7 @@ class Manager
         $it->rewind();
 
         while ($it->valid()) {
-            if ($it->getDepth() > 1 && $it->isFile() && $it->getFilename() === 'composer.json') {
+            if ($it->getDepth() > 1 && $it->getFilename() === 'composer.json') {
                 $extensions[] = dirname($it->getPathname());
             }
 

+ 22 - 0
src/Extend/ServiceProvider.php

@@ -26,6 +26,16 @@ abstract class ServiceProvider extends LaravelServiceProvider
      */
     protected $path;
 
+    /**
+     * @var array
+     */
+    protected $js = [];
+
+    /**
+     * @var array
+     */
+    protected $css = [];
+
     /**
      * @var array
      */
@@ -86,6 +96,8 @@ abstract class ServiceProvider extends LaravelServiceProvider
         if ($routes = $this->routes()) {
             return $this->registerRoutes($routes);
         }
+
+        $this->registerAssets();
     }
 
     /**
@@ -322,6 +334,16 @@ abstract class ServiceProvider extends LaravelServiceProvider
         }
     }
 
+    /**
+     * 注册别名.
+     */
+    protected function registerAssets()
+    {
+        if ($this->js || $this->css) {
+            Admin::asset()->alias($this->name(), $this->js, $this->css);
+        }
+    }
+
     /**
      * 验证菜单.
      *

+ 0 - 385
src/Extension.php

@@ -1,385 +0,0 @@
-<?php
-
-namespace Dcat\Admin;
-
-use Illuminate\Console\Command;
-use Illuminate\Support\Arr;
-use Illuminate\Support\Facades\Validator;
-
-abstract class Extension
-{
-    const NAME = null;
-
-    /**
-     * @var string
-     */
-    protected $serviceProvider;
-
-    /**
-     * @var string
-     */
-    protected $assets = '';
-
-    /**
-     * @var string
-     */
-    protected $views = '';
-
-    /**
-     * @var string
-     */
-    protected $lang = '';
-
-    /**
-     * @var string
-     */
-    protected $migrations = '';
-
-    /**
-     * @var string
-     */
-    protected $composer = '';
-
-    /**
-     * @var array
-     */
-    protected $menu = [];
-
-    /**
-     * @var array
-     */
-    protected $permission = [];
-
-    /**
-     * The menu validation rules.
-     *
-     * @var array
-     */
-    protected $menuValidationRules = [
-        'title' => 'required',
-        'path'  => 'required',
-        'icon'  => 'required',
-    ];
-
-    /**
-     * The permission validation rules.
-     *
-     * @var array
-     */
-    protected $permissionValidationRules = [
-        'name'  => 'required',
-        'slug'  => 'required',
-        'path'  => 'required',
-    ];
-
-    /**
-     * @return string
-     */
-    final public function getName()
-    {
-        return static::NAME;
-    }
-
-    /**
-     * @return string
-     */
-    public function composer()
-    {
-        return $this->composer;
-    }
-
-    /**
-     * @return string
-     */
-    public function serviceProvider()
-    {
-        return $this->serviceProvider;
-    }
-
-    /**
-     * Get the path of assets files.
-     *
-     * @return string
-     */
-    public function assets()
-    {
-        return $this->assets;
-    }
-
-    /**
-     * Get the path of view files.
-     *
-     * @return string
-     */
-    public function views()
-    {
-        return $this->views;
-    }
-
-    /**
-     * Get the path of migration files.
-     *
-     * @return string
-     */
-    public function migrations()
-    {
-        return $this->migrations;
-    }
-
-    /**
-     * @return array
-     */
-    public function menu()
-    {
-        return $this->menu;
-    }
-
-    /**
-     * @return array
-     */
-    public function permission()
-    {
-        return $this->permission;
-    }
-
-    /**
-     * @return string
-     */
-    public function lang()
-    {
-        return $this->lang;
-    }
-
-    /**
-     * Whether the extension is enabled.
-     *
-     * @return bool
-     */
-    final public static function enabled()
-    {
-        return config('admin-extensions.'.static::NAME.'.enable') ? true : false;
-    }
-
-    /**
-     * Whether the extension is disabled.
-     *
-     * @return bool
-     */
-    final public static function disable()
-    {
-        return ! static::enabled();
-    }
-
-    /**
-     * Get config set in config/admin.php.
-     *
-     * @param string $key
-     * @param null   $default
-     *
-     * @return \Illuminate\Config\Repository|mixed
-     */
-    final public function config($key = null, $default = null)
-    {
-        if (is_null($key)) {
-            $key = sprintf('admin.extensions.%s', static::NAME);
-        } else {
-            $key = sprintf('admin.extensions.%s.%s', static::NAME, $key);
-        }
-
-        return config($key, $default);
-    }
-
-    /**
-     * Import menu item and permission to dcat-admin.
-     */
-    public function import(Command $command)
-    {
-        if ($menu = $this->menu()) {
-            if ($this->validateMenu($menu)) {
-                extract($menu);
-
-                if ($this->checkMenuExist($path)) {
-                    $command->warn("Menu [$path] already exists!");
-                } else {
-                    $this->createMenu($title, $path, $icon);
-                    $command->info('Import extension menu succeeded!');
-                }
-            }
-        }
-
-        if ($permission = $this->permission()) {
-            if ($this->validatePermission($permission)) {
-                extract($permission);
-
-                if ($this->checkPermissionExist($slug)) {
-                    $command->warn("Permission [$slug] already exists!");
-                } else {
-                    $this->createPermission($name, $slug, $path);
-                    $command->info('Import extension permission succeeded!');
-                }
-            }
-        }
-    }
-
-    /**
-     * Uninstall the extension.
-     *
-     * @param Command $command
-     */
-    public function uninstall(Command $command)
-    {
-    }
-
-    /**
-     * Validate menu fields.
-     *
-     * @param array $menu
-     *
-     * @throws \Exception
-     *
-     * @return bool
-     */
-    public function validateMenu(array $menu)
-    {
-        /** @var \Illuminate\Validation\Validator $validator */
-        $validator = Validator::make($menu, $this->menuValidationRules);
-
-        if ($validator->passes()) {
-            return true;
-        }
-
-        $message = "Invalid menu:\r\n".implode("\r\n", Arr::flatten($validator->errors()->messages()));
-
-        throw new \Exception($message);
-    }
-
-    /**
-     * @param $path
-     *
-     * @return bool
-     */
-    protected function checkMenuExist($path)
-    {
-        $menuModel = config('admin.database.menu_model');
-
-        /* @var \Illuminate\Database\Eloquent\Builder $query */
-        $query = $menuModel::query();
-
-        $result = $query->where('uri', $path)
-            ->get()
-            ->first();
-
-        return $result ? true : false;
-    }
-
-    /**
-     * Validate permission fields.
-     *
-     * @param array $permission
-     *
-     * @throws \Exception
-     *
-     * @return bool
-     */
-    public function validatePermission(array $permission)
-    {
-        /** @var \Illuminate\Validation\Validator $validator */
-        $validator = Validator::make($permission, $this->permissionValidationRules);
-
-        if ($validator->passes()) {
-            return true;
-        }
-
-        $message = "Invalid permission:\r\n".implode("\r\n", Arr::flatten($validator->errors()->messages()));
-
-        throw new \Exception($message);
-    }
-
-    /**
-     * Create a item in dcat-admin left side menu.
-     *
-     * @param string $title
-     * @param string $uri
-     * @param string $icon
-     * @param int    $parentId
-     */
-    protected function createMenu($title, $uri, $icon = 'fa-bars', $parentId = 0)
-    {
-        $menuModel = config('admin.database.menu_model');
-
-        $lastOrder = $menuModel::max('order');
-
-        $menuModel::create([
-            'parent_id' => $parentId,
-            'order'     => $lastOrder + 1,
-            'title'     => $title,
-            'icon'      => $icon,
-            'uri'       => $uri,
-        ]);
-    }
-
-    /**
-     * @param $slug
-     *
-     * @return bool
-     */
-    protected function checkPermissionExist($slug)
-    {
-        $permissionModel = config('admin.database.permissions_model');
-
-        /* @var \Illuminate\Database\Eloquent\Builder $query */
-        $query = $permissionModel::query();
-
-        $result = $query->where('slug', $slug)
-            ->get()
-            ->first();
-
-        return $result ? true : false;
-    }
-
-    /**
-     * Create a permission for this extension.
-     *
-     * @param $name
-     * @param $slug
-     * @param $path
-     */
-    protected function createPermission($name, $slug, $path)
-    {
-        $permissionModel = config('admin.database.permissions_model');
-
-        $permissionModel::create([
-            'name'      => $name,
-            'slug'      => $slug,
-            'http_path' => '/'.trim($path, '/'),
-        ]);
-    }
-
-    /**
-     * Set routes for this extension.
-     *
-     * @param $callback
-     */
-    public function routes($callback)
-    {
-        Admin::app()->routes(function ($router) use ($callback) {
-            $attributes = array_merge(
-                [
-                    'prefix'     => config('admin.route.prefix'),
-                    'middleware' => config('admin.route.middleware'),
-                ],
-                $this->config('route', [])
-            );
-
-            $router->group($attributes, $callback);
-        });
-    }
-
-    /**
-     * @return static
-     */
-    public static function make()
-    {
-        return new static();
-    }
-}

+ 1 - 1
src/Grid/Tools/QuickSearch.php

@@ -25,7 +25,7 @@ class QuickSearch extends AbstractTool
     /**
      * @var int rem
      */
-    protected $width = 19;
+    protected $width = 18;
 
     /**
      * @var bool