Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add formStackSize option for inline publish form stacks #11274

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading