Skip to content

Commit

Permalink
[5.x] Add formStackSize option for inline publish form stacks (#11274)
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean authored Dec 18, 2024
1 parent 3e47dd1 commit 78299c9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:creatables="creatables"
:form-component="formComponent"
:form-component-props="formComponentProps"
:form-stack-size="formStackSize"
:status-icons="statusIcons"
:columns="columns"
:search="canSearch"
Expand Down Expand Up @@ -131,6 +132,10 @@ export default {
return this.meta.formComponentProps;
},
formStackSize() {
return this.meta.formStackSize;
},
taggable() {
return this.meta.taggable;
},
Expand Down
2 changes: 2 additions & 0 deletions resources/js/components/inputs/relationship/CreateButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
:item-url="creatable.url"
:component="component"
:component-props="componentProps"
:stack-size="stackSize"
@created="itemCreated"
@closed="stopCreating"
/>
Expand All @@ -47,6 +48,7 @@ export default {
creatables: Array,
component: String,
componentProps: Object,
stackSize: String,
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<div>
<stack name="inline-editor"
:before-close="shouldClose"
:narrow="stackSize === 'narrow'"
:half="stackSize === 'half'"
:full="stackSize === 'full'"
@closed="close"
>
<div class="h-full overflow-scroll overflow-x-auto p-6 bg-gray-300 dark:bg-dark-800">
Expand Down Expand Up @@ -44,6 +47,7 @@ export default {
props: {
component: String,
componentProps: Object,
stackSize: String,
},
data() {
Expand Down
2 changes: 2 additions & 0 deletions resources/js/components/inputs/relationship/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
:item="item"
:component="formComponent"
:component-props="formComponentProps"
:stack-size="formStackSize"
@updated="itemUpdated"
@closed="isEditing = false"
/>
Expand Down Expand Up @@ -67,6 +68,7 @@ export default {
readOnly: Boolean,
formComponent: String,
formComponentProps: Object,
formStackSize: String,
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
/>
Expand All @@ -51,6 +52,7 @@
:site="site"
:component="formComponent"
:component-props="formComponentProps"
:stack-size="formStackSize"
@created="itemCreated"
/>
</div>
Expand Down Expand Up @@ -122,6 +124,7 @@ export default {
creatables: Array,
formComponent: String,
formComponentProps: Object,
formStackSize: String,
mode: {
type: String,
default: 'default',
Expand Down
7 changes: 7 additions & 0 deletions src/Fieldtypes/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ abstract class Relationship extends Fieldtype
protected $formComponentProps = [
'_' => '_', // forces an object in js
];
protected $formStackSize;

protected function configFieldItems(): array
{
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -182,6 +184,11 @@ protected function getFormComponentProps()
return $this->formComponentProps;
}

protected function getFormStackSize()
{
return $this->formStackSize;
}

protected function getColumns()
{
return [
Expand Down

0 comments on commit 78299c9

Please sign in to comment.