Просмотр исходного кода

Merge branch '2.0' into gitee2

jqh 5 лет назад
Родитель
Сommit
b163a1a18d
3 измененных файлов с 33 добавлено и 5 удалено
  1. 9 0
      resources/views/form/markdown.blade.php
  2. 17 1
      src/Layout/Row.php
  3. 7 4
      src/Widgets/LazyTable.php

+ 9 - 0
resources/views/form/markdown.blade.php

@@ -19,6 +19,15 @@
     </div>
 </div>
 
+<script first>
+    var ele = window.Element;
+    Dcat.eMatches = ele.prototype.matches ||
+        ele.prototype.msMatchesSelector ||
+        ele.prototype.webkitMatchesSelector;
+</script>
+
 <script require="@markdown" init="{!! $selector !!}">
     editormd(id, {!! $options !!});
+
+    Element.prototype.matches = Dcat.eMatches;
 </script>

+ 17 - 1
src/Layout/Row.php

@@ -11,6 +11,8 @@ class Row implements Renderable
      */
     protected $columns = [];
 
+    protected $noGutters = false;
+
     /**
      * Row constructor.
      *
@@ -48,6 +50,18 @@ class Row implements Renderable
         $this->columns[] = $column;
     }
 
+    /**
+     * @param bool $value
+     *
+     * @return $this
+     */
+    public function noGutters(bool $value = true)
+    {
+        $this->noGutters = $value;
+
+        return $this;
+    }
+
     /**
      * Build row column.
      *
@@ -71,7 +85,9 @@ class Row implements Renderable
      */
     protected function startRow()
     {
-        return '<div class="row">';
+        $noGutters = $this->noGutters ? 'no-gutters' : '';
+
+        return "<div class=\"row {$noGutters}\">";
     }
 
     /**

+ 7 - 4
src/Widgets/LazyTable.php

@@ -105,12 +105,11 @@ class LazyTable extends Widget
 
     protected function addScript()
     {
-        $loader = $this->load ? $this->getLoadScript() : '';
-
         $this->script = <<<JS
 Dcat.init('{$this->getElementSelector()}', function (\$this) {
-    Dcat.grid.AsyncTable({container: \$this});
-    {$loader}
+    Dcat.grid.AsyncTable({container: \$this})
+
+    {$this->getLoadScript()}
 });
 JS;
     }
@@ -120,6 +119,10 @@ JS;
      */
     protected function getLoadScript()
     {
+        if (! $this->load) {
+            return;
+        }
+
         return <<<'JS'
 $this.trigger('table:load');
 JS;