diff --git a/resources/js/components/FormField.vue b/resources/js/components/FormField.vue
index 0972b7f..b2bbe53 100644
--- a/resources/js/components/FormField.vue
+++ b/resources/js/components/FormField.vue
@@ -10,6 +10,8 @@
:key="index"
:index="index"
:field="field"
+ :resource-id="resourceId"
+ :resource-name="resourceName"
@delete-row="deleteRow"
>
@@ -94,7 +96,7 @@
addNewRow() {
if (! this.hasReachedMaximumRows) {
let newRow = this.field.sub_fields
- .map(subField => subField.name)
+ .map(subField => subField.attribute)
.reduce((o, key) => ({...o, [key]: null}), {});
this.rows.push(newRow);
diff --git a/resources/js/components/rows/SubFieldRow.vue b/resources/js/components/rows/SubFieldRow.vue
index 52f13ad..78487f3 100644
--- a/resources/js/components/rows/SubFieldRow.vue
+++ b/resources/js/components/rows/SubFieldRow.vue
@@ -17,6 +17,7 @@
+
+
+
+
+
@@ -46,7 +64,25 @@
TextareaSubField,
},
- props: ['value', 'field', 'index'],
+ props: ['value', 'field', 'index', 'resourceName', 'resourceId'],
+
+ mounted(){
+ var _this = this;
+
+ this.$children.filter(component => {
+ if(component.field){
+ component.value = _this.value[component.field.attribute]
+ }
+
+ component.$watch(
+ value => {
+ if(component.field){
+ _this.value[component.field.attribute] = component.value
+ }
+ }
+ );
+ });
+ },
computed:{
formLayout(){
diff --git a/src/Repeater.php b/src/Repeater.php
index 3f63a5f..1312c8c 100644
--- a/src/Repeater.php
+++ b/src/Repeater.php
@@ -29,6 +29,13 @@ public function addField($fieldConfig)
]);
}
+ public function addNovaFields($fieldsConfig)
+ {
+ return $this->withMeta([
+ 'sub_fields' => $fieldsConfig,
+ ]);
+ }
+
public function addButtonText($text)
{
return $this->withMeta([