Procházet zdrojové kódy

表单响应式布局优化

jqh před 5 roky
rodič
revize
cdc23afe37

+ 7 - 1
resources/assets/dcat/sass/components/_form.scss

@@ -25,11 +25,17 @@ select.form-control:not([multiple=multiple]) {
 }
 
 .control-label {
-  padding: 7px 5px;
+  padding-top: 7px;
   margin-bottom: 0;
   font-size: 1rem;
   text-transform: capitalize;
 }
+
+.fields-group .row.form-group {
+  margin-right: 0;
+  margin-left: 0;
+}
+
 @media (min-width: 768px) {
   .form-group .control-label {
     text-align: right;

+ 6 - 1
resources/dist/dcat/css/dcat-app.css

@@ -1901,12 +1901,17 @@ select.form-control:not([multiple=multiple]) {
 }
 
 .control-label {
-  padding: 7px 5px;
+  padding-top: 7px;
   margin-bottom: 0;
   font-size: 1rem;
   text-transform: capitalize;
 }
 
+.fields-group .row.form-group {
+  margin-right: 0;
+  margin-left: 0;
+}
+
 @media (min-width: 768px) {
   .form-group .control-label {
     text-align: right;

+ 2 - 3
resources/views/form/footer.blade.php

@@ -2,8 +2,7 @@
 
     {{ csrf_field() }}
 
-    <div class="col-md-{{$width['label']}}">
-    </div>
+    <div class="col-md-{{$width['label']}} d-md-block" style="display: none"></div>
 
     <div class="col-md-{{$width['field']}}">
 
@@ -13,7 +12,7 @@
         </div>
 
         @if($checkboxes)
-            <div class="d-flex pull-right" style="margin:10px 15px 0 0;">{!! $checkboxes !!}</div>
+            <div class="pull-right d-md-flex" style="margin:10px 15px 0 0;display: none">{!! $checkboxes !!}</div>
         @endif
 
         @endif

+ 2 - 2
src/Form/Field.php

@@ -836,8 +836,8 @@ class Field implements Renderable
     {
         if ($this->horizontal) {
             return [
-                'label'      => "col-sm-{$this->width['label']} {$this->getLabelClass()}",
-                'field'      => "col-sm-{$this->width['field']}",
+                'label'      => "col-md-{$this->width['label']} {$this->getLabelClass()}",
+                'field'      => "col-md-{$this->width['field']}",
                 'form-group' => 'form-group row',
             ];
         }

+ 2 - 2
src/Form/Field/HasMany.php

@@ -532,7 +532,7 @@ JS;
     }
     if(\$navTab.closest('li').hasClass('active')){
         \$navTab.closest('li').remove();
-        $('#has-many-{$this->column} > .nav > li:nth-child(1) > a').tab('show');
+        $('#has-many-{$this->column} > .nav > li:nth-child(1) > a').click();
     }else{
         \$navTab.closest('li').remove();
     }
@@ -545,7 +545,7 @@ $('#has-many-{$this->column} > .header').off('click', '.add').on('click', '.add'
     var paneHtml = $('#has-many-{$this->column} > template.pane-tpl').html().replace(/{$defaultKey}/g, index);
     $('#has-many-{$this->column} > .nav').append(navTabHtml);
     $('#has-many-{$this->column} > .tab-content').append(paneHtml);
-    $('#has-many-{$this->column} > .nav > li:last-child a').tab('show');
+    $('#has-many-{$this->column} > .nav > li:last-child a').click();
     {$templateScript}
 });