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

[stable4] Only scroll file table and not the container #901

Merged
merged 1 commit into from
Aug 16, 2023
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
6 changes: 3 additions & 3 deletions l10n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ msgstr ""
msgid "Copy"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:213
#: lib/components/FilePicker/FilePicker.vue:214
msgid "Could not create the new folder"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:136
#: lib/components/FilePicker/FilePicker.vue:137
#: lib/components/FilePicker/FilePickerNavigation.vue:65
msgid "Favorites"
msgstr ""
Expand All @@ -55,7 +55,7 @@ msgstr ""
msgid "Name"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:136
#: lib/components/FilePicker/FilePicker.vue:137
#: lib/components/FilePicker/FilePickerNavigation.vue:61
msgid "Recent"
msgstr ""
Expand Down
54 changes: 42 additions & 12 deletions lib/components/DialogBase.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<NcModal v-if="open" v-bind="modalProps" @close="handleClose">
<Fragment>
<NcModal v-if="open" v-bind="modalProps" class="dialog__modal" @close="handleClose">
<div class="dialog">
<div ref="wrapper" :class="['dialog__wrapper', { 'dialog__wrapper--collapsed': isNavigationCollapsed }]">
<!-- If the navigation is shown on top of the content, the header should be above the navigation -->
<h2 v-if="isNavigationCollapsed" class="dialog__name">
Expand All @@ -11,7 +11,7 @@
<slot name="navigation" :is-collapsed="isNavigationCollapsed" />
</nav>
<!-- Main dialog content -->
<div class="dialog__content">
<div :class="['dialog__content', ...contentClasses]">
<!-- If the navigation is shown on the side the header should be directly aligned with the content -->
<h2 v-if="!isNavigationCollapsed" class="dialog__name">
{{ props.name }}
Expand All @@ -30,30 +30,31 @@
@click="handleClose" />
</slot>
</div>
</Fragment>
</div>
</NcModal>
</template>

<script setup lang="ts">
import { NcModal } from '@nextcloud/vue'
import { computed, ref, useSlots } from 'vue'
import DialogButton, { type IDialogButton } from './DialogButton.vue'
import { Fragment } from 'vue-frag' // can be dropped with vue3
import { useElementSize } from '@vueuse/core'

const props = withDefaults(defineProps<{
/** Name of the dialog (the heading) */
name: string
/** Text of the dialog */
message?: string
/** Additional elements to add to the focus trap */
additionalTrapElements?: string[]
/**
* The element here to mount the dialog
* The element where to mount the dialog, if `null` is passed the dialog is mounted in place
* @default 'body'
*/
container?: string
container?: string | null
/**
* Size of the underlying NcModal
* @default 'normal'
* @default 'small'
*/
size?: 'small' | 'normal' | 'large' | 'full'
/**
Expand All @@ -76,12 +77,19 @@ const props = withDefaults(defineProps<{
* ```
*/
navigationClasses?: string[]
/**
* Optionally pass additionaly classes which will be set on the content wrapper for custom styling
* @default []
*/
contentClasses?: string[]
}>(), {
size: 'normal',
container: 'body',
message: '',
additionalTrapElements: () => [],
buttons: () => [],
container: undefined,
message: '',
contentClasses: () => [],
navigationClasses: () => [],
size: 'small',
})

const emit = defineEmits<{
Expand Down Expand Up @@ -128,7 +136,8 @@ const handleClose = () => {
* Properties to pass to the underlying NcModal
*/
const modalProps = computed(() => ({
container: props.container,
additionalTrapElements: props.additionalTrapElements,
container: props.container === undefined ? 'body' : props.container,
name: props.name,
size: props.size,
enableSlideshow: false,
Expand All @@ -138,11 +147,25 @@ const modalProps = computed(() => ({

<style lang="scss" scoped>
.dialog {
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;

&__modal {
:deep(.modal-container) {
display: flex !important;
}
}

&__wrapper {
margin-inline: 12px;
margin-block: 0 12px; // remove margin to align header with close button
display: flex;
flex-direction: row;
// Auto scale to fit
flex: 1;
min-height: 0;

&--collapsed {
flex-direction: column;
Expand All @@ -151,6 +174,7 @@ const modalProps = computed(() => ({

&__navigation {
display: flex;
flex-shrink: 0;
}

// Navigation styling when side-by-side with content
Expand Down Expand Up @@ -183,6 +207,12 @@ const modalProps = computed(() => ({
margin-block: 4px 12px; // start = 4px to align with close button
}

&__content {
// Auto fit
flex: 1;
min-height: 0;
}

&__actions {
display: flex;
gap: 6px;
Expand Down
4 changes: 4 additions & 0 deletions lib/components/FilePicker/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ function onChangeDirectory(dir: Node) {
table-layout: fixed;
}
th {
position: sticky;
top: 0;
background-color: var(--color-main-background);

&.row-checkbox {
width: 44px;
}
Expand Down
11 changes: 11 additions & 0 deletions lib/components/FilePicker/FilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const dialogProps = computed(() => ({
buttons: dialogButtons.value,
size: 'large',
navigationClasses: ['file-picker__navigation'],
contentClasses: ['file-picker__content'],
}))

/**
Expand Down Expand Up @@ -242,6 +243,16 @@ export default {

&__main {
width: 100%;
display: flex;
flex-direction: column;
// Auto fit height
min-height: 0;
flex: 1;
}
}

:deep(.file-picker__content) {
display: flex;
flex-direction: column;
}
</style>
Loading