فهرست منبع

表单多栏布局边距调整 row加上注释(ide友好)

yxx 5 سال پیش
والد
کامیت
1d466eb8a7
2فایلهای تغییر یافته به همراه65 افزوده شده و 15 حذف شده
  1. 5 3
      resources/views/form/container.blade.php
  2. 60 12
      src/Form/Row.php

+ 5 - 3
resources/views/form/container.blade.php

@@ -10,9 +10,11 @@
     @else
         <div class="fields-group">
             @if($form->hasRows())
-                @foreach($form->rows() as $row)
-                    {!! $row->render() !!}
-                @endforeach
+                <div style="margin-left: 2rem;margin-bottom: 2rem">
+                    @foreach($form->rows() as $row)
+                        {!! $row->render() !!}
+                    @endforeach
+                </div>
             @else
                 @foreach($form->fields() as $field)
                     {!! $field->render() !!}

+ 60 - 12
src/Form/Row.php

@@ -5,8 +5,61 @@ namespace Dcat\Admin\Form;
 use Dcat\Admin\Form;
 use Illuminate\Contracts\Support\Renderable;
 
-class Row implements Renderable
-{
+/**
+ * Class Row.
+ *
+ * @method Field\Text                   text($column, $label = '')
+ * @method Field\Checkbox               checkbox($column, $label = '')
+ * @method Field\Radio                  radio($column, $label = '')
+ * @method Field\Select                 select($column, $label = '')
+ * @method Field\MultipleSelect         multipleSelect($column, $label = '')
+ * @method Field\Textarea               textarea($column, $label = '')
+ * @method Field\Hidden                 hidden($column, $label = '')
+ * @method Field\Id                     id($column, $label = '')
+ * @method Field\Ip                     ip($column, $label = '')
+ * @method Field\Url                    url($column, $label = '')
+ * @method Field\Email                  email($column, $label = '')
+ * @method Field\Mobile                 mobile($column, $label = '')
+ * @method Field\Slider                 slider($column, $label = '')
+ * @method Field\Map                    map($latitude, $longitude, $label = '')
+ * @method Field\Editor                 editor($column, $label = '')
+ * @method Field\Date                   date($column, $label = '')
+ * @method Field\Datetime               datetime($column, $label = '')
+ * @method Field\Time                   time($column, $label = '')
+ * @method Field\Year                   year($column, $label = '')
+ * @method Field\Month                  month($column, $label = '')
+ * @method Field\DateRange              dateRange($start, $end, $label = '')
+ * @method Field\DateTimeRange          datetimeRange($start, $end, $label = '')
+ * @method Field\TimeRange              timeRange($start, $end, $label = '')
+ * @method Field\Number                 number($column, $label = '')
+ * @method Field\Currency               currency($column, $label = '')
+ * @method Field\SwitchField            switch ($column, $label = '')
+ * @method Field\Display                display($column, $label = '')
+ * @method Field\Rate                   rate($column, $label = '')
+ * @method Field\Divide                 divider()
+ * @method Field\Password               password($column, $label = '')
+ * @method Field\Decimal                decimal($column, $label = '')
+ * @method Field\Html                   html($html, $label = '')
+ * @method Field\Tags                   tags($column, $label = '')
+ * @method Field\Icon                   icon($column, $label = '')
+ * @method Field\Embeds                 embeds($column, $label = '')
+ * @method Field\Captcha                captcha()
+ * @method Field\Listbox                listbox($column, $label = '')
+ * @method Field\SelectResource         selectResource($column, $label = '')
+ * @method Field\File                   file($column, $label = '')
+ * @method Field\Image                  image($column, $label = '')
+ * @method Field\MultipleFile           multipleFile($column, $label = '')
+ * @method Field\MultipleImage          multipleImage($column, $label = '')
+ * @method Field\HasMany                hasMany($column, $labelOrCallback, $callback = null)
+ * @method Field\Tree                   tree($column, $label = '')
+ * @method Field\Table                  table($column, $labelOrCallback, $callback = null)
+ * @method Field\ListField              list($column, $label = '')
+ * @method Field\Timezone               timezone($column, $label = '')
+ * @method Field\KeyValue               keyValue($column, $label = '')
+ * @method Field\Tel                    tel($column, $label = '')
+ * @method Field\Markdown               markdown($column, $label = '')
+ */
+class Row implements Renderable {
     /**
      * Callback for add field to current row.s.
      *
@@ -41,8 +94,7 @@ class Row implements Renderable
      * @param \Closure $callback
      * @param Form     $form
      */
-    public function __construct(\Closure $callback, Form $form)
-    {
+    public function __construct(\Closure $callback, Form $form) {
         $this->callback = $callback;
 
         $this->form = $form;
@@ -55,8 +107,7 @@ class Row implements Renderable
      *
      * @return array
      */
-    public function getFields()
-    {
+    public function getFields() {
         return $this->fields;
     }
 
@@ -67,8 +118,7 @@ class Row implements Renderable
      *
      * @return $this
      */
-    public function width($width = 12)
-    {
+    public function width($width = 12) {
         $this->defaultFieldWidth = $width;
 
         return $this;
@@ -79,8 +129,7 @@ class Row implements Renderable
      *
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
      */
-    public function render()
-    {
+    public function render() {
         return view('admin::form.row', ['fields' => $this->fields]);
     }
 
@@ -92,8 +141,7 @@ class Row implements Renderable
      *
      * @return Field|void
      */
-    public function __call($method, $arguments)
-    {
+    public function __call($method, $arguments) {
         $field = $this->form->__call($method, $arguments);
 
         $field->disableHorizontal();