jqh vor 5 Jahren
Ursprung
Commit
4176587553

+ 6 - 3
resources/assets/dcat/js/bootstrappers/Pjax.js

@@ -9,6 +9,8 @@ export default class Pjax {
     boot(Dcat) {
         let container = Dcat.config.pjax_container_selector;
 
+        let _this = this;
+
         $.pjax.defaults.timeout = 5000;
         $.pjax.defaults.maxCacheLength = 0;
 
@@ -20,12 +22,11 @@ export default class Pjax {
             event.preventDefault();
         });
 
-        $d.on('submit', 'form[pjax-container]', function (event) {
+        $d.off('submit', 'form[pjax-container]').on('submit', 'form[pjax-container]', function (event) {
             $.pjax.submit(event, container)
         });
 
         $d.on("pjax:popstate", function () {
-
             $d.one("pjax:end", function (event) {
                 $(event.target).find("script[data-exec-on-popstate]").each(function () {
                     $.globalEval(this.text || this.textContent || this.innerHTML || '');
@@ -54,6 +55,8 @@ export default class Pjax {
         });
 
         // 新页面加载,重新初始化
-        $d.on('pjax:loaded', Dcat.boot);
+        $d.on('pjax:loaded', function () {
+            _this.boot(Dcat)
+        });
     }
 }

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

@@ -3,4 +3,5 @@ $blue: #3085d6;
 
 $primary-linear-gradient: linear-gradient(118deg, rgba($primary, 1), rgba($primary, 0.7));
 
-$body-background: #ecf0f5;
+//$body-background: #ecf0f5;
+$body-background: #f9fafc;

+ 12 - 1
resources/assets/dcat/sass/dcat-app.scss

@@ -18,7 +18,7 @@ html body {
 }
 
 body, .header-navbar, .navigation, .breadcrumb, h1, h2, h3, h4, h5 {
-  font-family: Nunito,system-ui,BlinkMacSystemFont,-apple-system,sans-serif;
+  font-family: Nunito, Montserrat,system-ui,BlinkMacSystemFont,-apple-system,sans-serif;
 }
 
 body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation > li > a > i:before {
@@ -35,6 +35,7 @@ body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation >
   font-weight: 400;
   font-size: 24px;
   display: inline-block;
+  font-family: Montserrat,Nunito,sans-serif;
 
   small {
     font-size: 15px;
@@ -43,3 +44,13 @@ body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation >
     font-weight: 300;
   }
 }
+
+code {
+  box-shadow: 0 1px 1px rgba(0,0,0,0.125);
+  padding: 3px 5px;
+  background: #f1f1f1;
+}
+
+.pagination .page-item .page-link {
+  font-weight: 600;
+}

+ 3 - 3
resources/assets/dcat/sass/nprogress/NProgress.scss

@@ -54,9 +54,9 @@
   position: relative
 }
 
-.nprogress-custom-parent #nprogress .bar, .nprogress-custom-parent #nprogress .spinner {
-  position: absolute
-}
+//.nprogress-custom-parent #nprogress .bar, .nprogress-custom-parent #nprogress .spinner {
+//  position: absolute
+//}
 
 @-webkit-keyframes nprogress-spinner {
   0% {

+ 13 - 7
resources/dist/dcat/css/app.css

@@ -52,11 +52,6 @@
   position: relative;
 }
 
-.nprogress-custom-parent #nprogress .bar,
-.nprogress-custom-parent #nprogress .spinner {
-  position: absolute;
-}
-
 @-webkit-keyframes nprogress-spinner {
   0% {
     -webkit-transform: rotate(0);
@@ -1723,7 +1718,7 @@ body.swal2-no-backdrop .swal2-shown.swal2-bottom-right {
 }
 
 html body {
-  background-color: #ecf0f5;
+  background-color: #f9fafc;
 }
 
 body,
@@ -1735,7 +1730,7 @@ h2,
 h3,
 h4,
 h5 {
-  font-family: Nunito, system-ui, BlinkMacSystemFont, -apple-system, sans-serif;
+  font-family: Nunito, Montserrat, system-ui, BlinkMacSystemFont, -apple-system, sans-serif;
 }
 
 body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation > li > a > i:before {
@@ -1750,6 +1745,7 @@ body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation >
   font-weight: 400;
   font-size: 24px;
   display: inline-block;
+  font-family: Montserrat, Nunito, sans-serif;
 }
 
 .content-header h1 small {
@@ -1759,3 +1755,13 @@ body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu .navigation >
   font-weight: 300;
 }
 
+code {
+  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125);
+  padding: 3px 5px;
+  background: #f1f1f1;
+}
+
+.pagination .page-item .page-link {
+  font-weight: 600;
+}
+

+ 7 - 2
resources/dist/dcat/js/app.js

@@ -333,6 +333,9 @@ var Pjax = /*#__PURE__*/function () {
     key: "boot",
     value: function boot(Dcat) {
       var container = Dcat.config.pjax_container_selector;
+
+      var _this = this;
+
       $.pjax.defaults.timeout = 5000;
       $.pjax.defaults.maxCacheLength = 0;
       $('a:not(a[target="_blank"])').click(function (event) {
@@ -343,7 +346,7 @@ var Pjax = /*#__PURE__*/function () {
       $d.on('pjax:timeout', function (event) {
         event.preventDefault();
       });
-      $d.on('submit', 'form[pjax-container]', function (event) {
+      $d.off('submit', 'form[pjax-container]').on('submit', 'form[pjax-container]', function (event) {
         $.pjax.submit(event, container);
       });
       $d.on("pjax:popstate", function () {
@@ -376,7 +379,9 @@ var Pjax = /*#__PURE__*/function () {
         Dcat.NP.done();
       }); // 新页面加载,重新初始化
 
-      $d.on('pjax:loaded', Dcat.boot);
+      $d.on('pjax:loaded', function () {
+        _this.boot(Dcat);
+      });
     }
   }]);
 

+ 4 - 4
resources/views/grid/pagination.blade.php

@@ -1,9 +1,9 @@
 <ul class="pagination pagination-sm no-margin pull-right">
     <!-- Previous Page Link -->
     @if ($paginator->onFirstPage())
-    <li class="page-item disabled"><span class="page-link"><i class="fa fa-lg fa-angle-left"></i></span></li>
+    <li class="page-item previous disabled"><span class="page-link">Previous</span></li>
     @else
-    <li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev"><i class="fa fa-lg fa-angle-left"></i></a></li>
+    <li class="page-item previous"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">Previous</a></li>
     @endif
 
     <!-- Pagination Elements -->
@@ -27,8 +27,8 @@
 
     <!-- Next Page Link -->
     @if ($paginator->hasMorePages())
-    <li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next"><i class="fa fa-lg fa-angle-right"></i></a></li>
+    <li class="page-item next"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">Next</a></li>
     @else
-    <li class="page-item disabled"><span class="page-link"><i class="fa fa-lg fa-angle-right"></i></span></li>
+    <li class="page-item next disabled"><span class="page-link">Next</span></li>
     @endif
 </ul>

+ 1 - 1
resources/views/grid/table.blade.php

@@ -1,6 +1,6 @@
 {!! $grid->renderQuickSearch() !!}
 
-<div class="card da-box">
+<div class="card dcat-box">
 
     @if ($grid->allowToolbar())
         <div class="box-header">

+ 105 - 0
resources/views/grid/table2.blade.php

@@ -0,0 +1,105 @@
+{!! $grid->renderQuickSearch() !!}
+
+<style>
+    #{{ $tableId }} {
+        border: 0;
+    }
+    #{{ $tableId }} thead tr {
+        background: transparent;
+        text-transform: uppercase;
+        font-family: Montserrat,sans-serif;
+    }
+
+    #{{ $tableId }} thead th {
+        font-size: .95rem;
+    }
+</style>
+
+<div class="dcat-box dt-bootstrap4">
+
+    @if ($grid->allowToolbar())
+        <div class="box-header">
+            @if(!empty($title))
+                <h4 class="pull-left" style="margin:5px 10px 0;">
+                    {!! $title !!}&nbsp;
+                    @if(!empty($description))
+                        <small>{!! $description!!}</small>
+                    @endif
+                </h4>
+                <div class="pull-right" data-responsive-table-toolbar="{{$tableId}}">
+                    {!! $grid->renderTools() !!} {!! $grid->renderCreateButton() !!} {!! $grid->renderExportButton() !!}
+                </div>
+            @else
+                <div class="pull-right" data-responsive-table-toolbar="{{$tableId}}">
+                    {!! $grid->renderCreateButton() !!} {!! $grid->renderExportButton() !!}
+                </div>
+
+                {!! $grid->renderTools() !!}
+            @endif
+
+        </div>
+    @endif
+
+    {!! $grid->renderFilter() !!}
+
+    {!! $grid->renderHeader() !!}
+
+    <div class="in table-responsive" {!! $grid->option('show_bordered') ? 'style="padding:3px 10px 10px"' : '' !!}>
+        <table class="table data-list-view dataTable dt-checkboxes-select {{ $grid->option('show_bordered') ? 'table-bordered' : $grid->option('table_header_style') }} " id="{{ $tableId }}">
+            <thead>
+            @if ($headers = $grid->getComplexHeaders())
+                <tr>
+                    @foreach($headers as $header)
+                        {!! $header->render() !!}
+                    @endforeach
+                </tr>
+            @endif
+            <tr>
+                @foreach($grid->columns() as $column)
+                    <th {!! $column->formatTitleAttributes() !!}>{!! $column->getLabel() !!}{!! $column->renderHeader() !!}</th>
+                @endforeach
+            </tr>
+            </thead>
+
+            @if ($grid->hasQuickCreate())
+                {!! $grid->renderQuickCreate() !!}
+            @endif
+
+            <tbody>
+            @foreach($grid->rows() as $row)
+                <tr {!! $row->rowAttributes() !!}>
+                    @foreach($grid->getColumnNames() as $name)
+                        <td {!! $row->columnAttributes($name) !!}>
+                            {!! $row->column($name) !!}
+                        </td>
+                    @endforeach
+                </tr>
+            @endforeach
+            @if ($grid->rows()->isEmpty())
+                <tr>
+                    <td colspan="{!! count($grid->getColumnNames()) !!}">
+                        <div style="margin:5px 0 0 10px;"><span class="help-block" style="margin-bottom:0"><i class="fa fa-info-circle"></i>&nbsp;{{ trans('admin.no_data') }}</span></div>
+                    </td>
+                </tr>
+            @endif
+            </tbody>
+        </table>
+    </div>
+
+    {!! $grid->renderFooter() !!}
+
+    @if ($paginator = $grid->paginator())
+        <div class="box-footer clearfix " style="padding-bottom:5px;">
+            {!! $paginator->render() !!}
+        </div>
+    @else
+        <div class="box-footer clearfix text-80 " style="height:48px;line-height:25px;">
+            @if ($grid->rows()->isEmpty())
+                {!! trans('admin.pagination.range', ['first' => '<b>0</b>', 'last' => '<b>'.$grid->rows()->count().'</b>', 'total' => '<b>'.$grid->rows()->count().'</b>',]) !!}
+            @else
+                {!! trans('admin.pagination.range', ['first' => '<b>1</b>', 'last' => '<b>'.$grid->rows()->count().'</b>', 'total' => '<b>'.$grid->rows()->count().'</b>',]) !!}
+            @endif
+        </div>
+    @endif
+
+</div>

+ 1 - 1
src/Controllers/MenuController.php

@@ -58,7 +58,7 @@ class MenuController extends AdminController
 
                     $form->width(9, 2);
 
-                    $column->append(Card::make(trans('admin.new'), $form)->class('card da-box'));
+                    $column->append(Card::make(trans('admin.new'), $form)->class('card dcat-box'));
                 });
             });
     }

+ 1 - 1
src/Form/Builder.php

@@ -832,7 +832,7 @@ EOF;
             return $wrapper($view);
         }
 
-        return "<div class='card da-box'>{$view->render()}</div>";
+        return "<div class='card dcat-box'>{$view->render()}</div>";
     }
 
     /**

+ 1 - 1
src/Grid.php

@@ -113,7 +113,7 @@ class Grid
      *
      * @var string
      */
-    protected $view = 'admin::grid.table';
+    protected $view = 'admin::grid.table2';
 
     /**
      * @var Closure

+ 15 - 3
src/Layout/Assets.php

@@ -44,6 +44,10 @@ class Assets
         'palette-gradient'   => 'dcat-admin/css/core/colors/palette-gradient.css',
         'colors'             => 'dcat-admin/css/colors.css',
         //'custom'             => 'dcat-admin/css/custom-laravel.css',
+
+        'datatables' => 'dcat-admin/vendors/css/tables/datatable/datatables.min.css',
+        'data-list-view' => 'dcat-admin/css/pages/data-list-view.css',
+
         'dcat'               => 'dcat-admin/dcat/css/app.css',
     ];
 
@@ -64,9 +68,12 @@ class Assets
     public $components = [];
 
     /**
-     * @var string
+     * @var array
      */
-    public $fonts = 'https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,800,800i,900,900i';
+    public $fonts = [
+        'https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,800,800i,900,900i',
+        'https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600',
+    ];
 
     /**
      * @var bool
@@ -190,7 +197,12 @@ class Assets
 
     protected function addFontCss()
     {
-        $this->fonts && ($this->baseCss[] = $this->fonts);
+        $this->fonts && (
+            $this->baseCss = array_merge(
+                $this->baseCss,
+                (array) $this->fonts
+            )
+        );
     }
 
     protected function mergeBaseCss()

+ 1 - 1
src/Show/Panel.php

@@ -210,7 +210,7 @@ class Panel implements Renderable
         $view = view($this->view, $this->data);
 
         if (! $wrapper = $this->wrapper) {
-            return "<div class='card da-box'>{$view->render()}</div>";
+            return "<div class='card dcat-box'>{$view->render()}</div>";
         }
 
         return $wrapper($view);

+ 2 - 2
src/Traits/HasAssets.php

@@ -122,11 +122,11 @@ trait HasAssets
     }
 
     /**
-     * @param string $font
+     * @param string|array $font
      *
      * @return void
      */
-    public static function fonts(string $font)
+    public static function fonts($font)
     {
         static::assets()->fonts = $font;
     }

+ 1 - 1
src/Tree.php

@@ -558,7 +558,7 @@ JS;
         $view = view($this->view['tree'], $this->variables());
 
         if (! $wrapper = $this->wrapper) {
-            return "<div class='card da-box'>{$view->render()}</div>";
+            return "<div class='card dcat-box'>{$view->render()}</div>";
         }
 
         return $wrapper($view);

+ 1 - 1
src/Widgets/DialogForm.php

@@ -304,7 +304,7 @@ JS
 
         Admin::baseCss([]);
         Admin::baseJs([]);
-        Admin::fonts('');
+        Admin::fonts(false);
 
         Admin::assets()->full();