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

feat(NcAppContent): add horizontal split layout #5401

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 31 additions & 17 deletions src/components/NcAppContent/NcAppContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ The list size must be between the min and the max width value.

<slot v-else />
</div>
<div v-else-if="layout === 'vertical-split'" class="app-content-wrapper">
<Splitpanes class="default-theme"
<div v-else-if="layout === 'vertical-split' || layout === 'horizontal-split'" class="app-content-wrapper">
<Splitpanes :horizontal="layout === 'horizontal-split'"
class="default-theme"
:class="{ 'splitpanes--horizontal': layout === 'horizontal-split',
'splitpanes--vertical': layout === 'vertical-split'
}"
@resized="handlePaneResize">
<Pane class="splitpanes__pane-list"
:size="listPaneSize || paneDefaults.list.size"
Expand Down Expand Up @@ -150,7 +154,8 @@ export default {
},

/**
* Allows you to set the default width of the resizable list in %
* Allows you to set the default width of the resizable list in % on vertical-split
* Allows you to set the default height of the resizable list in % on horizontal-split
* Must be between listMinWidth and listMaxWidth
*/
listSize: {
Expand All @@ -159,15 +164,17 @@ export default {
},

/**
* Allows you to set the minimum width of the list column in %
* Allows you to set the minimum width of the list column in % on vertical-split
* Allows you to set the minimum height of the list column in % on horizontal-split
*/
listMinWidth: {
type: Number,
default: 15,
},

/**
* Allows you to set the maximum width of the list column in %
* Allows you to set the maximum width of the list column in % on vertical-split
* Allows you to set the maximum height of the list column in % on horizontal-split
*/
listMaxWidth: {
type: Number,
Expand Down Expand Up @@ -206,13 +213,14 @@ export default {
* Content layout used when there is a list together with content:
* - `vertical-split` - a 2-column layout with list and default content separated vertically
* - `no-split` - a single column layout; List is shown when `showDetails` is `false`, otherwise the default slot content is shown with a back button to return to the list.
* - 'horizontal-split' - a 2-column layout with list and default content separated horizontally
* On mobile screen `no-split` layout is forced.
*/
layout: {
type: String,
default: 'vertical-split',
validator(value) {
return ['no-split', 'vertical-split'].includes(value)
return ['no-split', 'vertical-split', 'horizontal-split'].includes(value)
GretaD marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
Expand Down Expand Up @@ -414,7 +422,6 @@ export default {
&-list {
min-width: 300px;
position: sticky;
top: var(--header-height);

@media only screen and (width < $breakpoint-mobile) {
display: none;
Expand All @@ -429,16 +436,23 @@ export default {
}
}
}

.splitpanes__splitter {
width: 9px;
margin-left: -5px;
background-color: transparent;
border-left: none;

&:before,
&:after {
display: none;
.app-content-wrapper--vertical-split {
.splitpanes__splitter {
width: 9px;
margin-left: -5px;
background-color: transparent;
border-left: none;

&:before,
&:after {
display: none;
}
}
}
.app-content-wrapper--horizontal-split {
.splitpanes__splitter {
height: 9px;
margin-top: -5px;
}
}
}
Expand Down