فهرست منبع

Merge branch '2.0' into gitee2

jqh 4 سال پیش
والد
کامیت
b9fe872623

+ 7 - 4
resources/assets/dcat/js/bootstrappers/Menu.js

@@ -54,6 +54,10 @@ export default class Menu {
             $this.parents('.dropdown-submenu').find('.nav-link').eq(0).addClass('active')
             $this.parents('.dropdown-submenu').find('.nav-link').eq(0).addClass('active')
         });
         });
 
 
+        // 自动计算高度
+        let $horizontalMenu = $('.horizontal-menu .main-horizontal-sidebar'),
+            defaultHorizontalMenuHeight = $horizontalMenu.height(),
+            horizontalMenuTop = $horizontalMenu.offset().top + 15;
 
 
         // 重新计算高度
         // 重新计算高度
         let resize = function () {
         let resize = function () {
@@ -61,16 +65,15 @@ export default class Menu {
                 return;
                 return;
             }
             }
 
 
-            let defaultHorizontalMenuHeight = 55,
-                height = $('.horizontal-menu .main-horizontal-sidebar').height(),
+            let height = $horizontalMenu.height(),
                 diff = height - defaultHorizontalMenuHeight,
                 diff = height - defaultHorizontalMenuHeight,
                 $wrapper = $('.horizontal-menu.navbar-fixed-top .content-wrapper');
                 $wrapper = $('.horizontal-menu.navbar-fixed-top .content-wrapper');
 
 
             if (height <= defaultHorizontalMenuHeight) {
             if (height <= defaultHorizontalMenuHeight) {
-                return $wrapper.css({'padding-top': '80px'});
+                return $wrapper.css({'padding-top': horizontalMenuTop + 'px'});
             }
             }
 
 
-            $wrapper.css({'padding-top': (80 + diff) + 'px'});
+            $wrapper.css({'padding-top': (horizontalMenuTop + diff) + 'px'});
         };
         };
         window.onresize = resize;
         window.onresize = resize;
 
 

+ 1 - 1
resources/assets/dcat/sass/components/_horizontal-menu.scss

@@ -116,7 +116,7 @@
 }
 }
 
 
 .horizontal-menu.navbar-fixed-top .content-wrapper {
 .horizontal-menu.navbar-fixed-top .content-wrapper {
-  padding-top: 80px;
+  padding-top: 75px;
 }
 }
 
 
 // 黑色主题
 // 黑色主题

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/css/dcat-app-blue-light.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/css/dcat-app-blue.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/css/dcat-app-green.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/css/dcat-app.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/js/dcat-app.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
resources/dist/dcat/js/dcat-app.js.map


+ 2 - 2
resources/views/form/keyvalue.blade.php

@@ -15,8 +15,8 @@
         <table class="table table-hover">
         <table class="table table-hover">
             <thead>
             <thead>
             <tr>
             <tr>
-                <th>{{ __('Key') }}</th>
-                <th>{{ __('Value') }}</th>
+                <th>{!! $keyLabel !!}</th>
+                <th>{!! $valueLabel !!}</th>
                 <th style="width: 85px;"></th>
                 <th style="width: 85px;"></th>
             </tr>
             </tr>
             </thead>
             </thead>

+ 1 - 1
resources/views/grid/column-selector.blade.php

@@ -3,7 +3,7 @@
         <i class="fa fa-table"></i>
         <i class="fa fa-table"></i>
         <span class="caret"></span>
         <span class="caret"></span>
     </button>
     </button>
-    <ul class="dropdown-menu" role="menu">
+    <ul class="dropdown-menu" role="menu" style="min-width: 155px">
         <li class="dropdown-item">
         <li class="dropdown-item">
             <ul class="selectors">
             <ul class="selectors">
                 {!! $selectAll !!}
                 {!! $selectAll !!}

+ 32 - 3
src/Form/Field/KeyValue.php

@@ -10,6 +10,33 @@ class KeyValue extends Field
 {
 {
     const DEFAULT_FLAG_NAME = '_def_';
     const DEFAULT_FLAG_NAME = '_def_';
 
 
+    protected $keyLabel;
+    protected $valueLabel;
+
+    public function setKeyLabel(?string $label)
+    {
+        $this->keyLabel = $label;
+
+        return $this;
+    }
+
+    public function setValueLabel(?string $label)
+    {
+        $this->keyLabel = $label;
+
+        return $this;
+    }
+
+    public function getKeyLabel()
+    {
+        return $this->keyLabel ?: __('Key');
+    }
+
+    public function getValueLabel()
+    {
+        return $this->valueLabel ?: __('Value');
+    }
+
     /**
     /**
      * {@inheritdoc}
      * {@inheritdoc}
      */
      */
@@ -45,8 +72,8 @@ class KeyValue extends Field
 
 
         $rules["{$this->column}.keys.*"] = 'distinct';
         $rules["{$this->column}.keys.*"] = 'distinct';
         $rules["{$this->column}.values.*"] = $fieldRules;
         $rules["{$this->column}.values.*"] = $fieldRules;
-        $attributes["{$this->column}.keys.*"] = __('Key');
-        $attributes["{$this->column}.values.*"] = __('Value');
+        $attributes["{$this->column}.keys.*"] = $this->getKeyLabel();
+        $attributes["{$this->column}.values.*"] = $this->getValueLabel();
 
 
         $input = $this->prepareValidatorInput($input);
         $input = $this->prepareValidatorInput($input);
 
 
@@ -76,7 +103,9 @@ class KeyValue extends Field
         $value = $this->value();
         $value = $this->value();
 
 
         $this->addVariables([
         $this->addVariables([
-            'count' => $value ? count($value) : 0,
+            'count'      => $value ? count($value) : 0,
+            'keyLabel'   => $this->getKeyLabel(),
+            'valueLabel' => $this->getValueLabel(),
         ]);
         ]);
 
 
         return parent::render();
         return parent::render();

+ 0 - 1
src/Form/Field/MultipleSelect.php

@@ -3,7 +3,6 @@
 namespace Dcat\Admin\Form\Field;
 namespace Dcat\Admin\Form\Field;
 
 
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Support\Helper;
-use Illuminate\Support\Arr;
 
 
 class MultipleSelect extends Select
 class MultipleSelect extends Select
 {
 {

+ 0 - 1
src/Form/Field/Tree.php

@@ -6,7 +6,6 @@ use Dcat\Admin\Form\Field;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Support\Helper;
 use Dcat\Admin\Widgets\Checkbox as WidgetCheckbox;
 use Dcat\Admin\Widgets\Checkbox as WidgetCheckbox;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Arrayable;
-use Illuminate\Support\Arr;
 
 
 class Tree extends Field
 class Tree extends Field
 {
 {

+ 1 - 1
src/Grid/Actions/Delete.php

@@ -15,7 +15,7 @@ class Delete extends RowAction
             return $this->title;
             return $this->title;
         }
         }
 
 
-        return '<i class="feather icon-trash"></i> '.__('admin.delete');
+        return '<i class="feather icon-trash"></i> '.__('admin.delete').' &nbsp;&nbsp;';
     }
     }
 
 
     public function render()
     public function render()

+ 1 - 1
src/Grid/Actions/Edit.php

@@ -15,7 +15,7 @@ class Edit extends RowAction
             return $this->title;
             return $this->title;
         }
         }
 
 
-        return '<i class="feather icon-edit-1"></i> '.__('admin.edit');
+        return '<i class="feather icon-edit-1"></i> '.__('admin.edit').' &nbsp;&nbsp;';
     }
     }
 
 
     /**
     /**

+ 1 - 1
src/Grid/Actions/QuickEdit.php

@@ -16,7 +16,7 @@ class QuickEdit extends RowAction
             return $this->title;
             return $this->title;
         }
         }
 
 
-        return '<i class="feather icon-edit"></i> '.__('admin.quick_edit');
+        return '<i class="feather icon-edit"></i> '.__('admin.quick_edit').' &nbsp;&nbsp;';
     }
     }
 
 
     public function render()
     public function render()

+ 1 - 1
src/Grid/Actions/Show.php

@@ -15,7 +15,7 @@ class Show extends RowAction
             return $this->title;
             return $this->title;
         }
         }
 
 
-        return '<i class="feather icon-eye"></i> '.__('admin.show');
+        return '<i class="feather icon-eye"></i> '.__('admin.show').' &nbsp;&nbsp;';
     }
     }
 
 
     /**
     /**

+ 43 - 33
src/Grid/Displayers/Actions.php

@@ -3,7 +3,6 @@
 namespace Dcat\Admin\Grid\Displayers;
 namespace Dcat\Admin\Grid\Displayers;
 
 
 use Dcat\Admin\Actions\Action;
 use Dcat\Admin\Actions\Action;
-use Dcat\Admin\Form;
 use Dcat\Admin\Grid\Actions\Delete;
 use Dcat\Admin\Grid\Actions\Delete;
 use Dcat\Admin\Grid\Actions\Edit;
 use Dcat\Admin\Grid\Actions\Edit;
 use Dcat\Admin\Grid\Actions\QuickEdit;
 use Dcat\Admin\Grid\Actions\QuickEdit;
@@ -15,8 +14,6 @@ use Illuminate\Contracts\Support\Renderable;
 
 
 class Actions extends AbstractDisplayer
 class Actions extends AbstractDisplayer
 {
 {
-    protected static $resolvedDialog;
-
     /**
     /**
      * @var array
      * @var array
      */
      */
@@ -251,16 +248,22 @@ class Actions extends AbstractDisplayer
      */
      */
     protected function renderView()
     protected function renderView()
     {
     {
-        $label = trans('admin.show');
-
-        return Show::make(
-            "<i title='{$label}' class=\"feather icon-eye grid-action-icon\"></i> &nbsp;"
-        )
+        return Show::make($this->getViewLabel())
             ->setGrid($this->grid)
             ->setGrid($this->grid)
             ->setRow($this->row)
             ->setRow($this->row)
             ->render();
             ->render();
     }
     }
 
 
+    /**
+     * @return string
+     */
+    protected function getViewLabel()
+    {
+        $label = trans('admin.show');
+
+        return "<i title='{$label}' class=\"feather icon-eye grid-action-icon\"></i> &nbsp;";
+    }
+
     /**
     /**
      * Render edit action.
      * Render edit action.
      *
      *
@@ -268,11 +271,7 @@ class Actions extends AbstractDisplayer
      */
      */
     protected function renderEdit()
     protected function renderEdit()
     {
     {
-        $label = trans('admin.edit');
-
-        return Edit::make(
-            "<i title='{$label}' class=\"feather icon-edit-1 grid-action-icon\"></i> &nbsp;"
-        )
+        return Edit::make($this->getEditLabel())
             ->setGrid($this->grid)
             ->setGrid($this->grid)
             ->setRow($this->row)
             ->setRow($this->row)
             ->render();
             ->render();
@@ -281,29 +280,34 @@ class Actions extends AbstractDisplayer
     /**
     /**
      * @return string
      * @return string
      */
      */
-    protected function renderQuickEdit()
+    protected function getEditLabel()
     {
     {
-        if (! static::$resolvedDialog) {
-            static::$resolvedDialog = true;
-
-            [$width, $height] = $this->grid->option('dialog_form_area');
-
-            Form::dialog(trans('admin.edit'))
-                ->click(".{$this->grid->getRowName()}-edit")
-                ->dimensions($width, $height)
-                ->success('Dcat.reload()');
-        }
+        $label = trans('admin.show');
 
 
-        $label = trans('admin.quick_edit');
+        return "<i title='{$label}' class=\"feather icon-edit-1 grid-action-icon\"></i> &nbsp;";
+    }
 
 
-        return QuickEdit::make(
-            "<i title='{$label}' class=\"feather icon-edit grid-action-icon\"></i> &nbsp;"
-        )
+    /**
+     * @return string
+     */
+    protected function renderQuickEdit()
+    {
+        return QuickEdit::make($this->getQuickEditLabel())
             ->setGrid($this->grid)
             ->setGrid($this->grid)
             ->setRow($this->row)
             ->setRow($this->row)
             ->render();
             ->render();
     }
     }
 
 
+    /**
+     * @return string
+     */
+    protected function getQuickEditLabel()
+    {
+        $label = trans('admin.quick_edit');
+
+        return "<i title='{$label}' class=\"feather icon-edit grid-action-icon\"></i> &nbsp;";
+    }
+
     /**
     /**
      * Render delete action.
      * Render delete action.
      *
      *
@@ -311,13 +315,19 @@ class Actions extends AbstractDisplayer
      */
      */
     protected function renderDelete()
     protected function renderDelete()
     {
     {
-        $label = trans('admin.delete');
-
-        return Delete::make(
-            "<i class=\"feather icon-trash grid-action-icon\" title='{$label}'></i> &nbsp;"
-        )
+        return Delete::make($this->getDeleteLabel())
             ->setGrid($this->grid)
             ->setGrid($this->grid)
             ->setRow($this->row)
             ->setRow($this->row)
             ->render();
             ->render();
     }
     }
+
+    /**
+     * @return string
+     */
+    protected function getDeleteLabel()
+    {
+        $label = trans('admin.delete');
+
+        return "<i class=\"feather icon-trash grid-action-icon\" title='{$label}'></i> &nbsp;";
+    }
 }
 }

+ 1 - 0
src/Http/Controllers/UserController.php

@@ -56,6 +56,7 @@ class UserController extends AdminController
             $grid->showQuickEditButton();
             $grid->showQuickEditButton();
             $grid->enableDialogCreate();
             $grid->enableDialogCreate();
             $grid->showColumnSelector();
             $grid->showColumnSelector();
+            $grid->disableEditButton();
 
 
             $grid->actions(function (Grid\Displayers\Actions $actions) {
             $grid->actions(function (Grid\Displayers\Actions $actions) {
                 if ($actions->getKey() == AdministratorModel::DEFAULT_ID) {
                 if ($actions->getKey() == AdministratorModel::DEFAULT_ID) {

+ 5 - 1
src/Repositories/EloquentRepository.php

@@ -8,6 +8,7 @@ use Dcat\Admin\Exception\RuntimeException;
 use Dcat\Admin\Form;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Show;
 use Dcat\Admin\Show;
+use Dcat\Laravel\Database\SoftDeletes as DcatSoftDeletes;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model as EloquentModel;
 use Illuminate\Database\Eloquent\Model as EloquentModel;
 use Illuminate\Database\Eloquent\Relations;
 use Illuminate\Database\Eloquent\Relations;
@@ -80,8 +81,11 @@ class EloquentRepository extends Repository implements TreeRepository
 
 
         $this->setKeyName($this->model()->getKeyName());
         $this->setKeyName($this->model()->getKeyName());
 
 
+        $traits = class_uses($this->model());
+
         $this->setIsSoftDeletes(
         $this->setIsSoftDeletes(
-            in_array(SoftDeletes::class, class_uses($this->model()))
+            in_array(SoftDeletes::class, $traits, true)
+            || in_array(DcatSoftDeletes::class, $traits, true)
         );
         );
     }
     }
 
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است