mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-21 07:33:49 +08:00
feat(dashboard): integrate GridStack for enhanced layout management
- Added GridStack for dynamic dashboard layout with drag-and-drop functionality. - Introduced new properties for DashboardItem to support row configuration. - Enhanced ContentToggleSettingsDialog with reset functionality. - Updated localization files for new dashboard features. - Refactored dashboard components to utilize GridStack for layout rendering. - Improved responsiveness and styling for dashboard elements. - Removed deprecated draggable component in favor of GridStack.
This commit is contained in:
@@ -16,6 +16,8 @@ const props = withDefaults(
|
||||
items: UnknownRecord[]
|
||||
labelGetter?: (item: UnknownRecord) => string
|
||||
modelValue?: boolean
|
||||
resetIcon?: string
|
||||
resetText?: string
|
||||
selectAllText?: string
|
||||
selectNoneText?: string
|
||||
showBulkActions?: boolean
|
||||
@@ -28,6 +30,8 @@ const props = withDefaults(
|
||||
elevated: false,
|
||||
labelGetter: undefined,
|
||||
modelValue: true,
|
||||
resetIcon: 'mdi-restore',
|
||||
resetText: '',
|
||||
selectAllText: '',
|
||||
selectNoneText: '',
|
||||
showBulkActions: false,
|
||||
@@ -38,6 +42,7 @@ const props = withDefaults(
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'close'): void
|
||||
(event: 'reset'): void
|
||||
(event: 'save', payload: { elevated: boolean; enabled: Record<string, boolean> }): void
|
||||
(event: 'update:elevated', value: boolean): void
|
||||
(event: 'update:modelValue', value: boolean): void
|
||||
@@ -99,6 +104,11 @@ function setAllItems(value: boolean) {
|
||||
})
|
||||
}
|
||||
|
||||
// 触发调用方提供的重置动作。
|
||||
function triggerResetAction() {
|
||||
emit('reset')
|
||||
}
|
||||
|
||||
// 提交通用内容开关设置。
|
||||
function submitSettings() {
|
||||
emit('save', {
|
||||
@@ -147,6 +157,12 @@ function submitSettings() {
|
||||
</p>
|
||||
</VCardText>
|
||||
<VCardActions class="pt-3">
|
||||
<VBtn v-if="props.resetText" variant="text" color="secondary" @click="triggerResetAction">
|
||||
<template #prepend>
|
||||
<VIcon :icon="props.resetIcon" />
|
||||
</template>
|
||||
{{ props.resetText }}
|
||||
</VBtn>
|
||||
<VBtn v-if="props.showBulkActions" variant="text" @click="setAllItems(true)">
|
||||
{{ props.selectAllText }}
|
||||
</VBtn>
|
||||
|
||||
@@ -148,17 +148,11 @@ onUnmounted(() => {
|
||||
<VCardText class="p-0">
|
||||
<DashboardRender v-for="(item, index) in props.config?.elements" :key="index" :config="item" />
|
||||
</VCardText>
|
||||
<div v-if="hover.isHovering" class="absolute right-5 top-5">
|
||||
<VIcon class="cursor-move">mdi-drag</VIcon>
|
||||
</div>
|
||||
</VCard>
|
||||
</div>
|
||||
<!-- 有边框 -->
|
||||
<VCard v-else v-bind="hover.props">
|
||||
<VCardItem v-if="props.config?.attrs.border !== false">
|
||||
<template #append>
|
||||
<VIcon class="cursor-move" v-if="hover.isHovering">mdi-drag</VIcon>
|
||||
</template>
|
||||
<VCardTitle>
|
||||
{{ props.config?.attrs?.title ?? props.config?.name }}
|
||||
</VCardTitle>
|
||||
|
||||
Reference in New Issue
Block a user