xaboy 1 年間 前
コミット
df5556e80b

+ 1 - 1
src/UI/Elm/Components/Frame.php

@@ -74,7 +74,7 @@ class Frame extends FormComponent
 
     public function createValidate()
     {
-        return Elm::validateArr();
+        return isset($this->props['maxLength']) && $this->props['maxLength'] === 1 ? Elm::validateStr() : Elm::validateArr();
     }
 
     protected function init()

+ 2 - 4
src/UI/Elm/Components/Upload.php

@@ -48,8 +48,6 @@ class Upload extends FormComponent
     protected $defaultProps = [
         'limit' => 0,
         'uploadType' => self::TYPE_FILE,
-        'headers' => [],
-        'data' => []
     ];
 
     protected static $propsRule = [
@@ -78,7 +76,7 @@ class Upload extends FormComponent
      */
     public function headers(array $headers)
     {
-        $this->props['headers'] = array_merge($this->props['headers'], $headers);
+        $this->props['headers'] = array_merge($this->props['headers']?? [], $headers);
         return $this;
     }
 
@@ -90,7 +88,7 @@ class Upload extends FormComponent
      */
     public function data(array $data)
     {
-        $this->props['data'] = array_merge($this->props['data'], $data);
+        $this->props['data'] = array_merge($this->props['data']?? [], $data);
         return $this;
     }
 

+ 1 - 1
src/UI/Iview/Components/Frame.php

@@ -73,7 +73,7 @@ class Frame extends FormComponent
 
     public function createValidate()
     {
-        return Iview::validateArr();
+        return isset($this->props['maxLength']) && $this->props['maxLength'] === 1 ? Iview::validateStr() : Iview::validateArr();
     }
 
     protected function init()

+ 2 - 4
src/UI/Iview/Components/Upload.php

@@ -47,8 +47,6 @@ class Upload extends FormComponent
         'maxLength' => 0,
         'type' => 'select',
         'uploadType' => self::TYPE_FILE,
-        'headers' => [],
-        'data' => [],
         'format' => [],
         'show-upload-list' => false
     ];
@@ -77,7 +75,7 @@ class Upload extends FormComponent
      */
     public function headers(array $headers)
     {
-        $this->props['headers'] = array_merge($this->props['headers'], $headers);
+        $this->props['headers'] = array_merge($this->props['headers'] ?? [], $headers);
         return $this;
     }
 
@@ -91,7 +89,7 @@ class Upload extends FormComponent
      */
     public function format(array $format)
     {
-        $this->props['format'] = array_merge($this->props['format'], $format);
+        $this->props['format'] = array_merge($this->props['format'] ?? [], $format);
         return $this;
     }