|
@@ -91,6 +91,13 @@ class Row implements Renderable
|
|
|
*/
|
|
|
protected $defaultFieldWidth = 12;
|
|
|
|
|
|
+ /**
|
|
|
+ * field width for appended field.
|
|
|
+ *
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ protected $fieldWidth = 12;
|
|
|
+
|
|
|
/**
|
|
|
* @var bool
|
|
|
*/
|
|
@@ -160,6 +167,19 @@ class Row implements Renderable
|
|
|
return $this->form->model();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Set default width for field.
|
|
|
+ *
|
|
|
+ * @param int $width
|
|
|
+ * @return $this
|
|
|
+ */
|
|
|
+ public function defaultWidth(int $width = 12)
|
|
|
+ {
|
|
|
+ $this->defaultFieldWidth = $width;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Set width for a incomming field.
|
|
|
*
|
|
@@ -168,7 +188,7 @@ class Row implements Renderable
|
|
|
*/
|
|
|
public function width($width = 12)
|
|
|
{
|
|
|
- $this->defaultFieldWidth = $width;
|
|
|
+ $this->fieldWidth = $width;
|
|
|
|
|
|
return $this;
|
|
|
}
|
|
@@ -197,10 +217,12 @@ class Row implements Renderable
|
|
|
$field->horizontal($this->horizontal);
|
|
|
|
|
|
$this->fields->push([
|
|
|
- 'width' => $this->defaultFieldWidth,
|
|
|
+ 'width' => $this->fieldWidth,
|
|
|
'element' => $field,
|
|
|
]);
|
|
|
|
|
|
+ $this->fieldWidth = $this->defaultFieldWidth; // reset field width for next field
|
|
|
+
|
|
|
return $field;
|
|
|
}
|
|
|
}
|