Skip to content
Open
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
2 changes: 2 additions & 0 deletions resources/js/@types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type BrowserConfig = {
perPage?: number
paginationOptions?: number[]
component?: string
modalSize: 'full' | '7xl'
}

export type Config = {
Expand All @@ -43,6 +44,7 @@ export type Config = {
outdated?: boolean
perPage?: number
paginationOptions?: number[]
modalSize: 'full' | '7xl'
}

export type Entity = {
Expand Down
1 change: 1 addition & 0 deletions resources/js/components/Cards/FieldCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const preview = (file: Entity) => {
perPage: 10,
paginationOptions: undefined,
component: undefined,
modalSize: props.field.modalSize ?? '7xl',
})
store.setDisk({
disk: props.field.singleDisk ? 'default' : props.field.value[0].disk,
Expand Down
4 changes: 3 additions & 1 deletion resources/js/components/Modals/PreviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const isCropModalOpened = computed(() => store.isOpen(`crop-image-${props.file?.
const isEditModalOpened = computed(() => store.isOpen(`edit-image-${props.file?.id}`))
const isField = computed(() => store.isField)
const downloadUrl = computed(() => store.downloadUrl(props.file))
const modalSize = computed(() => `max-w-${store.modalSize || '7xl'}`)

// ACTIONS
const openModal = (name: string) => store.openModal({ name })
Expand Down Expand Up @@ -85,7 +86,8 @@ const copy = (file: Entity) => {
<template>
<BaseModal as="template" class="nova-file-manager" :name="PREVIEW_MODAL_NAME" :initial-focus-ref="buttonRef">
<DialogPanel
class="relative bg-gray-100 dark:bg-gray-900 rounded-lg overflow-hidden shadow-xl transform transition-all w-full max-w-7xl p-4 flex flex-col gap-4"
class="relative bg-gray-100 dark:bg-gray-900 rounded-lg overflow-hidden shadow-xl transform transition-all w-full p-4 flex flex-col gap-4"
:class="modalSize"
>
<div class="w-full flex flex-col flex-col-reverse gap-y-2 md:flex-row justify-between items-start">
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-400 break-all w-full">
Expand Down
8 changes: 8 additions & 0 deletions resources/js/stores/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ interface State {
singleDisk: boolean
flexibleGroup: string[]
fieldInit?: () => void
modalSize: 'full' | '7xl'
permissions?: PermissionsCollection
chunkSize: number
usePintura: boolean
Expand Down Expand Up @@ -125,6 +126,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
singleDisk: false,
flexibleGroup: [],
fieldInit: undefined,
modalSize: '7xl',

// permissions
permissions: {
Expand Down Expand Up @@ -805,6 +807,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
perPage,
paginationOptions,
component,
modalSize,
}: BrowserConfig) {
this.isField = true

Expand All @@ -826,6 +829,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
perPage,
paginationOptions,
component,
modalSize,
})

this.openModal({ name: BROWSER_MODAL_NAME })
Expand All @@ -849,6 +853,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
perPage,
paginationOptions,
component,
modalSize,
}: BrowserConfig) {
this.multiple = multiple
this.limit = limit
Expand All @@ -868,6 +873,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
this.permissions = permissions
this.disk = undefined
this.component = component
this.modalSize = modalSize
},

closeBrowser() {
Expand Down Expand Up @@ -908,6 +914,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
cropperOptions,
perPage,
paginationOptions,
modalSize,
}: Config) {
this.init()
this.clearSelection()
Expand All @@ -924,6 +931,7 @@ const useBrowserStore = defineStore('nova-file-manager/browser', {
this.perPage = perPage ?? this.perPage
this.perPageOptions = paginationOptions ?? this.perPageOptions
this.error = undefined
this.modalSize = modalSize
},
},
getters: {
Expand Down
7 changes: 7 additions & 0 deletions src/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public function wrapper(string $name): static
return $this;
}

public function modalSize(string $size = '7xl'): static
{
$this->withMeta(['modalSize' => $size]);

return $this;
}

public function resolveThumbnailUrl()
{
return is_callable($this->thumbnailUrlCallback) && !empty($this->value)
Expand Down
4 changes: 4 additions & 0 deletions tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ module.exports = {
addUtilities(utilities)
},
],
safeList: [
'max-w-7xl',
'max-w-full',
]
}
Loading