Browse Source

:construction: wip

jqh 4 years ago
parent
commit
7f8579066a

+ 1 - 1
resources/assets/dcat/sass/components/_button.scss

@@ -126,7 +126,7 @@ a.btn-sm, .btn-group-sm > a.btn {
 
 .btn-light {
   border-color: $input-border-color!important;
-  background-color: $dark40!important;
+  background-color: $white!important;
   color: #444;
   box-shadow: none;
 }

File diff suppressed because it is too large
+ 0 - 0
resources/dist/adminlte/adminlte.js.map


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/css/dcat-app-blue-light.css


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/css/dcat-app-blue.css


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/css/dcat-app-green.css


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/css/dcat-app.css


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/extra/action.js.map


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/extra/select-table.js.map


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/js/dcat-app.js.map


+ 1 - 5
resources/views/form/number.blade.php

@@ -32,9 +32,5 @@
 <script require="@number-input">
     $('{{ $selector }}:not(.initialized)')
         .addClass('initialized')
-        .bootstrapNumber({
-            upClass: 'primary shadow-0',
-            downClass: 'light shadow-0',
-            center: true
-        });
+        .bootstrapNumber({!! json_encode($options) !!});
 </script>

+ 3 - 7
src/Form.php

@@ -1556,15 +1556,11 @@ class Form implements Renderable
      */
     public function render()
     {
-        try {
-            $this->rendering();
+        $this->rendering();
 
-            $this->callComposing();
+        $this->callComposing();
 
-            return $this->builder->render();
-        } catch (\Throwable $e) {
-            return $this->handleException($e);
-        }
+        return $this->builder->render();
     }
 
     /**

+ 6 - 0
src/Form/Field/Number.php

@@ -6,6 +6,12 @@ class Number extends Text
 {
     protected $view = 'admin::form.number';
 
+    protected $options = [
+        'upClass'   => 'primary shadow-0',
+        'downClass' => 'light shadow-0',
+        'center'    => true
+    ];
+
     /**
      * Set min value of number field.
      *

+ 4 - 14
src/Grid.php

@@ -6,7 +6,6 @@ use Closure;
 use Dcat\Admin\Contracts\Repository;
 use Dcat\Admin\Grid\Column;
 use Dcat\Admin\Grid\Concerns;
-use Dcat\Admin\Grid\Events\Rows;
 use Dcat\Admin\Grid\Model;
 use Dcat\Admin\Grid\Row;
 use Dcat\Admin\Grid\Tools;
@@ -876,17 +875,13 @@ HTML;
      */
     public function render()
     {
-        try {
-            $this->callComposing();
+        $this->callComposing();
 
-            $this->build();
+        $this->build();
 
-            $this->applyFixColumns();
+        $this->applyFixColumns();
 
-            $this->setUpOptions();
-        } catch (\Throwable $e) {
-            return $this->handleException($e);
-        }
+        $this->setUpOptions();
 
         return $this->doWrap();
     }
@@ -905,11 +900,6 @@ HTML;
         return $wrapper($view);
     }
 
-    protected function handleException(\Throwable $e)
-    {
-        return Admin::handleException($e);
-    }
-
     /**
      * Add column to grid.
      *

+ 9 - 5
src/Layout/Content.php

@@ -487,14 +487,18 @@ class Content implements Renderable
      */
     public function render()
     {
-        $this->callComposing();
-        $this->shareDefaultErrors();
+        try {
+            $this->callComposing();
+            $this->shareDefaultErrors();
 
-        $this->variables['content'] = $this->build();
+            $this->variables['content'] = $this->build();
 
-        $this->callComposed();
+            $this->callComposed();
 
-        return view($this->view, $this->variables())->render();
+            return view($this->view, $this->variables())->render();
+        } catch (\Throwable $e) {
+            return Admin::handleException($e);
+        }
     }
 
     /**

+ 1 - 1
src/Layout/Menu.php

@@ -191,7 +191,7 @@ class Menu
      */
     public function translate($text)
     {
-        $titleTranslation = 'admin.menu_titles.'.trim(str_replace(' ', '_', strtolower($text)));
+        $titleTranslation = 'menu.titles.'.trim(str_replace(' ', '_', strtolower($text)));
 
         if (Lang::has($titleTranslation)) {
             return __($titleTranslation);

+ 18 - 27
src/Show.php

@@ -667,40 +667,31 @@ class Show implements Renderable
      */
     public function render()
     {
-        try {
-            $model = $this->model();
+        $model = $this->model();
 
-            if (is_callable($this->builder)) {
-                call_user_func($this->builder, $this);
-            }
-
-            if ($this->fields->isEmpty()) {
-                $this->all();
-            }
+        if (is_callable($this->builder)) {
+            call_user_func($this->builder, $this);
+        }
 
-            if (is_array($this->builder)) {
-                $this->fields($this->builder);
-            }
+        if ($this->fields->isEmpty()) {
+            $this->all();
+        }
 
-            $this->fields->each->fill($model);
-            $this->relations->each->model($model);
+        if (is_array($this->builder)) {
+            $this->fields($this->builder);
+        }
 
-            $this->callComposing();
+        $this->fields->each->fill($model);
+        $this->relations->each->model($model);
 
-            $data = [
-                'panel'     => $this->panel->fill($this->fields),
-                'relations' => $this->relations,
-            ];
+        $this->callComposing();
 
-            return view($this->view, $data)->render();
-        } catch (\Throwable $e) {
-            return $this->handleException($e);
-        }
-    }
+        $data = [
+            'panel'     => $this->panel->fill($this->fields),
+            'relations' => $this->relations,
+        ];
 
-    protected function handleException(\Throwable $e)
-    {
-        return Admin::handleException($e);
+        return view($this->view, $data)->render();
     }
 
     /**

+ 19 - 22
src/Tree.php

@@ -435,13 +435,19 @@ class Tree implements Renderable
     /**
      * 设置行操作回调.
      *
-     * @param \Closure $callback
+     * @param \Closure|array $callback
      *
      * @return $this
      */
-    public function actions(\Closure $callback)
+    public function actions($callback)
     {
-        $this->actionCallbacks[] = $callback;
+        if ($callback instanceof \Closure) {
+            $this->actionCallbacks[] = $callback;
+        } else {
+            $this->actionCallbacks[] = function (Actions $actions) use ($callback) {
+                $actions->append($callback);
+            };
+        }
 
         return $this;
     }
@@ -585,24 +591,20 @@ class Tree implements Renderable
      */
     public function render()
     {
-        try {
-            $this->callResolving();
+        $this->callResolving();
 
-            $this->setDefaultBranchCallback();
+        $this->setDefaultBranchCallback();
 
-            $this->renderQuickCreateButton();
+        $this->renderQuickCreateButton();
 
-            view()->share([
-                'currentUrl'     => $this->url,
-                'keyName'        => $this->getKeyName(),
-                'branchView'     => $this->branchView,
-                'branchCallback' => $this->branchCallback,
-            ]);
+        view()->share([
+            'currentUrl'     => $this->url,
+            'keyName'        => $this->getKeyName(),
+            'branchView'     => $this->branchView,
+            'branchCallback' => $this->branchCallback,
+        ]);
 
-            return $this->doWrap();
-        } catch (\Throwable $e) {
-            return $this->handleException($e);
-        }
+        return $this->doWrap();
     }
 
     /**
@@ -621,11 +623,6 @@ class Tree implements Renderable
         return Admin::resolveHtml(Helper::render($wrapper($view)))['html'];
     }
 
-    protected function handleException(\Throwable $e)
-    {
-        return Admin::handleException($e);
-    }
-
     /**
      * Get the string contents of the grid view.
      *

+ 15 - 0
src/Tree/Actions.php

@@ -53,6 +53,13 @@ class Actions implements Renderable
      */
     public function append($action)
     {
+        if (is_array($action)) {
+            foreach ($action as $value) {
+                $this->append($value);
+            }
+
+            return $this;
+        }
         $this->prepareAction($action);
 
         array_push($this->appends, $action);
@@ -67,6 +74,14 @@ class Actions implements Renderable
      */
     public function prepend($action)
     {
+        if (is_array($action)) {
+            foreach ($action as $value) {
+                $this->prepend($value);
+            }
+
+            return $this;
+        }
+
         $this->prepareAction($action);
 
         array_unshift($this->prepends, $action);

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