From 6f74155656e7e317c23ef4b4d049bf6a7e7224f9 Mon Sep 17 00:00:00 2001 From: greta Date: Fri, 2 Feb 2024 12:58:55 +0100 Subject: [PATCH] feat(NcAppContent): Support full width lists Signed-off-by: greta --- src/components/NcAppContent/NcAppContent.vue | 61 +++-- .../NcAppContent/NcAppDetailsToggle.vue | 37 ++- src/components/NcListItem/NcListItem.vue | 243 ++++++++++-------- 3 files changed, 207 insertions(+), 134 deletions(-) diff --git a/src/components/NcAppContent/NcAppContent.vue b/src/components/NcAppContent/NcAppContent.vue index c2ff841722..1a59fa4ad2 100644 --- a/src/components/NcAppContent/NcAppContent.vue +++ b/src/components/NcAppContent/NcAppContent.vue @@ -78,16 +78,18 @@ The list size must be between the min and the max width value. - - + @@ -119,11 +120,11 @@ import NcAppDetailsToggle from './NcAppDetailsToggle.vue' import { useIsMobile } from '../../composables/useIsMobile/index.js' import { getBuilder } from '@nextcloud/browser-storage' -import { emit } from '@nextcloud/event-bus' import { useSwipe } from '@vueuse/core' import { Splitpanes, Pane } from 'splitpanes' import 'splitpanes/dist/splitpanes.css' +import { emit } from '@nextcloud/event-bus' const browserStorage = getBuilder('nextcloud').persist().build() @@ -139,7 +140,6 @@ export default { Pane, Splitpanes, }, - props: { /** * Allows to disable the control by swipe of the app navigation open state @@ -202,6 +202,19 @@ export default { type: String, default: null, }, + /** + * 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. + * On mobile screen `no-split` layout is forced. + */ + layout: { + type: String, + default: 'vertical-split', + validator(value) { + return ['no-split', 'vertical-split'].includes(value) + }, + }, }, emits: [ @@ -219,7 +232,7 @@ export default { return { contentHeight: 0, hasList: false, - + hasContent: false, swiping: {}, listPaneSize: this.restorePaneConfig(), } @@ -271,7 +284,7 @@ export default { }, updated() { - this.checkListSlot() + this.checkSlots() }, mounted() { @@ -281,7 +294,7 @@ export default { }) } - this.checkListSlot() + this.checkSlots() this.restorePaneConfig() }, @@ -320,11 +333,9 @@ export default { }, // $slots is not reactive, we need to update this manually - checkListSlot() { - const hasListSlot = !!this.$slots.list - if (this.hasList !== hasListSlot) { - this.hasList = hasListSlot - } + checkSlots() { + this.hasList = !!this.$scopedSlots.list + this.hasContent = !!this.$scopedSlots.default }, // browserStorage is not reactive, we need to update this manually @@ -370,7 +381,7 @@ export default { } // Mobile list/details handling -.app-content-wrapper--mobile { +.app-content-wrapper--no-split { &.app-content-wrapper--show-list :deep() { .app-content-list { display: flex; @@ -431,4 +442,10 @@ export default { } } } + +.app-content-wrapper--show-list { + :deep(.app-content-list) { + max-width: none; + } +} diff --git a/src/components/NcAppContent/NcAppDetailsToggle.vue b/src/components/NcAppContent/NcAppDetailsToggle.vue index 0390069b00..3745785b3c 100644 --- a/src/components/NcAppContent/NcAppDetailsToggle.vue +++ b/src/components/NcAppContent/NcAppDetailsToggle.vue @@ -21,7 +21,11 @@ --> -