From 3f701abf4b6b903d03f9684261ec64b78312439c Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Tue, 17 Dec 2024 20:36:03 +0000 Subject: [PATCH] Add `$formStackSize` option for inline publish form stacks --- .../fieldtypes/relationship/RelationshipFieldtype.vue | 5 +++++ .../js/components/inputs/relationship/CreateButton.vue | 2 ++ .../components/inputs/relationship/InlinePublishForm.vue | 4 ++++ resources/js/components/inputs/relationship/Item.vue | 2 ++ .../components/inputs/relationship/RelationshipInput.vue | 3 +++ src/Fieldtypes/Relationship.php | 7 +++++++ 6 files changed, 23 insertions(+) diff --git a/resources/js/components/fieldtypes/relationship/RelationshipFieldtype.vue b/resources/js/components/fieldtypes/relationship/RelationshipFieldtype.vue index b0efc76512..19bb79e7da 100644 --- a/resources/js/components/fieldtypes/relationship/RelationshipFieldtype.vue +++ b/resources/js/components/fieldtypes/relationship/RelationshipFieldtype.vue @@ -19,6 +19,7 @@ :creatables="creatables" :form-component="formComponent" :form-component-props="formComponentProps" + :form-stack-size="formStackSize" :status-icons="statusIcons" :columns="columns" :search="canSearch" @@ -131,6 +132,10 @@ export default { return this.meta.formComponentProps; }, + formStackSize() { + return this.meta.formStackSize; + }, + taggable() { return this.meta.taggable; }, diff --git a/resources/js/components/inputs/relationship/CreateButton.vue b/resources/js/components/inputs/relationship/CreateButton.vue index 4a02f86be7..a46d2ecfcc 100644 --- a/resources/js/components/inputs/relationship/CreateButton.vue +++ b/resources/js/components/inputs/relationship/CreateButton.vue @@ -26,6 +26,7 @@ :item-url="creatable.url" :component="component" :component-props="componentProps" + :stack-size="stackSize" @created="itemCreated" @closed="stopCreating" /> @@ -47,6 +48,7 @@ export default { creatables: Array, component: String, componentProps: Object, + stackSize: String, }, data() { diff --git a/resources/js/components/inputs/relationship/InlinePublishForm.vue b/resources/js/components/inputs/relationship/InlinePublishForm.vue index d4362b6422..428d58db24 100644 --- a/resources/js/components/inputs/relationship/InlinePublishForm.vue +++ b/resources/js/components/inputs/relationship/InlinePublishForm.vue @@ -3,6 +3,9 @@
@@ -44,6 +47,7 @@ export default { props: { component: String, componentProps: Object, + stackSize: String, }, data() { diff --git a/resources/js/components/inputs/relationship/Item.vue b/resources/js/components/inputs/relationship/Item.vue index e1d7c23de1..b2aa55b38f 100644 --- a/resources/js/components/inputs/relationship/Item.vue +++ b/resources/js/components/inputs/relationship/Item.vue @@ -22,6 +22,7 @@ :item="item" :component="formComponent" :component-props="formComponentProps" + :stack-size="formStackSize" @updated="itemUpdated" @closed="isEditing = false" /> @@ -67,6 +68,7 @@ export default { readOnly: Boolean, formComponent: String, formComponentProps: Object, + formStackSize: String, }, data() { diff --git a/resources/js/components/inputs/relationship/RelationshipInput.vue b/resources/js/components/inputs/relationship/RelationshipInput.vue index 1616fd90de..b3554e0388 100644 --- a/resources/js/components/inputs/relationship/RelationshipInput.vue +++ b/resources/js/components/inputs/relationship/RelationshipInput.vue @@ -33,6 +33,7 @@ :read-only="readOnly" :form-component="formComponent" :form-component-props="formComponentProps" + :form-stack-size="formStackSize" class="item outline-none" @removed="remove(i)" /> @@ -51,6 +52,7 @@ :site="site" :component="formComponent" :component-props="formComponentProps" + :stack-size="formStackSize" @created="itemCreated" />
@@ -122,6 +124,7 @@ export default { creatables: Array, formComponent: String, formComponentProps: Object, + formStackSize: String, mode: { type: String, default: 'default', diff --git a/src/Fieldtypes/Relationship.php b/src/Fieldtypes/Relationship.php index f785753cc7..4807722650 100644 --- a/src/Fieldtypes/Relationship.php +++ b/src/Fieldtypes/Relationship.php @@ -26,6 +26,7 @@ abstract class Relationship extends Fieldtype protected $formComponentProps = [ '_' => '_', // forces an object in js ]; + protected $formStackSize; protected function configFieldItems(): array { @@ -133,6 +134,7 @@ public function preload() 'creatables' => $this->canCreate() ? $this->getCreatables() : [], 'formComponent' => $this->getFormComponent(), 'formComponentProps' => $this->getFormComponentProps(), + 'formStackSize' => $this->getFormStackSize(), 'taggable' => $this->getTaggable(), 'initialSortColumn' => $this->initialSortColumn(), 'initialSortDirection' => $this->initialSortDirection(), @@ -182,6 +184,11 @@ protected function getFormComponentProps() return $this->formComponentProps; } + protected function getFormStackSize() + { + return $this->formStackSize; + } + protected function getColumns() { return [