Browse Source

form

update
jqh 5 years ago
parent
commit
f04d55b0a8

+ 2 - 2
resources/assets/dcat/extra/resource-selector.js

@@ -336,7 +336,7 @@
                     return $input.html(buildOne(tag[Object.keys(tag)[0]]));
                 }
 
-                $input.html(buildOne(opts.selectedOptionsTip.replace(':num', Dcat.helpers.len(tag))));
+                $input.html(buildOne(opts.lang.selected_options.replace(':num', Dcat.helpers.len(tag))));
 
                 $app.html(buildMany(tag));
             }
@@ -347,7 +347,7 @@
                 for (let i in tag) {
                     let strVar = "";
                     strVar += "<li>";
-                    strVar += "<a class='pull-left'>" + tag[i] + "</a><a data-id='" + i + "' class='pull-right red ";
+                    strVar += "<a class='pull-left'>" + tag[i] + "</a><a data-id='" + i + "' class='pull-right red text-danger ";
                     strVar += opts.clearOneClass +"' ><i class='fa fa-close'></i></a>";
                     strVar += "<span class='clearfix'></span></li>";
 

+ 1 - 1
resources/assets/dcat/sass/components/_button.scss

@@ -1,5 +1,5 @@
 .btn {
-  padding: 0.8rem 1.35rem !important;
+  padding: 0.8rem 1.2rem !important;
   font-size: .95rem;
   height: 37.6px;
   line-height: 1.2;

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

@@ -35,6 +35,7 @@ select.form-control:not([multiple=multiple]) {
   padding: 7px 5px;
   margin-bottom: 0;
   font-size: 1rem;
+  text-transform: capitalize;
 }
 @media (min-width: 768px) {
   .form-group .control-label {

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

@@ -1756,7 +1756,7 @@ dl {
 }
 
 .btn {
-  padding: 0.8rem 1.35rem !important;
+  padding: 0.8rem 1.2rem !important;
   font-size: 0.95rem;
   height: 37.6px;
   line-height: 1.2;
@@ -1894,6 +1894,7 @@ select.form-control:not([multiple=multiple]) {
   padding: 7px 5px;
   margin-bottom: 0;
   font-size: 1rem;
+  text-transform: capitalize;
 }
 
 @media (min-width: 768px) {

+ 2 - 2
resources/dist/dcat/extra/resource-selector.js

@@ -431,7 +431,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
           return $input.html(buildOne(tag[Object.keys(tag)[0]]));
         }
 
-        $input.html(buildOne(opts.selectedOptionsTip.replace(':num', Dcat.helpers.len(tag))));
+        $input.html(buildOne(opts.lang.selected_options.replace(':num', Dcat.helpers.len(tag))));
         $app.html(buildMany(tag));
       }
 
@@ -441,7 +441,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
         for (var i in tag) {
           var strVar = "";
           strVar += "<li>";
-          strVar += "<a class='pull-left'>" + tag[i] + "</a><a data-id='" + i + "' class='pull-right red ";
+          strVar += "<a class='pull-left'>" + tag[i] + "</a><a data-id='" + i + "' class='pull-right red text-danger ";
           strVar += opts.clearOneClass + "' ><i class='fa fa-close'></i></a>";
           strVar += "<span class='clearfix'></span></li>";
           html.push(strVar);

+ 1 - 3
resources/views/form/tags.blade.php

@@ -2,16 +2,14 @@
 
     <label for="{{$id}}" class="{{$viewClass['label']}} control-label">{!! $label !!}</label>
 
-    <div class="{{$viewClass['field']}}">
+    <div class="{{$viewClass['field']}} d-flex">
 
         @include('admin::form.error')
 
         <select class="form-control {{$class}}" style="width: 100%;" name="{{$name}}[]" multiple="multiple" data-placeholder="{{ $placeholder }}" {!! $attributes !!} >
-
             @foreach($options as $key => $option)
                 <option value="{{ $keyAsValue ? $key : $option}}" {{ in_array($option, $value) ? 'selected' : '' }}>{{$option}}</option>
             @endforeach
-
         </select>
         <input type="hidden" name="{{$name}}[]" />
 

+ 1 - 1
resources/views/form/tree.blade.php

@@ -45,7 +45,7 @@ Dcat.ready(function () {
 
         var i, selected = [];
         for (i in data.selected) {
-            if (Dcat.arr.in(parents, data.selected[i])) { // 过滤父节点
+            if (Dcat.helpers.in(parents, data.selected[i])) { // 过滤父节点
                 continue;
             }
             selected.push(data.selected[i]);

+ 6 - 9
resources/views/helpers/scaffold.blade.php

@@ -332,12 +332,12 @@
                         continue;
                     }
 
-                    var c = Dcat.str.replace(list[i].comment, '"', '');
+                    var c = Dcat.helpers.replace(list[i].comment, '"', '');
                     add_field({
                         name: i,
                         lang: c,
                         type: list[i].type,
-                        default: Dcat.str.replace(list[i].default, '"', ''),
+                        default: Dcat.helpers.replace(list[i].default, '"', ''),
                         comment: c,
                         nullable: list[i].nullable != 'NO',
                     });
@@ -376,23 +376,23 @@
 
             var c;
             if (updated) {
-                c = Dcat.str.replace(updated.comment, '"', '');
+                c = Dcat.helpers.replace(updated.comment, '"', '');
                 add_field({
                     name: 'updated_at',
                     lang: c,
                     type: updated.type,
-                    default: Dcat.str.replace(updated.default, '"', ''),
+                    default: Dcat.helpers.replace(updated.default, '"', ''),
                     comment: c,
                     nullable: updated.nullable != 'NO',
                 });
             }
             if (created) {
-                c = Dcat.str.replace(created.comment, '"', '');
+                c = Dcat.helpers.replace(created.comment, '"', '');
                 add_field({
                     name: 'created_at',
                     lang: c,
                     type: created.type,
-                    default: Dcat.str.replace(created.default, '"', ''),
+                    default: Dcat.helpers.replace(created.default, '"', ''),
                     comment: c,
                     nullable: created.nullable != 'NO',
                 });
@@ -464,8 +464,5 @@
                 return m.toUpperCase()
             });
         }
-
-
     });
-
 </script>

+ 1 - 1
src/Controllers/UserController.php

@@ -176,7 +176,7 @@ class UserController extends AdminController
                 ->creationRules(['required', "unique:{$connection}.{$userTable}"])
                 ->updateRules(['required', "unique:{$connection}.{$userTable},username,$id"]);
             $form->text('name', trans('admin.name'))->required();
-            $form->multipleImage('avatar', trans('admin.avatar'));
+            $form->image('avatar', trans('admin.avatar'));
 
             if ($id) {
                 $form->password('password', trans('admin.password'))

+ 0 - 2
src/Form.php

@@ -41,7 +41,6 @@ use Symfony\Component\HttpFoundation\Response;
  * @method Field\Id                     id($column, $label = '')
  * @method Field\Ip                     ip($column, $label = '')
  * @method Field\Url                    url($column, $label = '')
- * @method Field\Color                  color($column, $label = '')
  * @method Field\Email                  email($column, $label = '')
  * @method Field\Mobile                 mobile($column, $label = '')
  * @method Field\Slider                 slider($column, $label = '')
@@ -106,7 +105,6 @@ class Form implements Renderable
     protected static $availableFields = [
         'button'         => Field\Button::class,
         'checkbox'       => Field\Checkbox::class,
-        'color'          => Field\Color::class,
         'currency'       => Field\Currency::class,
         'date'           => Field\Date::class,
         'dateRange'      => Field\DateRange::class,

+ 0 - 5
src/Form/EmbeddedForm.php

@@ -19,7 +19,6 @@ use Illuminate\Support\Collection;
  * @method Field\Id                     id($column, $label = '')
  * @method Field\Ip                     ip($column, $label = '')
  * @method Field\Url                    url($column, $label = '')
- * @method Field\Color                  color($column, $label = '')
  * @method Field\Email                  email($column, $label = '')
  * @method Field\Mobile                 mobile($column, $label = '')
  * @method Field\Slider                 slider($column, $label = '')
@@ -58,10 +57,6 @@ use Illuminate\Support\Collection;
  * @method Field\Timezone               timezone($column, $label = '')
  * @method Field\KeyValue               keyValue($column, $label = '')
  * @method Field\Tel                    tel($column, $label = '')
- * @method Field\BootstrapFile          bootstrapFile($column, $label = '')
- * @method Field\BootstrapImage         bootstrapImage($column, $label = '')
- * @method Field\BootstrapMultipleImage bootstrapMultipleImage($column, $label = '')
- * @method Field\BootstrapMultipleFile  bootstrapMultipleFile($column, $label = '')
  */
 class EmbeddedForm
 {

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

@@ -9,12 +9,12 @@ class Checkbox extends MultipleSelect
     /**
      * @var array
      */
-    protected static $css = [];
+    public static $css = [];
 
     /**
      * @var array
      */
-    protected static $js = [];
+    public static $js = [];
 
     protected $inline = true;
 

+ 0 - 61
src/Form/Field/Color.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace Dcat\Admin\Form\Field;
-
-class Color extends Text
-{
-    protected static $css = [
-        '/vendor/dcat-admin/AdminLTE/plugins/colorpicker/bootstrap-colorpicker.min.css',
-    ];
-
-    protected static $js = [
-        '/vendor/dcat-admin/AdminLTE/plugins/colorpicker/bootstrap-colorpicker.min.js',
-    ];
-
-    /**
-     * Use `hex` format.
-     *
-     * @return $this
-     */
-    public function hex()
-    {
-        return $this->options(['format' => 'hex']);
-    }
-
-    /**
-     * Use `rgb` format.
-     *
-     * @return $this
-     */
-    public function rgb()
-    {
-        return $this->options(['format' => 'rgb']);
-    }
-
-    /**
-     * Use `rgba` format.
-     *
-     * @return $this
-     */
-    public function rgba()
-    {
-        return $this->options(['format' => 'rgba']);
-    }
-
-    /**
-     * Render this filed.
-     *
-     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
-     */
-    public function render()
-    {
-        $options = json_encode($this->options);
-
-        $this->script = "$('{$this->getElementClassSelector()}').parent().colorpicker($options);";
-
-        $this->prepend('<i></i>')
-            ->defaultAttribute('style', 'width: 200px');
-
-        return parent::render();
-    }
-}

+ 1 - 1
src/Form/Field/Email.php

@@ -8,7 +8,7 @@ class Email extends Text
 
     public function render()
     {
-        $this->prepend('<i class="ti-email"></i>')
+        $this->prepend('<i class="feather icon-mail"></i>')
             ->defaultAttribute('type', 'email');
 
         return parent::render();

+ 1 - 1
src/Form/Field/Html.php

@@ -65,7 +65,7 @@ class Html extends Field
         $viewClass = $this->getViewElementClasses();
 
         return <<<EOT
-<div class="form-group">
+<div class="form-group row">
     <label  class="{$viewClass['label']} control-label">{$this->label}</label>
     <div class="{$viewClass['field']}">
         {$this->html}

+ 1 - 2
src/Form/Field/Mobile.php

@@ -20,8 +20,7 @@ class Mobile extends Text
     {
         $this->inputmask($this->options);
 
-        $this->prepend('<i class="ti-mobile"></i>')
-            ->defaultAttribute('style', 'width: 200px');
+        $this->prepend('<i class="feather icon-smartphone"></i>');
 
         return parent::render();
     }

+ 1 - 1
src/Form/Field/SelectResource.php

@@ -196,7 +196,7 @@ JS
             $primayDarker = Admin::color()->primaryDarker();
 
             Admin::style(
-                ".select-resource .nav li a{padding:8px 10px;font-size:13px;font-weight:bold;color:{$primayDarker}}.select-resource .nav li a.red{cursor:pointer}.select-resource .nav-stacked>li{border-bottom:1px solid #eee;background: #fff;}.select-resource .nav {border: 1px solid #eee;margin-bottom:5px;}"
+                ".select-resource .nav li{width:100%}.select-resource .nav li a{padding:8px 10px;font-size:13px;color:{$primayDarker}}.select-resource .nav li a.red{cursor:pointer}.select-resource .nav-stacked>li{border-bottom:1px solid #eee;background: #fff;}.select-resource .nav {border: 1px solid #eee;margin-bottom:5px;}"
             );
         }
     }

+ 0 - 5
src/Form/NestedForm.php

@@ -21,7 +21,6 @@ use Illuminate\Support\Collection;
  * @method Field\Id                     id($column, $label = '')
  * @method Field\Ip                     ip($column, $label = '')
  * @method Field\Url                    url($column, $label = '')
- * @method Field\Color                  color($column, $label = '')
  * @method Field\Email                  email($column, $label = '')
  * @method Field\Mobile                 mobile($column, $label = '')
  * @method Field\Slider                 slider($column, $label = '')
@@ -61,10 +60,6 @@ use Illuminate\Support\Collection;
  * @method Field\Timezone               timezone($column, $label = '')
  * @method Field\KeyValue               keyValue($column, $label = '')
  * @method Field\Tel                    tel($column, $label = '')
- * @method Field\BootstrapFile          bootstrapFile($column, $label = '')
- * @method Field\BootstrapImage         bootstrapImage($column, $label = '')
- * @method Field\BootstrapMultipleImage bootstrapMultipleImage($column, $label = '')
- * @method Field\BootstrapMultipleFile  bootstrapMultipleFile($column, $label = '')
  */
 class NestedForm
 {

+ 1 - 2
src/Grid/Displayers/DialogTree.php

@@ -252,7 +252,7 @@ $('.{$this->getSelectorPrefix()}-open-tree').off('click').click(function () {
 
             v['state'] = {'disabled': true};
 
-            if (ckall || (value && Dcat.arr.in(value, v[idColumn]))) {
+            if (ckall || (value && Dcat.helpers.in(value, v[idColumn]))) {
                 v['state']['selected'] = true;
             }
 
@@ -266,7 +266,6 @@ $('.{$this->getSelectorPrefix()}-open-tree').off('click').click(function () {
        
         return nodes;
     }
-    
 });
 JS
         );

+ 1 - 1
src/Layout/Assets.php

@@ -112,7 +112,7 @@ class Assets
         ],
         '@jquery.bootstrap-duallistbox' => [
             'js'  => 'dcat-admin/dcat/plugins/bootstrap-duallistbox/dist/jquery.bootstrap-duallistbox.min.js',
-            'css' => 'dcat-admin/dcat/plugins/bootstrap-duallistbox/dist/jquery.bootstrap-duallistbox.min.css',
+            'css' => 'dcat-admin/dcat/plugins/bootstrap-duallistbox/dist/bootstrap-duallistbox.min.css',
         ],
         '@number-input' => [
             'js' => 'dcat-admin/dcat/plugins/number-input/bootstrap-number-input.js',

+ 0 - 5
src/Widgets/Form.php

@@ -32,7 +32,6 @@ use Illuminate\Validation\Validator;
  * @method Field\Id             id($column, $label = '')
  * @method Field\Ip             ip($column, $label = '')
  * @method Field\Url            url($column, $label = '')
- * @method Field\Color          color($column, $label = '')
  * @method Field\Email          email($column, $label = '')
  * @method Field\Mobile         mobile($column, $label = '')
  * @method Field\Slider         slider($column, $label = '')
@@ -72,10 +71,6 @@ use Illuminate\Validation\Validator;
  * @method Field\Timezone       timezone($column, $label = '')
  * @method Field\KeyValue       keyValue($column, $label = '')
  * @method Field\Tel            tel($column, $label = '')
- * @method Field\BootstrapFile          bootstrapFile($column, $label = '')
- * @method Field\BootstrapImage         bootstrapImage($column, $label = '')
- * @method Field\BootstrapMultipleImage bootstrapMultipleImage($column, $label = '')
- * @method Field\BootstrapMultipleFile  bootstrapMultipleFile($column, $label = '')
  */
 class Form implements Renderable
 {