From fa885f1c35907018816cb354ff8c46e10086e6f7 Mon Sep 17 00:00:00 2001 From: Jack McDade Date: Fri, 11 Dec 2020 11:01:51 -0500 Subject: [PATCH] Hide Duplciate Row button when max grid rows reached. Closes #3003. --- resources/js/components/fieldtypes/grid/Grid.vue | 1 + resources/js/components/fieldtypes/grid/Row.vue | 6 +++++- resources/js/components/fieldtypes/grid/Stacked.vue | 1 + resources/js/components/fieldtypes/grid/Table.vue | 1 + resources/js/components/fieldtypes/grid/View.vue | 2 +- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/js/components/fieldtypes/grid/Grid.vue b/resources/js/components/fieldtypes/grid/Grid.vue index 3268a6f9ec..54d6bcd976 100644 --- a/resources/js/components/fieldtypes/grid/Grid.vue +++ b/resources/js/components/fieldtypes/grid/Grid.vue @@ -17,6 +17,7 @@ :meta="meta.existing" :name="name" :can-delete-rows="canDeleteRows" + :can-add-rows="canAddRows" @updated="updated" @meta-updated="updateRowMeta" @removed="removed" diff --git a/resources/js/components/fieldtypes/grid/Row.vue b/resources/js/components/fieldtypes/grid/Row.vue index a1f8849f52..b13784968c 100644 --- a/resources/js/components/fieldtypes/grid/Row.vue +++ b/resources/js/components/fieldtypes/grid/Row.vue @@ -22,7 +22,7 @@ - + @@ -74,6 +74,10 @@ export default { type: Boolean, default: true }, + canAddRows: { + type: Boolean, + default: true + }, }, inject: [ diff --git a/resources/js/components/fieldtypes/grid/Stacked.vue b/resources/js/components/fieldtypes/grid/Stacked.vue index 7a3cb20473..a4d16032c4 100644 --- a/resources/js/components/fieldtypes/grid/Stacked.vue +++ b/resources/js/components/fieldtypes/grid/Stacked.vue @@ -20,6 +20,7 @@ :name="name" :error-key-prefix="errorKeyPrefix" :can-delete="canDeleteRows" + :can-add-rows="canAddRows" @updated="(row, value) => $emit('updated', row, value)" @meta-updated="$emit('meta-updated', row._id, $event)" @removed="(row) => $emit('removed', row)" diff --git a/resources/js/components/fieldtypes/grid/Table.vue b/resources/js/components/fieldtypes/grid/Table.vue index 22e537c70b..19d62def74 100644 --- a/resources/js/components/fieldtypes/grid/Table.vue +++ b/resources/js/components/fieldtypes/grid/Table.vue @@ -32,6 +32,7 @@ :name="name" :error-key-prefix="errorKeyPrefix" :can-delete="canDeleteRows" + :can-add-rows="canAddRows" @updated="(row, value) => $emit('updated', row, value)" @meta-updated="$emit('meta-updated', row._id, $event)" @duplicate="(row) => $emit('duplicate', row)" diff --git a/resources/js/components/fieldtypes/grid/View.vue b/resources/js/components/fieldtypes/grid/View.vue index d066128e53..7b421c162b 100644 --- a/resources/js/components/fieldtypes/grid/View.vue +++ b/resources/js/components/fieldtypes/grid/View.vue @@ -1,7 +1,7 @@