jqh před 4 roky
rodič
revize
3088df7596

+ 3 - 3
resources/views/form/keyvalue.blade.php

@@ -13,7 +13,7 @@
             <tr>
                 <th>{{ __('Key') }}</th>
                 <th>{{ __('Value') }}</th>
-                <th style="width: 75px;"></th>
+                <th style="width: 85px;"></th>
             </tr>
             </thead>
             <tbody class="kv-{{ $class }}-table">
@@ -55,7 +55,7 @@
                     <td class="form-group">
                         <div>
                             <div class="{{ $class }}-remove btn btn-white btn-sm pull-right">
-                                <i class="fa fa-trash">&nbsp;</i>{{ __('admin.remove') }}
+                                <i class="feather icon-trash">&nbsp;</i>{{ __('admin.remove') }}
                             </div>
                         </div>
                     </td>
@@ -99,7 +99,7 @@
         <td class="form-group">
             <div>
                 <div class="{{ $class }}-remove btn btn-white btn-sm pull-right">
-                    <i class="fa fa-trash">&nbsp;</i>{{ __('admin.remove') }}
+                    <i class="feather icon-trash">&nbsp;</i>{{ __('admin.remove') }}
                 </div>
             </div>
         </td>

+ 4 - 4
resources/views/form/listfield.blade.php

@@ -39,9 +39,9 @@
                         </div>
                     </td>
 
-                    <td style="width: 75px;">
+                    <td style="width: 85px;">
                         <div class="{{$column}}-remove btn btn-white btn-sm pull-right">
-                            <i class="fa fa-trash">&nbsp;</i>{{ __('admin.remove') }}
+                            <i class="feather icon-trash">&nbsp;</i>{{ __('admin.remove') }}
                         </div>
                     </td>
                 </tr>
@@ -72,9 +72,9 @@
             </div>
         </td>
 
-        <td style="width: 75px;">
+        <td style="width: 85px;">
             <div class="{{$column}}-remove btn btn-white btn-sm pull-right">
-                <i class="fa fa-trash">&nbsp;</i>{{ __('admin.remove') }}
+                <i class="feather icon-trash">&nbsp;</i>{{ __('admin.remove') }}
             </div>
         </td>
     </tr>

+ 4 - 8
src/Form/Field/KeyValue.php

@@ -4,17 +4,13 @@ namespace Dcat\Admin\Form\Field;
 
 use Dcat\Admin\Admin;
 use Dcat\Admin\Form\Field;
+use Dcat\Admin\Support\Helper;
 use Illuminate\Support\Arr;
 
 class KeyValue extends Field
 {
     const DEFAULT_FLAG_NAME = '_def_';
 
-    /**
-     * @var array
-     */
-    protected $value = ['' => ''];
-
     /**
      * Fill data to the field.
      *
@@ -26,7 +22,7 @@ class KeyValue extends Field
     {
         $this->data = $data;
 
-        return Arr::get($data, $this->column, $this->value);
+        return Helper::array(Arr::get($data, $this->column, $this->value));
     }
 
     /**
@@ -98,10 +94,10 @@ JS;
         unset($value[static::DEFAULT_FLAG_NAME]);
 
         if (empty($value)) {
-            return [];
+            return '[]';
         }
 
-        return array_combine($value['keys'], $value['values']);
+        return json_encode(array_combine($value['keys'], $value['values']));
     }
 
     public function render()

+ 4 - 8
src/Form/Field/ListField.php

@@ -4,6 +4,7 @@ namespace Dcat\Admin\Form\Field;
 
 use Dcat\Admin\Admin;
 use Dcat\Admin\Form\Field;
+use Dcat\Admin\Support\Helper;
 use Illuminate\Support\Arr;
 
 class ListField extends Field
@@ -24,11 +25,6 @@ class ListField extends Field
      */
     protected $min = 0;
 
-    /**
-     * @var array
-     */
-    protected $value = [''];
-
     /**
      * Set Max list size.
      *
@@ -68,7 +64,7 @@ class ListField extends Field
     {
         $this->data = $data;
 
-        return Arr::get($data, $this->column, $this->value);
+        return Helper::array(Arr::get($data, $this->column, $this->value));
     }
 
     /**
@@ -152,10 +148,10 @@ JS;
         unset($value['values'][static::DEFAULT_FLAG_NAME]);
 
         if (empty($value['values'])) {
-            return [];
+            return '[]';
         }
 
-        return array_values($value['values']);
+        return json_encode(array_values($value['values']));
     }
 
     /**