Row.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * FormBuilder表单生成器
  4. * Author: xaboy
  5. * Github: https://github.com/xaboy/form-builder
  6. */
  7. namespace FormBuilder\components;
  8. use FormBuilder\interfaces\FormComponentInterFace;
  9. use FormBuilder\traits\component\CallPropsTrait;
  10. /**
  11. * row栅格规则
  12. * Class Row
  13. *
  14. * @package FormBuilder\components
  15. * @method $this gutter(Number $gutter) 栅格间距,单位 px,左右平分
  16. * @method $this type(String $type) 栅格的顺序,在flex布局模式下有效
  17. * @method $this align(String $align) flex 布局下的垂直对齐方式,可选值为top、middle、bottom
  18. * @method $this justify(String $justify) flex 布局下的水平排列方式,可选值为start、end、center、space-around、space-between
  19. * @method $this className(String $className) 自定义的class名称
  20. */
  21. class Row implements FormComponentInterFace
  22. {
  23. use CallPropsTrait;
  24. /**
  25. * @var array
  26. */
  27. protected $props;
  28. /**
  29. * @var array
  30. */
  31. protected static $propsRule = [
  32. 'gutter' => 'number',
  33. 'type' => 'string',
  34. 'align' => 'string',
  35. 'justify' => 'string',
  36. 'className' => 'string',
  37. ];
  38. /**
  39. * Row constructor.
  40. *
  41. * @param int $gutter
  42. * @param string $type
  43. * @param string $align
  44. * @param string $justify
  45. * @param string $className
  46. */
  47. public function __construct($gutter = 0, $type = '', $align = '', $justify = '', $className = '')
  48. {
  49. $this->props = compact('gutter', 'type', 'align', 'justify', 'className');
  50. }
  51. /**
  52. * @return array
  53. */
  54. public function build()
  55. {
  56. return $this->props;
  57. }
  58. }